Skip to content

Commit bd1b52e

Browse files
author
Dane Pilcher
authored
Merge pull request #739 from aws-amplify/main
Release generate empty types so v6 js types work
2 parents 1847d35 + f3e0c45 commit bd1b52e

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

packages/graphql-types-generator/src/typescript/codeGeneration.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,6 @@ export function interfaceVariablesDeclarationForOperation(
173173
generator: CodeGenerator,
174174
{ operationName, operationType, variables }: LegacyOperation,
175175
) {
176-
if (!variables || variables.length < 1) {
177-
return;
178-
}
179176
const interfaceName = interfaceVariablesNameFromOperation({operationName, operationType});
180177

181178
interfaceDeclaration(
@@ -184,7 +181,7 @@ export function interfaceVariablesDeclarationForOperation(
184181
interfaceName,
185182
},
186183
() => {
187-
const properties = propertiesFromFields(generator.context, variables);
184+
const properties = propertiesFromFields(generator.context, variables ?? []);
188185
pickedPropertyDeclarations(generator, properties);
189186
},
190187
);

packages/graphql-types-generator/test/typescript/__snapshots__/codeGeneration.js.snap

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,9 @@ export type Droid = {
258258
primaryFunction?: string | null,
259259
};
260260
261+
export type HeroAndFriendsNamesQueryVariables = {
262+
};
263+
261264
export type HeroAndFriendsNamesQuery = {
262265
hero: ( {
263266
__typename: \\"Human\\",
@@ -480,6 +483,9 @@ export type Droid = {
480483
primaryFunction?: string | null,
481484
};
482485
486+
export type HeroAndDetailsQueryVariables = {
487+
};
488+
483489
export type HeroAndDetailsQuery = {
484490
hero: ( {
485491
__typename: \\"Human\\",
@@ -670,6 +676,9 @@ export type Starship = {
670676
coordinates?: Array< Array< number > > | null,
671677
};
672678
679+
export type StarshipCoordsQueryVariables = {
680+
};
681+
673682
export type StarshipCoordsQuery = {
674683
starship?: {
675684
__typename: \\"Starship\\",
@@ -782,6 +791,9 @@ export type Droid = {
782791
primaryFunction?: string | null,
783792
};
784793
794+
export type HeroNameQueryVariables = {
795+
};
796+
785797
export type HeroNameQuery = {
786798
hero: ( {
787799
__typename: \\"Human\\",
@@ -942,6 +954,9 @@ export enum EnumCommentTestCase {
942954
}
943955
944956
957+
export type CustomScalarQueryVariables = {
958+
};
959+
945960
export type CustomScalarQuery = {
946961
commentTest?: {
947962
__typename: \\"CommentTest\\",
@@ -973,6 +988,9 @@ export type ImplB = {
973988
propB?: number | null,
974989
};
975990
991+
export type CustomScalarQueryVariables = {
992+
};
993+
976994
export type CustomScalarQuery = {
977995
interfaceTest: ( {
978996
__typename: \\"ImplA\\",
@@ -1011,6 +1029,9 @@ export enum EnumCommentTestCase {
10111029
}
10121030
10131031
1032+
export type CustomScalarQueryVariables = {
1033+
};
1034+
10141035
export type CustomScalarQuery = {
10151036
commentTest?: {
10161037
__typename: \\"CommentTest\\",
@@ -1045,6 +1066,9 @@ export enum EnumCommentTestCase {
10451066
}
10461067
10471068
1069+
export type CustomScalarQueryVariables = {
1070+
};
1071+
10481072
export type CustomScalarQuery = {
10491073
commentTest?: {
10501074
__typename: \\"CommentTest\\",
@@ -1073,6 +1097,9 @@ export type PartialB = {
10731097
prop: string,
10741098
};
10751099
1100+
export type CustomScalarQueryVariables = {
1101+
};
1102+
10761103
export type CustomScalarQuery = {
10771104
unionTest: ( {
10781105
__typename: \\"PartialA\\",
@@ -1189,6 +1216,9 @@ export type Droid = {
11891216
primaryFunction?: string | null,
11901217
};
11911218
1219+
export type HeroNameQueryVariables = {
1220+
};
1221+
11921222
export type HeroNameQuery = {
11931223
hero: ( {
11941224
__typename: \\"Human\\",
@@ -1318,6 +1348,9 @@ export type Starship = {
13181348
coordinates?: Array< Array< number > > | null,
13191349
};
13201350
1351+
export type DroidNameQueryVariables = {
1352+
};
1353+
13211354
export type DroidNameQuery = {
13221355
droid?: {
13231356
__typename: \\"Droid\\",

0 commit comments

Comments
 (0)