Closed
Description
Bug Report
π Search Terms
intersection type, intersection type array
π Version & Regression Information
- This changed between versions 4.8.4 and 4.9.4
- This bug also appears in version 3.5.1, 3.3.3
β― Playground Link
Playground link with relevant code
π» Code
interface Colorful {
color: string;
}
interface Circle {
radius: number;
}
type ColorfulCircle = Colorful[] & Circle[];
const test: ColorfulCircle = [{
color: 'red',
radius: 2
}]
π Actual behavior
radius field gets type error: Object literal may only specify known properties, and 'radius' does not exist in type 'Colorful'
It looks like it is treating it as a union type where only one of the fields can exist.
π Expected behavior
I expected the merging of the types to make color and radius accessible (and required) in the ColorfulCircle
type.
Metadata
Metadata
Assignees
Labels
No labels