Posts

Showing posts from April, 2020

Typescript Introduction

Typescript is a super set of java script, when we compile (transpile) Typescript code it generates java script code. In sort, Typescript is a language which generates java script when compiled. all the java script code is a valid Typescript code (i.e. we can write java script code inside type script file). Now question comes in our mind, why we need typescript? because it's a typed language as we know that java script is not typed language, In java script, data type of a variable inferred by compiler automatically based on value assigned to it. for example : var name ="nds";// name is string       name =40; // here name is number       name =true; //here name is boolean. In Typescript, we can declare type of a variable so, it will accept value only the declared type. apart from this, some more differences exists between typescript and java script. some features of Typescript's included in the newer version of Java script (ES-6) as well.