Skip to content

Interface types do not list their parent interface types #10515

@gabrielschulhof

Description

@gabrielschulhof

Which packages are impacted by your issue?

@graphql-codegen/visitor-plugin-common

Describe the bug

When generating code for an interface, its parent interfaces are not listed. e.g:

interface TopLevel {
  topLevelField: Boolean
}

interface MidLevel implements TopLevel {
  topLevelField: Boolean
  midLevelField: Int
}

type BottomLevel implements MidLevel & TopLevel {
  topLevelField: Boolean
  midLevelField: Int
  bottomLevelField: String
}

will result in

type TopLevel = {
  topLevelField: boolean
}

type MidLevel = /* MISSING TopLevel & */ {
  topLevelField: boolean
  midlEvelField: number
}

type BottomLevel = MidLevel & TopLevel & {
  bottomLevelField: String
}

with missing notation shown.

Your Example Website or App

gabrielschulhof/graphql-code-generator

Steps to Reproduce the Bug or Issue

  1. Generate TS code from the schema shown in the description.

Expected behavior

The MISSING portion shown in the description is not missing.

Screenshots or Videos

No response

Platform

All platforms

Codegen Config File

import type { CodegenConfig } from '@graphql-codegen/cli'

const config: CodegenConfig = {
overwrite: true,
schema: './data/schema.graphql',
generates: {
'src/types.ts': {
plugins: [
'typescript'
]
}
}
}
export default config

Additional context

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions