Skip to content

Commit a70f999

Browse files
authored
Fix GInterfaceField being assignable as fields (#46)
1 parent 8b7b281 commit a70f999

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

packages/schema/src/types.d.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,10 @@ export type GField<
185185
args?: Args;
186186
type: Type;
187187
resolve?: GFieldResolver<Source, Args, Type, Context>;
188-
deprecationReason?: string;
189-
description?: string;
190-
extensions?: Readonly<GraphQLFieldExtensions<Source, unknown>>;
188+
description?: Maybe<string>;
189+
deprecationReason?: Maybe<string>;
190+
extensions?: Maybe<Readonly<GraphQLFieldExtensions<any, Context>>>;
191+
astNode?: Maybe<FieldDefinitionNode>;
191192
__missingResolve?: (arg: SourceAtKey) => void;
192193
};
193194

@@ -278,6 +279,7 @@ export type GInterfaceField<
278279
deprecationReason?: Maybe<string>;
279280
extensions?: Maybe<Readonly<GraphQLFieldExtensions<any, Context>>>;
280281
astNode?: Maybe<FieldDefinitionNode>;
282+
__missingResolve?: (arg: never) => void;
281283
};
282284

283285
/**

test-project/index.test-d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,3 +2182,17 @@ const someInputFields = {
21822182
}),
21832183
});
21842184
}
2185+
2186+
{
2187+
g.object<{
2188+
id: string;
2189+
}>()({
2190+
name: "Something",
2191+
fields: {
2192+
// @ts-expect-error
2193+
id: g.interfaceField({ type: g.ID }),
2194+
// @ts-expect-error
2195+
other: g.interfaceField({ type: g.ID }),
2196+
},
2197+
});
2198+
}

0 commit comments

Comments
 (0)