How to declare a type as nullable in TypeScript?

Posted by Rohit Kumar | Updated on

Want to declare a type as nullable in TypeScript? All fields in JavaScript (and in TypeScript) can have the value null or undefined. You can make the field optional which is different from nullable.

Compare with:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers