🚀 Understanding TypeScript and JavaScript Relationship
This is the summarization of reading Effective Typescript book.
Summary
TypeScript as a Syntactic Superset of JavaScript
However, TypeScript can still parse and convert valid JavaScript code into TypeScript.
Recommended by LinkedIn
Propositional Relationship Between JS and TS
The Utility of the TypeScript Compiler
The TypeScript compiler is useful not only for TypeScript but also for JavaScript programs. For example, TypeScript's type checker can identify issues even in JavaScript code without explicit type annotations.
Detecting Potential Runtime Errors
TypeScript's static type system helps in identifying code that could lead to runtime errors.
Conclusion
TypeScript's type system models JavaScript's behaviour closely, but there are differences, such as TypeScript's handling of function parameter counts, which JavaScript allows more flexibility with. The choice between the strictness of TypeScript and the flexibility of JavaScript often comes down to personal or project-specific preferences.