What is TypeScript?
Writing TypeScript code means writing JavaScript code(ES6, ES7,etc.,) .Sometimes TypeScript is referred as a superset of JavaScript.
Want a TS playground? Here is the official one: https://www.typescriptlang.org/play/
TypeScript = JavaScript + 'A type system'
The TypeScript type system has the following features:
- Help us catch errors during development(during compile time, instead of runtime). We get errors inside code editor, similar to eslint.
- Uses type annotations to analyze our code. Type annotations are some additional info attached to our code.
- Only active during development, when we inject our code into html pages we compile TypeScript into JavaScript and then inject only the JavaScript code which is understood by browser.
- It doesn't provide any performance optimizations.
Process of writing and compiling
We write TypeScript code(JS with type annotations), then compile it using the TypeScript compiler. We get plain JavaScript code as output from TypeScript compiler.
TypeScript just act as a helper during development. It doesn't have any effect or performance optimization in the resultant JavaScript code.
Last Updated on
Comments