TypeScript Data Type - Void

Similar to languages like Java, void is used where there is no data type. For example, in return type of functions that do not return any value.

Example: void
function sayHi(): void { 

let speech: void = sayHi(); 
console.log(speech); //Output: undefined

There is no meaning to assign void to a variable, as only null or undefined is assignable to void.

let nothing: void = undefined;
let num: void = 1; // Error