-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
TypeScript Version: 2.3.1, 2.4.0-dev.20170427
Code
type Foo = { foo: string }
type Bar = { bar: string }
type Baz = { baz: string }
type FBB = Foo | Bar | Baz
declare const obj: FBB
const FbbComponent = (props: FBB) => (
<div>{JSON.stringify(props)}</div>
)
const comp1 = React.createElement(FbbComponent, { ...obj }) // works
const comp2 = <FbbComponent {...obj as Foo} /> // works
const comp3 = <FbbComponent {...obj} /> // does not work
Expected behavior:
Compiles without errors
Actual behavior:
Error:
Type '{}' is not assignable to type '(IntrinsicAttributes & Foo) | (IntrinsicAttributes & Bar) | (IntrinsicAttributes & Baz)'.
Type '{}' is not assignable to type 'IntrinsicAttributes & Baz'.
Type '{}' is not assignable to type 'Baz'.
Property 'baz' is missing in type '{}'.
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created