Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion ark/attest/__tests__/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion ark/fast-check/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
],
"scripts": {
"build": "ts ../repo/build.ts",
"test": "tsx ../repo/testPackage.ts"
"test": "node ../repo/testPackage.ts"
},
"dependencies": {
"arktype": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion ark/repo/mocha.package.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
21 changes: 10 additions & 11 deletions ark/repo/nodeOptions.js
Original file line number Diff line number Diff line change
@@ -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())
5 changes: 4 additions & 1 deletion ark/type/__tests__/realWorld.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -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
Expand All @@ -109,7 +107,7 @@
"arrowParens": "avoid"
},
"engines": {
"node": ">=18",
"node": ">=22.18.0",
"pnpm": ">=10"
},
"packageManager": "pnpm@10.19.0",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading