page =
url = https://www.typescriptlang.org
typescript: javascript with syntax for types.
TypeScript is a strongly typed programming language which builds on JavaScript giving you better tooling at any scale.
Editor Checks
Auto-complete
Interfaces
JSX
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 Deno and in your apps.
Safety at Scale
TypeScript understands JavaScript and uses type inference to give you great tooling without additional code.
Handbook Learn the language
Playground Try in your browser
Download Install TypeScript
Adopt TypeScript Gradually
Apply types to your JavaScript project incrementally, each step improves editor support and improves your codebase.
Lets take this this incorrect JavaScript code, and see how TypeScript can catch mistakes in your editor .
js
function compact ( arr ) {
if ( orr . length > 10 )
return arr . trim ( 0 , 10 )
return arr
No editor warnings in JavaScript files This code crashes at runtime!
JavaScript file
// @ts-check
Cannot find name 'orr'. 2304 Cannot find name 'orr'.
Adding this to a JS file shows errors in your editor
the param is arr, not orr!
JavaScript with TS Check
/** @param {any[]} arr */
if ( arr . length > 10 )
Property 'trim' does not exist on type 'any[]'. 2339 Property 'trim' does not exist on type 'any[]'.
Using JSDoc to give type information
Now TS has found a bad call. Arrays have slice, not trim.
JavaScript with JSDoc
function compact ( arr : string []) {
return arr . slice ( 0 , 10 )
TypeScript adds natural syntax for providing types
TypeScript file
Describe Your Data
Describe the shape of objects and functions in your code.
Making it possible to see documentation and issues in your editor .
interface Account {
id : number
displayName : string
version : 1
function welcome ( user : Account ) {
console . log ( user . id )
type Result = "pass" | "fail"
function verify ( result : Result ) {
if ( result === "pass" ) {
console . log ( "Passed" )
} else {
console . log ( "Failed" )
TypeScript becomes JavaScript via the delete key.
TypeScript file .
Types are removed .
function verify ( result ) {
JavaScript file .
TypeScript Testimonials
Loved by Developers
Voted 2nd most loved programming language in the Stack Overflow 2020 Developer survey
TypeScript was used by 78% of the 2020 State of JS respondents, with 93% saying they would use it again .
TypeScript was given the award for “Most Adopted Technology” based on year-on-year growth..