Hi, I'm Jacob. Enjoying devFlipCards? Buy me a coffee

9. What would happen, if you tried to assign result of void function to a variable?

Type void despite it's unique appliance is in TypeScript same type as any other - that's why there's no problem with assigning it to any variable, as long as it's type is not defined yet or it's void as well.

const voidFunc = (): void => { return; } const val = voidFunc(); const x: string = val; // Type 'void' is not assignable to type 'string'
Struggling to find common date to meet with your friends? Try our new tool
commondate.xyz