dangcuuson / graphql-schema-typescript

Generate TypeScript from GraphQL's schema type definitions
191 stars 36 forks source link

Expected Behavior when there are no possibleTypes #57

Open MarkHerhold opened 3 years ago

MarkHerhold commented 3 years ago

How is this library supposed to behave when there are no in possibleTypes, e.g. on an interface that extends nothing?

File detail.graphql

schema {
  query: Query
}

type Query {
  getDetail: Detail
}

interface Detail {
  name: String!
  value: Float
}

File output.d.ts

// lots of lines omitted...

export interface DetailTypeResolver<TParent = any> {
  (parent: TParent, context: any, info: GraphQLResolveInfo):  | Promise<>; // <--- notice empty return type and no Promise return type
}

Debugger after evaluating const introspectResult = await getIntrospectResult(); here shows no possibleTypes (empty array): image

My question is what is the intended output or if this is a bug, what is the expected output?