Running TypeScript against this will produce the following error:
graphql.config.js:31:4 - error TS2322: Type '(string | { [x: string]: { headers: { Authorization: string; }; }; })[]' is not assignable to type 'SchemaPointer'.
Type '(string | { [x: string]: { headers: { Authorization: string; }; }; })[]' is not assignable to type 'string[]'.
Type 'string | { [x: string]: { headers: { Authorization: string; }; }; }' is not assignable to type 'string'.
Type '{ [x: string]: { headers: { Authorization: string; }; }; }' is not assignable to type 'string'.
31 schema: [
Expected behavior
It should pass TypeScript checking.
Environment:
OS: MacOS 13.5
GraphQL Config Version: 5.0.2
NodeJS: 18.17.1
Additional context
The following patch does fix this issue:
diff --git a/node_modules/graphql-config/typings/types.d.ts b/node_modules/graphql-config/typings/types.d.ts
index d78f633..90ac82c 100644
--- a/node_modules/graphql-config/typings/types.d.ts
+++ b/node_modules/graphql-config/typings/types.d.ts
@@ -30,13 +30,13 @@ export interface IGraphQLProjectLegacy {
}
export declare type WithList<T> = T | T[];
export declare type ElementOf<TList> = TList extends Array<infer TElement> ? TElement : never;
-export declare type SchemaPointer = WithList<string> | {
+export declare type SchemaPointer = WithList<string | {
[url: string]: {
headers: {
[name: string]: string;
};
};
-}[];
+}>;
export declare type SchemaPointerSingle = ElementOf<SchemaPointer>;
export declare type DocumentGlobPathPointer = string;
export declare type DocumentPointer = WithList<DocumentGlobPathPointer>;
Issue workflow progress
Progress of the issue based on the Contributor Workflow
Describe the bug
To Reproduce Steps to reproduce the behavior:
Running TypeScript against this will produce the following error:
Expected behavior
It should pass TypeScript checking.
Environment:
Additional context
The following patch does fix this issue: