Kompilator zwróci błąd o niewłaściwym typie:
const voidFunc = (): void => { return ""; // type "string" is not assignable to type "void" } const neverFunc = (): never => { return ""; // type "string" is not assignable to type "never" }
Wróć do: TypeScript
Kompilator zwróci błąd o niewłaściwym typie:
const voidFunc = (): void => { return ""; // type "string" is not assignable to type "void" } const neverFunc = (): never => { return ""; // type "string" is not assignable to type "never" }