Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

TS-Generator: Nullable fields & strict mode #85

Closed
ryanquinn3 opened this issue Oct 15, 2018 · 1 comment
Closed

TS-Generator: Nullable fields & strict mode #85

ryanquinn3 opened this issue Oct 15, 2018 · 1 comment

Comments

@ryanquinn3
Copy link

Description

The generated [Type]Parent interface is compatible with typescript's --strictNullChecks setting if the type includes an optional field. With --strictNullChecks enabled, null and undefined are treated as different values.

The related issue that is now causing the break:
#25

Steps to reproduce

type User {
  name: String
}

type Query {
  user: User
}

Expected results

Should produce a resolver type that allows for undefined values

export namespace UserResolvers {
  export type NameType<T extends ITypeMap> = (
    parent: T['UserParent'],
    args: {},
    ctx: T['Context'],
    info: GraphQLResolveInfo
  ) => string | Promise<string | null | undefined> | null | undefined;

Actual results

export namespace UserResolvers {
  export type NameType<T extends ITypeMap> = (
    parent: T['UserParent'],
    args: {},
    ctx: T['Context'],
    info: GraphQLResolveInfo
  ) => string | Promise<string> | null ;

Versions

  • graphql-resolver-codegen: 0.3.1
@ryanquinn3
Copy link
Author

This is a duplicate of #50.

Closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant