Understanding Nullable Types in Typescript with examples

Understanding Nullable Types in Typescript with examples: Nullable type is introduced in typescript 2.0, this helps us to keep initialized objects to have some values other than null all the time.   Default number | Assigning null: For eg: let home2OfficeKm = 10; home2OfficeKm = null;     Works fine in typescript 2.0 earlier versions, if you do not want […]

 1,196 total views

» Read more

Difference between Javascript and Typescript

Difference between Javascript and Typescript: Javascript Typescript var myVar = ‘hello’; myVar = 10; console.log(myVar); // prints 10 let myVar = ‘hello’; myVar = 10; console.log(myVar) // we get the error here stating //Type ‘number’ is not assignable to type ‘string’ We dont have a type number only in javascript. Typescript does not have float/double types, everything is considered as […]

 1,397 total views

» Read more

Typescript Quick Notes for Angular Developers

Typescript Quick Notes for Angular Developers: As because of angular’s reach angular developers are forced to learn typescript. It is not tough but it is better to know the below basic syntax to code faster.   1. Converting array to JSON in typescript   selectedItems = []; JSON.stringify(this.selectedItems);       2. For loop in typescript   for(let item of […]

 1,606 total views

» Read more