23
loading...
This website collects cookies to deliver better user experience
TypeScript is the superset of JavaScript.
TypeScript can be used to built enterprise level applications.
TypeScript provides:
and a ton of amazing things...
TS will save you from more exceptions and project failures.
function addNums(a, b){
return a+b;
}
console.log(addNums(10 + '10'))
// here the output would be 1010
function addNums(a:number, b:number){
return a+b
}
console.log(addNums(10 + 10)) // output: 20
console.log(addNums(10 + '10')) // output: this would give an error (argument of type string isn't assignable to string)
If there is a large code-base and there are lots and lots of variables... so it is natural to not remember many of them. TS has a great integration with the IDE and together they make our coding experience a lot more smooth. There are many benefits like :
Code auto completion
Type checking in real time
undefined
but in TS it will show an error that the property you are trying to access is not present. Easier Code Factoring