Skip to content

Incorrect JSX error at subsequent uses when a class has an Object spreaded in #11187

Closed
@RyanCavanaugh

Description

@RyanCavanaugh

Using @types/react:

class Poisoned extends React.Component<{}, {}> {
}

const obj: Object = {};
let p = <Poisoned {...obj} />;
let y = <Poisoned />;

Expected: no errors
Actual:

foo.tsx(6,9): error TS2324: Property 'constructor' is missing in type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & {} & { children?: ReactNode; }'.
foo.tsx(6,9): error TS2324: Property 'hasOwnProperty' is missing in type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & {} & { children?: ReactNode; }'.
foo.tsx(6,9): error TS2324: Property 'isPrototypeOf' is missing in type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & {} & { children?: ReactNode; }'.
foo.tsx(6,9): error TS2324: Property 'propertyIsEnumerable' is missing in type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & {} & { children?: ReactNode; }'.
foo.tsx(6,9): error TS2324: Property 'toLocaleString' is missing in type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & {} & { children?: ReactNode; }'.
foo.tsx(6,9): error TS2324: Property 'toString' is missing in type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & {} & { children?: ReactNode; }'.
foo.tsx(6,9): error TS2324: Property 'valueOf' is missing in type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & {} & { children?: ReactNode; }'.

Note that these errors are reported at the second instantiation

Originally discussed at #10430, repro reduced from a codebase from @Strate

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: JSX/TSXRelates to the JSX parser and emitterFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions