Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TypeScript 5.0 and 5.1 #16

Merged
merged 1 commit into from
Jul 12, 2023
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A type-safe way to write GraphQL. Express your query as a plain object. Keep you

## Getting started

`gql-in-ts` supports TypeScript 4.4 thru 4.9.
`gql-in-ts` supports TypeScript 4.4 thru 5.1.

Install the library:

Expand Down
58 changes: 50 additions & 8 deletions package-lock.json

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

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
"ts4.7": "npm:[email protected]",
"ts4.8": "npm:[email protected]",
"ts4.9": "npm:[email protected]",
"typescript": "^4.9.0",
"ts5.0": "npm:[email protected]",
"ts5.1": "npm:[email protected]",
"typescript": "^5.1.0",
"vitest": "^0.18.1"
},
"scripts": {
Expand All @@ -56,4 +58,4 @@
"dependencies": {
"graphql": "^15.8.0"
}
}
}
7 changes: 7 additions & 0 deletions scripts/typecheck.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ import ts4_6 from 'ts4.6';
import ts4_7 from 'ts4.7';
import ts4_8 from 'ts4.8';
import ts4_9 from 'ts4.9';
import ts5_0 from 'ts5.0';
import ts5_1 from 'ts5.1';
import * as path from 'path';
import { readFileSync } from 'fs';

const CONFIG_FILE_PATH = './tsconfig.test.json';

// This script runs tsc of different versions programatically.
// Most of the source code is taken from this issue comment:
// https://github.com/Microsoft/TypeScript/issues/6387#issuecomment-169739615

const readFile = (path) => readFileSync(path, { encoding: 'utf-8' });

// Having one version per line is handy when toggling versions to test.
Expand All @@ -21,6 +26,8 @@ const diagnosticsCount = [
ts4_7,
ts4_8,
ts4_9,
ts5_0,
ts5_1
].map(
(ts) => {
const readConfigResult = ts.readConfigFile(CONFIG_FILE_PATH, readFile);
Expand Down
2 changes: 1 addition & 1 deletion src/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ type ResultForOutputObjectType<
// | { __typename: 'A' | 'B'; } // ----------------------------- Union candidate 1
// | { __typename: 'A'; fieldSpecificToA: <some value>; } // --- Union candidate 2
//
// The above type is hardly useless because one cannot discriminate
// The above type is hardly useful because one cannot discriminate
// union candidates based on the value of __typename.
// To be able to use __typename as a tag for telling apart the union
// constituents, __typename of union candidate 1 have to be narrowed
Expand Down
Loading