TypeScript
Overview
Typescript is a subset of javascript with extended typing, it can be compiled to pure javascript with tsc compiler
Get Started
create tsconfig.json
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"baseUrl": "src",
},
"include": [
"**/*.ts",
"**/*.tsx"
]
}
Install typescript library
yarn add typescript
Compile typescript file into javascript file
tsc hello.ts
Execute typescript file directly
ts-node hello.ts
Last updated
Was this helpful?