Cześć, tu Jakub. Polubiłeś devFlipCards? Postaw mi kawę

8. Co się stanie, gdy zwrócisz string z funkcji, która powinna zwrócić never lub void?

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" }
Nie możesz znaleźć wspólnego terminu na spotkanie z przyjaciółmi? Sprawdź nasze narzędzie
commondate.xyz