diff --git a/.vscode/settings.json b/.vscode/settings.json index 8823d9ef0b..3d6eca3019 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -28,7 +28,7 @@ "typescript.tsserver.experimental.enableProjectDiagnostics": true, "typescript.tsdk": "./node_modules/typescript/lib", // IF YOU UPDATE THE MOCHA CONFIG HERE, PLEASE ALSO UPDATE package.json/mocha AND ark/repo/mocha.jsonc - "mochaExplorer.nodeArgv": ["--conditions", "ark-ts", "--import", "tsx"], + "mochaExplorer.nodeArgv": ["--conditions", "ark-ts"], // ignore attest since it requires type information "mochaExplorer.ignore": ["ark/attest/**/*"], "mochaExplorer.require": "ark/repo/mocha.globalSetup.ts", diff --git a/ark/attest/__tests__/utils.ts b/ark/attest/__tests__/utils.ts index 5daf26e8ef..703d74d732 100644 --- a/ark/attest/__tests__/utils.ts +++ b/ark/attest/__tests__/utils.ts @@ -7,7 +7,7 @@ export const runThenGetContents = (templatePath: string): string => { const tempPath = templatePath + ".temp.ts" copyFileSync(templatePath, tempPath) try { - shell(`node --import=tsx ${tempPath}`, { + shell(`node ${tempPath}`, { cwd: dirName(), env: { ATTEST_failOnMissingSnapshots: "0" diff --git a/ark/fast-check/package.json b/ark/fast-check/package.json index dd844bbaf2..acd8e7d649 100644 --- a/ark/fast-check/package.json +++ b/ark/fast-check/package.json @@ -34,7 +34,7 @@ ], "scripts": { "build": "ts ../repo/build.ts", - "test": "tsx ../repo/testPackage.ts" + "test": "node ../repo/testPackage.ts" }, "dependencies": { "arktype": "workspace:*", diff --git a/ark/repo/mocha.package.jsonc b/ark/repo/mocha.package.jsonc index dfde0ace2a..3c5e01c1e6 100644 --- a/ark/repo/mocha.package.jsonc +++ b/ark/repo/mocha.package.jsonc @@ -8,6 +8,6 @@ { "spec": ["__tests__/*.test.*"], "ignore": "node_modules/**/*", - "node-option": ["conditions=ark-ts", "import=tsx"], + "node-option": ["conditions=ark-ts"], "require": "../repo/mocha.globalSetup.ts" } diff --git a/ark/repo/nodeOptions.js b/ark/repo/nodeOptions.js index c629a0fdba..9cc86532f5 100644 --- a/ark/repo/nodeOptions.js +++ b/ark/repo/nodeOptions.js @@ -1,16 +1,15 @@ // @ts-check -const [major, minor] = process.version.replace("v", "").split(".").map(Number) +// Every Node version we support (see `engines.node`) strips TypeScript types +// natively by default — no flag required. This repo also contains no syntax +// that needs type *transformation* (no runtime enums, parameter properties, or +// value-bearing namespaces — only erasable `declare`/type-level forms), so +// stripping alone is sufficient and we pass no TS-related flags. Notably this +// avoids `--experimental-transform-types`, which Node >= 26 rejects in +// NODE_OPTIONS. -const versionedFlags = - major > 22 || (major === 22 && minor >= 7) ? - "--experimental-transform-types --no-warnings" - : (console.log( - "--experimental-transform-types requires Node >= 22.7.0, falling back to tsx..." - ), - "--import tsx") - -export const nodeDevOptions = `${process.env.NODE_OPTIONS ?? ""} --conditions ark-ts ${versionedFlags}` +export const nodeDevOptions = + `${process.env.NODE_OPTIONS ?? ""} --conditions ark-ts`.trimEnd() export const addNodeDevOptions = extraOpts => - (process.env.NODE_OPTIONS = `${nodeDevOptions} ${extraOpts ?? ""}`) + (process.env.NODE_OPTIONS = `${nodeDevOptions} ${extraOpts ?? ""}`.trimEnd()) diff --git a/ark/type/__tests__/realWorld.test.ts b/ark/type/__tests__/realWorld.test.ts index 33539ddc9c..acdd6d08c2 100644 --- a/ark/type/__tests__/realWorld.test.ts +++ b/ark/type/__tests__/realWorld.test.ts @@ -1302,10 +1302,13 @@ Right: { x: number, y: number, + (undeclared): delete }`) it("described input of morph", () => { class ValidatedUserID { + readonly data: string static fromString(value: string): ValidatedUserID { return new ValidatedUserID(value) } - private constructor(readonly data: string) {} + private constructor(data: string) { + this.data = data + } } const UserID = type("string") diff --git a/package.json b/package.json index 8d618bf1db..58130e7c76 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,6 @@ "mocha": "11.7.4", "prettier": "3.6.2", "tsup": "8.5.0", - "tsx": "4.20.6", "typescript": "catalog:", "typescript-eslint": "8.46.1" }, @@ -85,8 +84,7 @@ ], "ignore": "**/node_modules/**/*", "node-option": [ - "conditions=ark-ts", - "import=tsx" + "conditions=ark-ts" ], "require": "./ark/repo/mocha.globalSetup.ts", "timeout": 10000 @@ -109,7 +107,7 @@ "arrowParens": "avoid" }, "engines": { - "node": ">=18", + "node": ">=22.18.0", "pnpm": ">=10" }, "packageManager": "pnpm@10.19.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9cab8f6e63..5d4b898043 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -89,9 +89,6 @@ importers: tsup: specifier: 8.5.0 version: 8.5.0(jiti@2.6.1)(postcss@8.5.6)(tsx@4.20.6)(typescript@5.9.3) - tsx: - specifier: 4.20.6 - version: 4.20.6 typescript: specifier: 'catalog:' version: 5.9.3 @@ -8263,6 +8260,7 @@ snapshots: get-tsconfig@4.12.0: dependencies: resolve-pkg-maps: 1.0.0 + optional: true github-from-package@0.0.0: optional: true @@ -10099,7 +10097,8 @@ snapshots: resolve-from@5.0.0: {} - resolve-pkg-maps@1.0.0: {} + resolve-pkg-maps@1.0.0: + optional: true resolve@1.22.10: dependencies: @@ -10668,6 +10667,7 @@ snapshots: get-tsconfig: 4.12.0 optionalDependencies: fsevents: 2.3.3 + optional: true tunnel-agent@0.6.0: dependencies: