0% found this document useful (0 votes)
2 views

Why TypeScript with JavaScript

TypeScript is a static type checker for JavaScript that helps catch type errors before code execution. It enhances JavaScript with additional syntax for better editor integration and type inference, allowing for gradual adoption in existing projects. TypeScript code compiles to standard JavaScript, ensuring compatibility across various environments.

Uploaded by

gayathri Jayalal
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Why TypeScript with JavaScript

TypeScript is a static type checker for JavaScript that helps catch type errors before code execution. It enhances JavaScript with additional syntax for better editor integration and type inference, allowing for gradual adoption in existing projects. TypeScript code compiles to standard JavaScript, ensuring compatibility across various environments.

Uploaded by

gayathri Jayalal
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Why TypeScript with JavaScript?

The most common kinds of errors that programmers write can be described as type
errors: a certain kind of value was used where a different kind of value
was expected. This could be due to simple typos, a failure to understand the
API surface of a library, incorrect assumptions about runtime behavior, or
other errors. The goal of TypeScript is to be a static type checker for
JavaScript programs - in other words, a tool that runs before your code runs
(static) and ensures that the types of the program are correct (type
checked).

What is TypeScript?

https://www.typescriptlang.org/
 TypeScript is a “flavor” or “variant” of JavaScript.
 TypeScript adds additional syntax to JavaScript to support
a tighter integration with your editor. Catch errors
early in your editor.
 TypeScript code converts to JavaScript, which runs
anywhere JavaScript runs: In a browser, on Node.js or
in your apps.
 TypeScript understands JavaScript and uses type
inference to give you great tooling without additional
code.

Adopt TypeScript Gradually


 Apply types to your JavaScript project incrementally, each step
improves editor support and improves your codebase.
 Let's take this incorrect JavaScript code, and see how TypeScript can
catch mistakes in your editor.
Describe Your Data

 Describe the shape of objects and functions in your code.

 Making it possible to see documentation and issues in your editor.

TypeScript becomes JavaScript via the delete


key.

You might also like