5,322
edits
No edit summary |
|||
Line 1: | Line 1: | ||
TypeScript is a typed version of JavaScript. It claims to be a superset of JavaScript. | TypeScript is a typed version of JavaScript. It claims to be a superset of JavaScript but most JS code will need modifications to compile properly as TS code. | ||
The syntax is very similar to Kotlin. | |||
==Syntax== | ==Syntax== | ||
Line 19: | Line 20: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Functions=== | |||
====Overloads==== | |||
See [https://www.typescriptlang.org/docs/handbook/functions.html#overloads Overloads] | |||
TypeScript does not support overloading in the traditional sense, with multiple implementations. | |||
However you can have multiple function definitions similar to prototypes. | |||
===Interfaces=== | ===Interfaces=== | ||
Line 29: | Line 37: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Generics=== | |||
[https://www.typescriptlang.org/docs/handbook/generics.html Generics] | |||
===Type Guards=== | |||
[https://www.typescriptlang.org/docs/handbook/advanced-types.html Advanced Types] | |||
==Compilation== | ==Compilation== |