A lot changed in the TypeScript world during 2026. TypeScript 6.0, released in March, changed several long-standing compiler defaults and deprecated old options. TypeScript 7.0, released in July, is a native port of the compiler written in Go. And Node.js now runs .ts files directly, with type stripping marked stable since v25.2.0 and v24.12.0.

If your tsconfig.json was copied from a project a few years ago, it probably still works, but it may be carrying options that are now deprecated and missing the ones that make modern tooling happy. This article is for developers starting a new project or tidying an old one. We will build a baseline config one option at a time, explain why each option is there, and cover what to change for a bundled front end.

The baseline

#

Here is a config for a Node.js project that runs TypeScript files directly and uses the compiler only for type checking.


_15
{
_15
"compilerOptions": {
_15
"target": "esnext",
_15
"module": "nodenext",
_15
"strict": true,
_15
"noUncheckedIndexedAccess": true,
_15
"verbatimModuleSyntax": true,
_15
"erasableSyntaxOnly": true,
_15
"rewriteRelativeImportExtensions": true,
_15
"noEmit": true,
_15
"types": ["node"],
_15
"skipLibCheck": true
_15
},
_15
"include": ["src"]
_15
}

The middle section matches what the Node.js documentation recommends for type stripping. The rest are choices we will explain as we go.

strict

#

strict turns on a family of checks, including strictNullChecks, noImplicitAny, strictFunctionTypes, strictPropertyInitialization and useUnknownInCatchVariables. These are the checks that catch the bugs people actually ship: reading a property of something that might be undefined, or passing a value whose type was never stated.

Since TypeScript 6.0, strict is true by default. It is still worth writing it out. It documents intent for anyone reading the file, and it keeps the behaviour the same if an older TypeScript version or a tool with its own bundled compiler reads the config.

If you are migrating an old project that relied on the lenient default, 6.0 is the release where you must add "strict": false to keep the old behaviour. Treat that as a temporary step, not a destination.

Checks beyond strict

#

noUncheckedIndexedAccess is not part of strict, but it closes a gap that strict leaves open. Without it, reading from an array or a record by index is assumed to always succeed.


_10
const scores: Record<string, number> = { ada: 10 };
_10
_10
const grace = scores["grace"];
_10
// without the option: number
_10
// with the option: number | undefined

With the option on, you are forced to handle the missing case, which is exactly where runtime errors come from. It adds some friction in loops over arrays, where for...of or .at() with a check tends to read more cleanly than index access anyway.

exactOptionalPropertyTypes is another stricter option worth knowing about. It makes an optional property mean "may be missing" rather than "may be missing or set to undefined". It is valuable in libraries, but it can be noisy in application code, so it is not in the baseline.

verbatimModuleSyntax

#

Added in TypeScript 5.0, verbatimModuleSyntax makes the rule for imports very simple: anything imported without the type modifier stays in the output, and anything with the type modifier is removed.


_10
import { readFile } from "node:fs/promises"; // kept
_10
import type { User } from "./types.ts"; // removed
_10
import { type Post, savePost } from "./posts.ts"; // Post removed, savePost kept

If you import a type without marking it, you get an error along the lines of: 'User' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.

This matters because tools that strip types file by file, such as esbuild, SWC and Node itself, cannot look at other files to work out whether an import is a type. With this option, the answer is always visible in the import statement, so every tool produces the same output. It replaces the older importsNotUsedAsValues and preserveValueImports options.

Your editor can fix these for you. Most TypeScript-aware editors offer a quick fix to convert an import to a type-only import, and ESLint has rules that do the same automatically.

erasableSyntaxOnly

#

Added in TypeScript 5.8, erasableSyntaxOnly reports an error when you use TypeScript syntax that generates runtime code. Erasable syntax is anything that can be deleted, leaving valid JavaScript behind: type annotations, interfaces, satisfies, generics. Non-erasable syntax has to be transformed into something new.

The main features it flags are:

  • enum declarations
  • namespace blocks that contain runtime code
  • parameter properties in class constructors
  • import x = require(...) style aliases

Each has a plain JavaScript replacement.


_17
// Instead of an enum
_17
export const Status = {
_17
Draft: "draft",
_17
Published: "published",
_17
} as const;
_17
_17
export type Status = (typeof Status)[keyof typeof Status];
_17
// "draft" | "published"
_17
_17
// Instead of parameter properties
_17
class Repo {
_17
private readonly db: Database;
_17
_17
constructor(db: Database) {
_17
this.db = db;
_17
}
_17
}

The const object gives you the same Status.Draft syntax at use sites, and the derived type gives you the union for annotations.

The reason to turn this on is that Node's type stripping only handles erasable syntax. With this option, the compiler tells you about problems before Node does.

Running TypeScript directly in Node

#

Node has been able to strip types for a while. Type stripping was enabled by default in v23.6.0 and v22.18.0, stopped printing an experimental warning in v24.3.0, and was marked stable in v25.2.0 and v24.12.0. In Node 26, the --experimental-transform-types flag that handled non-erasable syntax was removed, so erasable syntax is the supported path.

That means this works with no build step and no extra packages:


_10
node src/server.ts

There are a few rules to know:

  • Node does not type check. It deletes types and runs what is left. You still need tsc for checking, usually in CI and in your editor.
  • File extensions are required. Write import { db } from "./db.ts", not "./db". The rewriteRelativeImportExtensions option, added in TypeScript 5.7, allows .ts in imports and rewrites them to .js if you ever do emit JavaScript.
  • Node ignores tsconfig.json. Anything that depends on it, such as paths aliases or downlevelling newer syntax, is not supported. Use imports in package.json for aliases instead.
  • No TypeScript inside node_modules. Node deliberately refuses to strip types in dependencies, so packages you publish should still ship JavaScript.
  • No .tsx and no decorators. For those you still need a transpiler or a bundler.

A typical set of scripts looks like this:


_10
{
_10
"type": "module",
_10
"scripts": {
_10
"dev": "node --watch src/server.ts",
_10
"start": "node src/server.ts",
_10
"typecheck": "tsc --noEmit"
_10
}
_10
}

The noEmit option in the baseline reflects this setup. If you do want to compile to JavaScript, for example to publish a package, remove noEmit, set outDir, and set rootDir explicitly (see below).

module and moduleResolution

#

For code that runs in Node, use "module": "nodenext". It models how Node really resolves modules, including the difference between ES modules and CommonJS based on file extensions and the type field in package.json. Setting module to nodenext also implies the matching moduleResolution, so you do not need both.

For code that goes through a bundler such as Vite, webpack or the Next.js compiler, use "module": "esnext" with "moduleResolution": "bundler". That mode allows extensionless imports, because the bundler resolves them.

TypeScript 6.0 deprecated "moduleResolution": "node" (also called node10) and baseUrl, and dropped support for the amd, umd and systemjs module formats. TypeScript 7.0 turns everything deprecated in 6.0 into hard errors. If your config contains these, replace them now.

types, rootDir and other new defaults

#

TypeScript 6.0 changed a handful of defaults that can surprise you on upgrade:

  • types now defaults to an empty array, so packages under @types are no longer loaded automatically. Add the ones you need, such as "types": ["node"].
  • rootDir now defaults to the folder containing tsconfig.json. If that is your project root and you emit to dist, you can end up with dist/src/index.js. Set "rootDir": "src" when emitting.
  • module defaults to esnext, and target defaults to the current year's ECMAScript version.
  • noUncheckedSideEffectImports is now on by default, so an import like import "./styles.css" must resolve to a real file or a declared module.

A variant for bundled front ends

#

For a React app built with Vite or Next.js, the bundler handles modules and JSX, and the compiler only checks.


_14
{
_14
"compilerOptions": {
_14
"target": "esnext",
_14
"module": "esnext",
_14
"moduleResolution": "bundler",
_14
"jsx": "react-jsx",
_14
"strict": true,
_14
"noUncheckedIndexedAccess": true,
_14
"verbatimModuleSyntax": true,
_14
"noEmit": true,
_14
"skipLibCheck": true
_14
},
_14
"include": ["src"]
_14
}

erasableSyntaxOnly is optional here, because the bundler can transform enums. Many teams turn it on anyway so their code stays portable between tools. Frameworks often generate their own config with extra options, so start from theirs and add the strictness options on top.

TypeScript 7 and the native compiler

#

TypeScript 7.0 is a port of the compiler to Go. You still install it with npm install -D typescript and run it as tsc. Microsoft reports full builds that are typically between 8 and 12 times faster, and much quicker editor start-up on large projects.

Two things to plan for:

  • Deprecated options are errors. Anything 6.0 warned about now fails. The smoothest upgrade path is to get your project clean on 6.0, with no deprecation warnings and no ignoreDeprecations setting, then move to 7.0.
  • There is no programmatic API in 7.0. Tools that drive the compiler from JavaScript, such as some lint and build plugins, need to keep using the 6.0 API for now. Microsoft publishes @typescript/typescript6 for that purpose and plans a new API for a later release.

The tsconfig in this article works unchanged on both 6.0 and 7.0.

Version support

#
Option or featureMinimum version
verbatimModuleSyntaxTypeScript 5.0
moduleResolution: bundlerTypeScript 5.0
rewriteRelativeImportExtensionsTypeScript 5.7
erasableSyntaxOnlyTypeScript 5.8
strict on by defaultTypeScript 6.0
Type stripping on by defaultNode 23.6.0 and 22.18.0
Type stripping stableNode 25.2.0 and 24.12.0

Node 20 reached end of life in April 2026, so for new work target Node 24 or Node 26, both LTS lines.

When not to use it

#
  • Projects that depend on decorators or enums. Frameworks such as Angular and NestJS rely on decorators, and some codebases use enums heavily. Skip erasableSyntaxOnly and keep a transpiler in the loop.
  • Libraries you publish. Run TypeScript directly in development if you like, but compile to JavaScript with declaration files for the published package. Node will not strip types inside node_modules.
  • Code that relies on paths aliases at runtime. Node ignores tsconfig.json, so either move aliases to package.json imports or keep a bundler.
  • Old runtimes. If you must support a Node version without stable type stripping, use a tool such as tsx or compile ahead of time.

Wrapping up

#
  • Write strict explicitly, and add noUncheckedIndexedAccess to cover index access.
  • verbatimModuleSyntax makes type-only imports explicit so every tool produces the same output.
  • erasableSyntaxOnly keeps your code to syntax that Node and other type strippers can handle.
  • Node runs .ts files directly, but it does not type check, so keep tsc --noEmit in CI.
  • Clean up everything TypeScript 6.0 deprecates before you move to 7.0, where those options are errors.
file under:
Typescript

Was this article helpful?

About the author

Danny Engineering

A software engineer with a strong belief in human-centric design and driven by a deep empathy for users. Combining the latest technology with human values to build a better, more connected world.