-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Description
Bug Report
π Search Terms
Intersection types not merged
π Version & Regression Information
- This changed between versions 4.8.2 and 4.9.4
β― Playground Link
Playground link with relevant code
π» Code
type Query = {
listing: {
features: {
primary:
{ __typename?: 'Feature' }
& {
colors: {
light: number,
dark: number,
},
}
},
categories: Array<{ raw: number, formatted: string }>
}
& Fragment
}
type Fragment = {
features: {
primary:
{ __typename?: 'Feature' }
& {
colors: {
light: number
}
},
},
categories: Array<{ formatted: string }>
}
const response: Query = {
listing: {
features: {
primary: {
colors: {
light: 1,
dark: 3,
},
},
},
categories: [
{
raw: 2,
formatted: 'Used',
},
],
},
}π Actual behavior
colors.dark and categories.raw are marked as errors as missing in the type definition.
π Expected behavior
Errored fields are defined in the Query type and should be valid.
If I remove { __typename?: 'Feature' } from Fragment the error goes away.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue