Skip to content

JSX props as intersection broken in nightly #28001

Closed
@ghost

Description

TypeScript Version: 3.2.0-dev.20181019

Code

declare namespace JSX {
    interface ElementAttributesProperty { props: {}; }
}

declare class Component<P> {
  constructor(props: P);
  readonly props: Readonly<P>;
}

class C<T> extends Component<{ x?: boolean; } & T> {}
const x = <C foobar="example" />

Expected behavior:

No error.

Actual behavior:

src/a.tsx:11:12 - error TS2322: Type '{ foobar: string; }' is not assignable to type 'Readonly<{ x?: boolean | undefined; }>'.
  Property 'foobar' does not exist on type 'Readonly<{ x?: boolean | undefined; }>'.

11 const x = <C foobar="example" />

Related Issues: #27990

Discovered in reactstrap on DefinitelyTyped.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions