diff --git a/src/generator/__snapshots__/files.test.ts.snap b/src/generator/__snapshots__/files.test.ts.snap index 24ee36928..1c857ca89 100644 --- a/src/generator/__snapshots__/files.test.ts.snap +++ b/src/generator/__snapshots__/files.test.ts.snap @@ -291,39 +291,57 @@ export const InputObject = $.InputObject(\`InputObject\`, { dateRequired: $.Input.field($Scalar.Date), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const DateObject1 = $.Object$(\`DateObject1\`, { date1: $.field($.Output.Nullable($Scalar.Date)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const DateObject2 = $.Object$(\`DateObject2\`, { date2: $.field($.Output.Nullable($Scalar.Date)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const ObjectUnion = $.Object$(\`ObjectUnion\`, { fooBarUnion: $.field($.Output.Nullable(() => FooBarUnion)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const Foo = $.Object$(\`Foo\`, { id: $.field($.Output.Nullable($Scalar.ID)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const Bar = $.Object$(\`Bar\`, { int: $.field($.Output.Nullable($Scalar.Int)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const ObjectNested = $.Object$(\`ObjectNested\`, { id: $.field($.Output.Nullable($Scalar.ID)), object: $.field($.Output.Nullable(() => Object1)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const lowerCaseObject = $.Object$(\`lowerCaseObject\`, { id: $.field($.Output.Nullable($Scalar.ID)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const lowerCaseObject2 = $.Object$(\`lowerCaseObject2\`, { int: $.field($.Output.Nullable($Scalar.Int)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const Object1 = $.Object$(\`Object1\`, { string: $.field($.Output.Nullable($Scalar.String)), int: $.field($.Output.Nullable($Scalar.Int)), @@ -332,11 +350,15 @@ export const Object1 = $.Object$(\`Object1\`, { id: $.field($.Output.Nullable($Scalar.ID)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const Object1ImplementingInterface = $.Object$(\`Object1ImplementingInterface\`, { id: $.field($.Output.Nullable($Scalar.ID)), int: $.field($.Output.Nullable($Scalar.Int)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const Object2ImplementingInterface = $.Object$(\`Object2ImplementingInterface\`, { id: $.field($.Output.Nullable($Scalar.ID)), boolean: $.field($.Output.Nullable($Scalar.Boolean)), @@ -356,6 +378,8 @@ export const Interface = $.Interface(\`Interface\`, { id: $.field($.Output.Nulla Object2ImplementingInterface, ]) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const Query = $.Object$(\`Query\`, { date: $.field($.Output.Nullable($Scalar.Date)), dateNonNull: $.field($Scalar.Date), diff --git a/src/generator/code/schemaRuntime.ts b/src/generator/code/schemaRuntime.ts index 1e4d364f5..f4ca6ba22 100644 --- a/src/generator/code/schemaRuntime.ts +++ b/src/generator/code/schemaRuntime.ts @@ -98,6 +98,8 @@ const object = (config: Config, type: GraphQLObjectType) => { return `${field.name}: ${outputField(config, field)}` }).join(`,\n`) return ` + // eslint-disable-next-line + // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const ${type.name} = $.Object$(\`${type.name}\`, { ${fields} }) diff --git a/tests/ts/_/schema/generated/SchemaRuntime.ts b/tests/ts/_/schema/generated/SchemaRuntime.ts index 80a15fd5f..29bfe53bb 100644 --- a/tests/ts/_/schema/generated/SchemaRuntime.ts +++ b/tests/ts/_/schema/generated/SchemaRuntime.ts @@ -10,39 +10,57 @@ export const InputObject = $.InputObject(`InputObject`, { dateRequired: $.Input.field($Scalar.Date), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const DateObject1 = $.Object$(`DateObject1`, { date1: $.field($.Output.Nullable($Scalar.Date)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const DateObject2 = $.Object$(`DateObject2`, { date2: $.field($.Output.Nullable($Scalar.Date)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const ObjectUnion = $.Object$(`ObjectUnion`, { fooBarUnion: $.field($.Output.Nullable(() => FooBarUnion)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const Foo = $.Object$(`Foo`, { id: $.field($.Output.Nullable($Scalar.ID)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const Bar = $.Object$(`Bar`, { int: $.field($.Output.Nullable($Scalar.Int)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const ObjectNested = $.Object$(`ObjectNested`, { id: $.field($.Output.Nullable($Scalar.ID)), object: $.field($.Output.Nullable(() => Object1)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const lowerCaseObject = $.Object$(`lowerCaseObject`, { id: $.field($.Output.Nullable($Scalar.ID)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const lowerCaseObject2 = $.Object$(`lowerCaseObject2`, { int: $.field($.Output.Nullable($Scalar.Int)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const Object1 = $.Object$(`Object1`, { string: $.field($.Output.Nullable($Scalar.String)), int: $.field($.Output.Nullable($Scalar.Int)), @@ -51,11 +69,15 @@ export const Object1 = $.Object$(`Object1`, { id: $.field($.Output.Nullable($Scalar.ID)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const Object1ImplementingInterface = $.Object$(`Object1ImplementingInterface`, { id: $.field($.Output.Nullable($Scalar.ID)), int: $.field($.Output.Nullable($Scalar.Int)), }) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const Object2ImplementingInterface = $.Object$(`Object2ImplementingInterface`, { id: $.field($.Output.Nullable($Scalar.ID)), boolean: $.field($.Output.Nullable($Scalar.Boolean)), @@ -75,6 +97,8 @@ export const Interface = $.Interface(`Interface`, { id: $.field($.Output.Nullabl Object2ImplementingInterface, ]) +// eslint-disable-next-line +// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. export const Query = $.Object$(`Query`, { date: $.field($.Output.Nullable($Scalar.Date)), dateNonNull: $.field($Scalar.Date),