Skip to content

Commit 1cf373a

Browse files
captbaritoneclaude
andcommitted
Add TypeScript 6.0 support and pin CI versions
- Remove deprecated `downlevelIteration`, add explicit `types: ["node"]` for TS 6's stricter type resolution - Fix catch clauses and implicit any for TS 6 compatibility - Add TS 6.0.2 to CI matrix and pin all TS versions to exact patches - Update changelog Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent eb49c0e commit 1cf373a

8 files changed

Lines changed: 16 additions & 11 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ jobs:
5757
matrix:
5858
node-version: *node-versions
5959
typescript-version:
60-
- "5.5"
61-
- "5.7"
62-
- "~5.9"
60+
- "5.5.4"
61+
- "5.7.3"
62+
- "5.9.3"
63+
- "6.0.2"
6364
steps:
6465
- uses: actions/checkout@v3
6566
- uses: pnpm/action-setup@v2

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"typescript": ">=5.5"
2929
},
3030
"devDependencies": {
31-
"typescript": "5.9.2",
3231
"@eslint/eslintrc": "^3.3.1",
3332
"@eslint/js": "^9.36.0",
3433
"@types/node": "^24.5.2",
@@ -42,7 +41,8 @@
4241
"path-browserify": "^1.0.1",
4342
"prettier": "^3.6.2",
4443
"process": "^0.11.10",
45-
"tsx": "^4.19.0"
44+
"tsx": "^4.19.0",
45+
"typescript": "5.9.2"
4646
},
4747
"prettier": {
4848
"trailingComma": "all"

src/Extractor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3046,7 +3046,7 @@ function graphQLNameValidationMessage(name: string): string | null {
30463046
try {
30473047
assertName(name);
30483048
return null;
3049-
} catch (e) {
3049+
} catch (e: any) {
30503050
return e.message;
30513051
}
30523052
}

src/tests/TestRunner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export default class TestRunner {
189189
async transform(code: string, filename: string): Promise<TransformerResult> {
190190
try {
191191
return await this._transformer(code, filename);
192-
} catch (e) {
192+
} catch (e: any) {
193193
console.error(e);
194194
return { kind: "ERROR", err: e.message };
195195
}

src/tests/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const testDirs: TestDir[] = [
126126
);
127127
}
128128
parsed = parsedResult.value;
129-
} catch (e) {
129+
} catch (e: any) {
130130
return err(e.message);
131131
}
132132
console.warn = consoleWarn;
@@ -191,7 +191,7 @@ const testDirs: TestDir[] = [
191191
);
192192
}
193193
parsedOptions = parsedOptionsResult.value;
194-
} catch (e) {
194+
} catch (e: any) {
195195
return err(e.message);
196196
}
197197

src/utils/visitor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function visitDefinitions(doc: DocumentNode, visitors: Visitor) {
5959
});
6060
}
6161

62-
const emptyArray = [];
62+
const emptyArray: never[] = [];
6363

6464
/**
6565
* Simplified, more performant, version of graphql-js's visit function that only

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
},
55
"compilerOptions": {
66
"skipLibCheck": true,
7+
"types": ["node"],
78
"lib": ["es2020"],
89
"experimentalDecorators": true,
910
"outDir": "dist",
10-
"downlevelIteration": true,
1111
"strictNullChecks": true,
1212
"declaration": true,
1313
"resolveJsonModule": true,

website/docs/07-changelog/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Changes in this section are not yet released. If you need access to these change
66

77
- **Features**
88
- Added support for deriving `@gqlEnum` from const arrays (`(typeof X)[number]`) and const objects (`(typeof X)[keyof typeof X]`). This allows defining enums with runtime-accessible values without using TypeScript's `enum` syntax. The const declaration must immediately precede the type alias. See [enum docs](../04-docblock-tags/07-enums.mdx#runtime-accessible-enums) for details.
9+
- **Improvements**
10+
- `typescript` is now a peer dependency (`>=5.5`) instead of a direct dependency, allowing you to use your own TypeScript version. ([PR](https://github.com/captbaritone/grats/pull/228))
11+
- Added support for TypeScript 6.0. ([PR](https://github.com/captbaritone/grats/pull/228))
12+
- CI now tests against TypeScript 5.5, 5.7, 5.9, and 6.0.
913

1014
## 0.0.36
1115

0 commit comments

Comments
 (0)