TypeScript

Typescript Enum All you need to know

A Typescript enum allows us to define the collection of related values to be used by name. They make the code easier to read. You may use them when you want to limit the values that a variable can take to a small set of possible values. Javascript does not support enums, hence typescript creates runtime artifact to support them ( Except, const enum which do not have a runtime artifact). TypeScript provides both numeric and string-based enums.

Typescript Enum All you need to know Read More »

Nullable Types / Non Nullable Types in TypeScript

Typescript types are Nullable Types. i.e you can assign Null & undefined to any of the types. The compiler will not throw any error. But from the Typescript version 2.0, we can define Non Nullable types with the –strictNullChecks flag on. The strictNullChecks is flag is set to false by default. But, when set to true in tsconfig.json it stops us from assigning the null & undefined to a type. Thus converting the types into Non Nullable types.

Nullable Types / Non Nullable Types in TypeScript Read More »

Scroll to Top