Node.js
-
Follow the steps in Setting up a new TypeScript project
-
Rename *.js files to *.ts
-
Fix all TypeScript warnings
You should see the warnings when you open up the TypeScript files if you’re using vscode. Otherwise, you can run:
npx tsc
-
If you’re getting TypeScript warnings for a package that has types and you’re using
require
, try usingimport
instead. e.g.From:
const { config, createLogger, format, transports } = require('winston');
To:
import { config, createLogger, format, transports } from 'winston';
-