diff --git a/.changeset/real-dogs-swim.md b/.changeset/real-dogs-swim.md new file mode 100644 index 00000000..810e6f22 --- /dev/null +++ b/.changeset/real-dogs-swim.md @@ -0,0 +1,5 @@ +--- +"gql.tada": patch +--- + +Remove `stringLiteral` generic constraint, causing errors depending on TypeScript version diff --git a/src/api.ts b/src/api.ts index 46cf82e0..74204d7e 100644 --- a/src/api.ts +++ b/src/api.ts @@ -20,7 +20,7 @@ import type { import type { getDocumentType } from './selection'; import type { parseDocument, DocumentNodeLike } from './parser'; import type { getVariablesType, getScalarType } from './variables'; -import type { stringLiteral, obj, matchOr, writable, DocumentDecoration } from './utils'; +import type { obj, matchOr, writable, DocumentDecoration } from './utils'; /** Abstract configuration type input for your schema and scalars. * @@ -123,10 +123,7 @@ interface GraphQLTadaAPI, - const Fragments extends readonly [...makeDefinitionDecoration[]], - >( + ( input: In, fragments?: Fragments ): getDocumentNode< @@ -163,14 +160,14 @@ interface GraphQLTadaAPI, + const Name extends string, const Value extends getScalarType, >( name: Name, value: Value ): Value; - scalar>( + scalar( name: Name, value?: getScalarType ): getScalarType; @@ -294,7 +291,7 @@ function initGraphQLTada() { * GraphQL’s `parse` function. However, its return type will be the exact * structure of the AST parsed in types. */ -function parse>(input: In): parseDocument { +function parse(input: In): parseDocument { return _parse(input) as any; } diff --git a/src/utils.ts b/src/utils.ts index 762cda24..25048b5c 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,6 +1,3 @@ -/** Constraints a given string to a string literal. */ -export type stringLiteral = string extends T ? never : string; - /** Returns `T` if it matches `Constraint` without being equal to it. Failing this evaluates to `Fallback` otherwise. */ export type matchOr = Constraint extends T ? Fallback