Skip to content

bug: scripts/node-ts.js uses --strip-types on Node 23+ but Node 24 rejects it #980

@carlos-alm

Description

@carlos-alm

Found during dogfooding v3.9.4

Severity: High
Command: npm run build:wasm, npm run deps:tree, npm run version

scripts/node-ts.js selects between --strip-types and --experimental-strip-types based on the Node major version:

// scripts/node-ts.js:9
const flag = major >= 23 ? "--strip-types" : "--experimental-strip-types";

On Node 24 (currently 24.10.0), --strip-types is not a recognized flag. The only accepted flag is still --experimental-strip-types (TypeScript stripping is unflagged by default, and the --no-experimental-strip-types flag exists to disable it). Any npm script that routes through node-ts.js fails immediately with:

node: bad option: --strip-types

Reproduction

node --version     # v24.10.0
npm run build:wasm # fails with "bad option: --strip-types"

or directly:

node --strip-types -e "const x: number = 1; console.log(x);"
# node: bad option: --strip-types
node --experimental-strip-types -e "const x: number = 1; console.log(x);"
# 1

Expected behavior

Scripts like build:wasm, deps:tree, version should run on any supported Node version (>= 22.6 per engines.node).

Actual behavior

They error out immediately on Node 24.x.

Suggested fix

Use --experimental-strip-types on every supported Node version. It works on 22.x, was accepted on 23.x, and still works on 24.x. Delete the version gate entirely:

const flag = "--experimental-strip-types";

Alternatively, on Node 24 TypeScript stripping is default-on, so the flag can be omitted entirely on 24+. But the simplest change is to just use --experimental-strip-types everywhere.

Workaround

npm run benchmark works because package.json hardcodes --experimental-strip-types directly, bypassing node-ts.js.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions