Skip to content

Commit a2e5aab

Browse files
captbaritoneradiosilenceclaude
authored
Make typescript a peerDependency (#228)
* chore: make typescript a peerDependency Co-authored-by: James Cleveland <james.cleveland@fresha.com> * Add TypeScript version matrix to CI * Fix pnpm workspace root flag for TypeScript install step * Only run TypeScript version matrix on test job The build job's "assert no files changed" step checks generated output against what's committed, which is version-specific. The TS matrix belongs only on the test (unit test) job. * 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> * Update generated llm-docs for changelog entry Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: James Cleveland <james.cleveland@fresha.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 56f2e75 commit a2e5aab

10 files changed

Lines changed: 30 additions & 12 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ jobs:
5656
strategy:
5757
matrix:
5858
node-version: *node-versions
59+
typescript-version:
60+
- "5.5.4"
61+
- "5.7.3"
62+
- "5.9.3"
63+
- "6.0.2"
5964
steps:
6065
- uses: actions/checkout@v3
6166
- uses: pnpm/action-setup@v2
@@ -68,6 +73,8 @@ jobs:
6873
cache: "pnpm"
6974
- name: Install dependencies
7075
run: pnpm install
76+
- name: Install TypeScript ${{ matrix.typescript-version }}
77+
run: pnpm add -wD typescript@${{ matrix.typescript-version }}
7178
- name: Build # Integration tests depend upon having .js versions created by tsc
7279
run: pnpm run build
7380
- name: Unit Tests

llm-docs/changelog.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](./docblock-tags/enums.md#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

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
"dependencies": {
2323
"commander": "^14.0.1",
2424
"graphql": "^16.11.0",
25-
"semver": "^7.7.2",
26-
"typescript": "5.9.2"
25+
"semver": "^7.7.2"
26+
},
27+
"peerDependencies": {
28+
"typescript": ">=5.5"
2729
},
2830
"devDependencies": {
2931
"@eslint/eslintrc": "^3.3.1",
@@ -39,7 +41,8 @@
3941
"path-browserify": "^1.0.1",
4042
"prettier": "^3.6.2",
4143
"process": "^0.11.10",
42-
"tsx": "^4.19.0"
44+
"tsx": "^4.19.0",
45+
"typescript": "5.9.2"
4346
},
4447
"prettier": {
4548
"trailingComma": "all"

pnpm-lock.yaml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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)