configure babel for typescript code example

Example 1: @babel/preset-typescript

npm install --save-dev @babel/preset-typescript

Example 2: typescript with babel

npm install --save-dev typescript @babel/core @babel/cli @babel/plugin-proposal-class-properties @babel/preset-env @babel/preset-typescript

Example 3: babel typescript

"compilerOptions": {  // Ensure that .d.ts files are created by tsc, but not .js files  "declaration": true,  "emitDeclarationOnly": true,  // Ensure that Babel can safely transpile files in the TypeScript project  "isolatedModules": true}