Skip to content

TS 3.7rc regression on intersected union types #34762

Closed
@andrewgreenh

Description

@andrewgreenh

TypeScript Version: 3.6.3 VS 3.7-beta/nightly (from playground)

Search Terms: discriminated union, intersection type, tag in intersection, extract by tag

Code

We tried the new TS 3.7rc in our project and encountered a problem with our generated types. The types are generated by GraphQLCodegen.
Our code compiles without errors or warning in TS 3.6.3 but has compile errors in 3.7rc and in the nightly build of the playground.
We reduced the code to get the following situation in the playground:

http://www.typescriptlang.org/play/?ts=3.7-Beta#code/DYUwLgBAngXBCiAPMAnAhgYzAHgEoHtQAaCAbwgH0KwoAHEAOzQFsQB+OAclxAHMBLfAwKhOEAL4A+CAF4IDAK7BgENAGdVDKAFgAUKEgAvWdAB0KPoIZ6bugPR2IPNZH4bejEOjAgAJhAAzFHxmCABxdFoACwBFYD0aeidLIRNSPQhKajpGFnY4ACIeASECgG4MiH5fOBcUfgZeCt1MplYOCDqGpr1xZsSQZJLhQkG5dJasgbb8iCKUkdByyura1G7mzIthuGKrZr6EnIgAQV9mBpExsimcmY6Cs4vFkHKqms71xolmo6Sr2SVAA+EAAFOQqNM8g8npdRgUJBAAGQQAAK-AwAGtsLCXiQCtUCpIAJTAsEQ7L0e6FPZCK4I8TE5FojHY2l4ubbKxE366IA

The error seems to occur, when I try to use the Extract type on a field that is added in an intersection type.

Expected behavior:
No errors in TS 3.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions