How to use variable with void data type in TypeScript

1 Answer

0 votes
let nothing: void = undefined;
let x: void;

//let num: void = 324; // Error // Type 'number' is not assignable to type 'void'.(2322)

console.log(nothing); 

console.log(x);    
  
   
   
/*
   
run:
   
undefined 
undefined 
  
*/

 



answered Oct 24, 2021 by avibootz

Related questions

1 answer 80 views
1 answer 158 views
1 answer 146 views
1 answer 147 views
1 answer 121 views
1 answer 194 views
...