Node.js to TypeScript Converter
Migrate a Node.js backend — Express, Koa, Fastify, NestJS controllers, or plain HTTP servers —
from JavaScript to TypeScript in one pass. JavaScriptConverter rewrites
require() calls, infers parameter types for route handlers and
middleware, and emits a tsconfig.json tuned for Node so the
project compiles immediately.
What changes when you move a Node.js project to TypeScript?
A working Node.js TypeScript project needs four things at once: ES Modules (or correctly typed
CommonJS), explicit types on every exported function, a tsconfig.json
with the right module resolution, and matching @types/* packages
for your dependencies. Skip any one and the build fails.
JavaScriptConverter handles the first three deterministically. It reads each file as an AST, rewrites it to TypeScript, and reports the exact transforms it applied so you can audit the diff before merging.
Common Node.js patterns this tool rewrites
Express route handler with inferred types
const express = require('express');
const app = express();
app.get('/users/:id', (req, res) => {
res.json({ id: req.params.id });
});
import express, { Request, Response } from 'express';
const app = express();
app.get('/users/:id', (req: Request, res: Response) => {
res.json({ id: req.params.id });
});
Express middleware signature
function requireAuth(req, res, next) {
if (!req.headers.authorization) return res.sendStatus(401);
next();
}
module.exports = requireAuth;
import { Request, Response, NextFunction } from 'express';
export default function requireAuth(req: Request, res: Response, next: NextFunction) {
if (!req.headers.authorization) return res.sendStatus(401);
next();
}
Async fs handler
const { readFile } = require('fs/promises');
async function loadConfig(path) {
const raw = await readFile(path, 'utf8');
return JSON.parse(raw);
}
module.exports = { loadConfig };
import { readFile } from 'fs/promises';
export async function loadConfig(path: string): Promise<unknown> {
const raw = await readFile(path, 'utf8');
return JSON.parse(raw);
}
tsconfig.json tuned for Node
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"outDir": "dist"
},
"include": ["src/**/*"]
}
@types packages you'll likely need
JavaScriptConverter rewrites the source. The remaining step is installing the matching ambient type packages so the compiler knows the shape of each library. For a typical Express + Node 22 project that's:
npm install --save-dev typescript @types/node @types/express
Add @types/koa, @types/jest,
or framework-specific packages as you need them.
Related framework migrations
Convert your Node.js project now
Upload a ZIP of your src/ folder or paste a single file — get TypeScript back with a Node-ready tsconfig in seconds.