Boolean Type Literal in TypeScript

added by DotNetKicks
3/15/2022 3:41:50 PM

190 Views

TypeScript has the concept of Type literal. That means a variable can hold only one valid and specific value of that particular type. Let us say, you have declared a variable as below: let a: true = true; console.log(typeof a); // boolean console.log(a);// true In the above code snippet, the type of variable a is...


0 comments