diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 02da9d0b..17cfa401 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -56,6 +56,11 @@ jobs: strategy: matrix: node-version: *node-versions + typescript-version: + - "5.5.4" + - "5.7.3" + - "5.9.3" + - "6.0.2" steps: - uses: actions/checkout@v3 - uses: pnpm/action-setup@v2 @@ -68,6 +73,8 @@ jobs: cache: "pnpm" - name: Install dependencies run: pnpm install + - name: Install TypeScript ${{ matrix.typescript-version }} + run: pnpm add -wD typescript@${{ matrix.typescript-version }} - name: Build # Integration tests depend upon having .js versions created by tsc run: pnpm run build - name: Unit Tests diff --git a/llm-docs/changelog.md b/llm-docs/changelog.md index 2884f743..393558ab 100644 --- a/llm-docs/changelog.md +++ b/llm-docs/changelog.md @@ -6,6 +6,10 @@ Changes in this section are not yet released. If you need access to these change - **Features** - 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. +- **Improvements** + - `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)) + - Added support for TypeScript 6.0. ([PR](https://github.com/captbaritone/grats/pull/228)) + - CI now tests against TypeScript 5.5, 5.7, 5.9, and 6.0. ## 0.0.36 diff --git a/package.json b/package.json index 6810eaf1..0808b855 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,10 @@ "dependencies": { "commander": "^14.0.1", "graphql": "^16.11.0", - "semver": "^7.7.2", - "typescript": "5.9.2" + "semver": "^7.7.2" + }, + "peerDependencies": { + "typescript": ">=5.5" }, "devDependencies": { "@eslint/eslintrc": "^3.3.1", @@ -39,7 +41,8 @@ "path-browserify": "^1.0.1", "prettier": "^3.6.2", "process": "^0.11.10", - "tsx": "^4.19.0" + "tsx": "^4.19.0", + "typescript": "5.9.2" }, "prettier": { "trailingComma": "all" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ab4196b0..4389fab1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,9 +17,6 @@ importers: semver: specifier: ^7.7.2 version: 7.7.2 - typescript: - specifier: 5.9.2 - version: 5.9.2 devDependencies: '@eslint/eslintrc': specifier: ^3.3.1 @@ -63,6 +60,9 @@ importers: tsx: specifier: ^4.19.0 version: 4.21.0 + typescript: + specifier: 5.9.2 + version: 5.9.2 examples/apollo-server: dependencies: diff --git a/src/Extractor.ts b/src/Extractor.ts index b31ca193..0c2d9d3d 100644 --- a/src/Extractor.ts +++ b/src/Extractor.ts @@ -3046,7 +3046,7 @@ function graphQLNameValidationMessage(name: string): string | null { try { assertName(name); return null; - } catch (e) { + } catch (e: any) { return e.message; } } diff --git a/src/tests/TestRunner.ts b/src/tests/TestRunner.ts index 0bf906a4..6bb54202 100644 --- a/src/tests/TestRunner.ts +++ b/src/tests/TestRunner.ts @@ -189,7 +189,7 @@ export default class TestRunner { async transform(code: string, filename: string): Promise { try { return await this._transformer(code, filename); - } catch (e) { + } catch (e: any) { console.error(e); return { kind: "ERROR", err: e.message }; } diff --git a/src/tests/test.ts b/src/tests/test.ts index 491540f3..e13d0143 100644 --- a/src/tests/test.ts +++ b/src/tests/test.ts @@ -126,7 +126,7 @@ const testDirs: TestDir[] = [ ); } parsed = parsedResult.value; - } catch (e) { + } catch (e: any) { return err(e.message); } console.warn = consoleWarn; @@ -191,7 +191,7 @@ const testDirs: TestDir[] = [ ); } parsedOptions = parsedOptionsResult.value; - } catch (e) { + } catch (e: any) { return err(e.message); } diff --git a/src/utils/visitor.ts b/src/utils/visitor.ts index b556093d..b28f53ce 100644 --- a/src/utils/visitor.ts +++ b/src/utils/visitor.ts @@ -59,7 +59,7 @@ export function visitDefinitions(doc: DocumentNode, visitors: Visitor) { }); } -const emptyArray = []; +const emptyArray: never[] = []; /** * Simplified, more performant, version of graphql-js's visit function that only diff --git a/tsconfig.json b/tsconfig.json index aedd5027..2dbe7973 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,10 +4,10 @@ }, "compilerOptions": { "skipLibCheck": true, + "types": ["node"], "lib": ["es2020"], "experimentalDecorators": true, "outDir": "dist", - "downlevelIteration": true, "strictNullChecks": true, "declaration": true, "resolveJsonModule": true, diff --git a/website/docs/07-changelog/index.md b/website/docs/07-changelog/index.md index 7e8eb5e7..3e640b5c 100644 --- a/website/docs/07-changelog/index.md +++ b/website/docs/07-changelog/index.md @@ -6,6 +6,10 @@ Changes in this section are not yet released. If you need access to these change - **Features** - 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. +- **Improvements** + - `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)) + - Added support for TypeScript 6.0. ([PR](https://github.com/captbaritone/grats/pull/228)) + - CI now tests against TypeScript 5.5, 5.7, 5.9, and 6.0. ## 0.0.36