Void
void
is a little like the opposite of any
: the absence of having any type at all. You may commonly see this as the return type of functions that do not return a value:
1 2 3 | function warnUser(): void { alert( "This is my warning message" ); } |
Declaring variables of type void
is not useful because you can only assign undefined
or null
to them:
1 | let unusable: void = undefined; |
Please login to continue.