Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
RyanCavanaugh opened this issue Sep 27, 2016 · 0 comments
Labels
Bug A bug in TypeScript Domain: JSX/TSX Relates to the JSX parser and emitter Fixed A PR has been merged for this issue

Comments

@RyanCavanaugh
Copy link
Member

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

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: JSX/TSX Relates to the JSX parser and emitter labels Sep 27, 2016
@mhegazy mhegazy added this to the TypeScript 2.1 milestone Sep 27, 2016
@mhegazy mhegazy modified the milestones: TypeScript 2.1, TypeScript 2.1.2, Future Oct 27, 2016
@yuit yuit modified the milestones: TypeScript 2.2, Future Jan 26, 2017
@yuit yuit added the Fixed A PR has been merged for this issue label Jan 26, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: JSX/TSX Relates to the JSX parser and emitter Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants