npm i typescript code example
Example 1: install typescript
npm install -g typescript
Example 2: npm typescript
npm install -g typescript
Example 3: npm typescript package
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"allowJs": true,
"strict": true,
"outDir": "./lib",
"esModuleInterop": true
},
"include": ["src"],
"exclude": ["node_modules"]
}
Example 4: npx run ts file
npx ts-node src/foo.ts
Example 5: npm typescript package
const demoMethod = () => {
return “I’m Duffer”;
}
module.exports = demoMethod;