One Pager Cheat Sheet
- TypeScript is a
superset
of JavaScript developed by Microsoft, that provides extra features to allow for more powerful and efficient coding. - TypeScript provides an advantageous feature of
Static Typing
that helps to detect type-related bugs atcompile time
while this wasn't possible in JavaScript untilruntime
. - TypeScript
adds static typing
to JavaScript, which allows fortype-related bugs
to be detected atcompile time
rather thanruntime
. - TypeScript's
interfaces
provide type-checking and are used for declaring types, function types, and array types, but are not transformed into JavaScript during transpilation. - Interfaces in TypeScript are
a type-checking tool
that allows developers to specify the structure of data expected and create better, more robust code. - TypeScript's generics and optional parameters allow developers to create type-safe code, while also allowing them to specify which parameters are
optional
. - Interfaces in
TypeScript
can beextended
in a few different ways, allowing for the implementation ofmultiple interfaces
or theexpansion
of an existing one for greater flexibility. - TypeScript offers native support for
enums
, which makes defining them easier and more readable thanObject.freeze()
'd key-value pairs in JavaScript. - The challenge of using TypeScript is its learning curve and transpilation time, which makes it unsuitable for small or medium sized projects or for existing JavaScript projects; however, the availability of resources is increasingly helpful.
- TypeScript, with its type safety and predictability, is a great language to build modern web applications, and is the second most used language according to the StackOverflow developer's survey.
- JavaScript is
the best option
forsmall to medium-sized projects
due to itsquick prototyping and debugging
features and lack oftranspilation
, but the future of the language is still uncertain. - You cannot simply change the extension of a JavaScript program to
.ts
in order to make it run as TypeScript, as the two languages differ substantially in terms of syntax and features.