Phil Nash
              Developer Advocate for Sonar
            
Introducing the demo application
Step 1
Recommendation
Step 2
npm install -D typescriptnpx tsc --init{
  "target": "es2016",
  "module": "commonjs",
  "strict": true,
  "esModuleInterop": true,
  "skipLibCheck": true,
  "forceConsistentCasingInFileNames": true
}  {
-   "target": "es2016",
+   "target": "esnext",
    "module": "commonjs",
-   "strict": true,
+   "strict": false,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
+   "allowJS": true,
+   "checkJS": false,
+   "outDir": "./dist",
+   "rootDir": "./src"
  }  {
-   "main": "./src/cli.js",
+   "main": "./dist/cli.js",
    "scripts": {
+     "build": "tsc",
+     "watch": "tsc --watch"
    },
  }Step 3
  {
    "target": "esnext",
    "module": "commonjs",
    "strict": false,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "allowJS": true,
-   "checkJS": false,
+   "checkJS": true,
    "outDir": "./dist",
    "rootDir": "./src"
  }  {
    "compilerOptions": {
+//   "outDir": "./dist",
+     "noEmit": true,
      ...
    }
  }TypeScript without writing TypeScript
/**
 * @type string
 */
let searchTerm;
          /**
 * @param {number} a
 * @param {number} b
 * @returns {number}
 */
function add(a, b) {
  return a + b;
}Step 4
Change .js to .ts
            Change from require to import
          
Add types
Enable strict flags
Step 1
Step 2
Step 3
Step 4
              The demo repo
https://github.com/philnash/dad-jokes-cli
            
              Move your project to TypeScript at your own pace
Dominik
              Kundel —
              https://www.twilio.com/blog/move-to-typescript
            
              TypeScript without TypeScript — JSDoc Superpowers
Stefan
              Baumgartner —
              https://fettblog.eu/typescript-jsdoc-superpowers/
            
              JS Projects Utilizing TypeScript
TypeScript docs —
              https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html