Skip to content

React "next" regression #28379

Closed
Closed
@ghost

Description

TypeScript Version: 3.2.0-dev.20181106

Code

import React = require("react");
function f<P>(App: React.ComponentClass<P> | React.StatelessComponent<P>): void {
    class C extends React.Component<P & { x: number }> {
        render() {
            return <App {...this.props} />;
        }
    }
}

Expected behavior:

No error, as in ts3.1.

Actual behavior:

src/a.tsx:6:21 - error TS2322: Type 'Readonly<{ children?: ReactNode; }> & Readonly<P & { x: number; }>' is not assignable to type 'IntrinsicAttributes & P & { children?: ReactNode; }'.
  Type 'Readonly<{ children?: ReactNode; }> & Readonly<P & { x: number; }>' is not assignable to type 'P'.

6             return <App {...this.props} />;
                      ~~~


Found 1 error.

Found in next on DefinitelyTyped.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: JSX/TSXRelates to the JSX parser and emitter

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions