# Node Runs Your TypeScript. It Does Not Check It.

> Node 26.8.1 runs a .ts file with no flag and no complaint about a string assigned to a number. Here is the boundary — what erases, what throws, and what tsc still owes you.

- Published: 2026-11-08
- Tags: nodejs, typescript, ecosystem
- Source: https://jsledger.com/blog/running-typescript-with-no-build-step/
- Language: en-US
- Author: Jonah Vail

---
A file with a type error in it, run on Node 26.8.1 with no flags:

```ts
// wrongtype.ts
const n: number = "definitely not a number";
console.log(n);
```

```
$ node wrongtype.ts
definitely not a number
```

No warning, no exit code, no mention of the annotation. `tsc --noEmit` on the
same file reports `error TS2322: Type 'string' is not assignable to type
'number'`, which is the first thing to understand about running TypeScript
without a build step: **Node is not running TypeScript. It is running the
JavaScript left over after the types are deleted.**

## What erases

The erasable list is longer than teams expect, which is why the feature is
usable at all. Every one of these runs unmodified on Node 26.8.1:

```ts
interface Person { name: string; age?: number }
type Id<T> = T;
function greet(p: Person): string { return `Hello, ${p.name}` }
const x = greet({ name: 'Jonah' }) as string satisfies string;

function assertIsString(v: unknown): asserts v is string { /* … */ }
function f(x: string): string;          // overload signatures
function f(x: number): number;
abstract class A { abstract go(): void }
import type { Person as P } from './types.ts';
namespace N { export type T = number }  // types only — erases
```

Generics, `as`, `satisfies`, assertion signatures, overload lists, `abstract`,
`import type`, and even a namespace, as long as it contains nothing but types.
The rule the list obeys is mechanical: if deleting the syntax leaves a valid
program with the same runtime behavior, Node deletes it.

## What throws, and what it says

Four constructs do not survive deletion, because each of them exists at runtime:

```
$ node enum.ts
SyntaxError [ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX]: TypeScript enum is not supported in strip-only mode

$ node constenum.ts
SyntaxError [ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX]: TypeScript enum is not supported in strip-only mode

$ node paramprop.ts
SyntaxError [ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX]: TypeScript parameter property is not supported in strip-only mode

$ node namespaceval.ts
SyntaxError [ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX]: TypeScript namespace declaration is not supported in strip-only mode
```

An `enum` is an object built at startup. A parameter property is an assignment
the constructor has to perform. A namespace with a `const` in it is an IIFE. None
of them can be produced by removing characters, and Node's stripper only removes
characters. Note that `const enum` reports the same message as `enum` — the
compile-time-inlining variant is refused along with the other one.

Decorators fail differently, and the difference matters when you are reading a
CI log:

```
$ node decorator.ts
class S { @log method() {} }
          ^
SyntaxError: Invalid or unexpected token
```

That is the JavaScript parser giving up, not the TypeScript path reporting an
unsupported construct. There is no `ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX`, no
mention of TypeScript, and nothing to grep for.

## The escape hatch is gone

Everything above describes *strip-only mode*, and until recently that was a
choice. Node had a second mode that actually transformed these constructs into
JavaScript. On the current LTS line it still does:

```
$ node --version && node --experimental-transform-types enum.ts
v24.20.0
2
(node:50803) ExperimentalWarning: Transform Types is an experimental feature and might change at any time
```

On Node 26 the same command is not a warning, it is a refusal:

```
$ node --experimental-transform-types enum.ts
node: bad option: --experimental-transform-types
```

The flag was removed in [nodejs/node#61803](https://github.com/nodejs/node/pull/61803),
merged 2026-02-27, with the follow-up cleanup in #62058. `--experimental-strip-types`
is still accepted and does nothing, because stripping is on by default now. So a
team upgrading from 24 to 26 does not gain a choice about enums — it loses the
one it had, and the failure arrives as `bad option` in a startup script rather
than as a type error in review.

## Your dependencies are not covered

The boundary is not only syntactic. Publish a package whose entry point is a
`.ts` file and a consumer on Node 26 gets this:

```
$ node usedep.mjs
Error [ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING]: Stripping types is
currently unsupported for files under node_modules, for
"file:///…/node_modules/pkg/index.ts"
```

Deleting a build step is a decision about your own repository. It is not a
publishing format, and it is not a way to skip compiling before `npm publish`.
That is a different question from whether to ship one artifact or two, which is
[what `require(esm)` changed](/blog/require-esm-is-stable/).

## `tsc` does not leave, it moves

Two flags make the arrangement work, and they belong in different places.

In `tsconfig.json`, `erasableSyntaxOnly` makes the compiler refuse exactly what
Node refuses, so the boundary is enforced at review time:

```
$ tsc --noEmit --erasableSyntaxOnly enum.ts paramprop.ts namespaceval.ts   # typescript 7.0.2
enum.ts(1,6): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
namespaceval.ts(1,11): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
paramprop.ts(1,23): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
```

Three files, three errors, the same three constructs the runtime rejects. That is
the one setting that turns "it crashed at startup" into "the build failed".

And `tsc --noEmit` stays in CI, because nothing else is going to notice that a
string was assigned to a number, or that a
[narrowed value widened again](/blog/type-level-narrowing-in-typescript/) two
branches later. The pipeline does not lose a step; the step stops producing
output and starts producing verdicts.

## Replacing the construct that actually blocks you

In practice the list narrows to one item. Decorators are rare outside frameworks
that own the whole file, parameter properties are a shorthand with an obvious
longhand, and value namespaces are mostly historical. Enums are everywhere, and
the replacement fits in three lines:

```ts
const Level = { Low: 1, High: 2 } as const;
type Level = (typeof Level)[keyof typeof Level];
const l: Level = Level.High;
```

```
$ node asconst.ts
as const replacement -> 2 Low,High
```

The object and the type share a name, which is the part that makes it a drop-in:
`Level.High` still reads as a value and `Level` still reads as a type. What you
lose is the reverse mapping — `Level[2]` is not `"High"` any more — and the
declaration merging that lets an enum be extended across files.

There is also an off switch, which is worth knowing exists even if you never
reach for it. `--no-experimental-strip-types` turns the feature off entirely, and
the first annotation in the file becomes a plain syntax error:

```
$ node --no-experimental-strip-types ok.ts
interface Person { name: string; age?: number }
          ^^^^^^
```

Module format needs no decision. A `.ts` file containing `import` runs the same
way with or without `"type": "module"` in `package.json`; Node detects the
syntax.

## What to decide

Turn on `erasableSyntaxOnly` first, on the existing build, and see what breaks.
If the answer is a handful of enums, the three lines above are the whole
migration. If the answer is decorators, the no-build-step route is closed for
now, and the error you will get is not a helpful one.

What I did not test: source maps and stack-trace fidelity for stripped files,
which is the thing that decides whether this is usable in production rather than
in scripts; and `--experimental-strip-types` behavior on the 25.x line, which is
already out of support. Everything above ran on Node 26.8.1 and, where noted,
Node 24.20.0, with TypeScript 7.0.2 for the compiler side.
