Skip to content

Strange JSX usage compilation error #10430

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
Strate opened this issue Aug 19, 2016 · 12 comments
Closed

Strange JSX usage compilation error #10430

Strate opened this issue Aug 19, 2016 · 12 comments
Labels
Needs More Info The issue still hasn't been fully clarified

Comments

@Strate
Copy link

Strate commented Aug 19, 2016

TypeScript Version: 2.1.0-dev.20160819

Code

Unfortunatelly, I can't extract self-containment example

Expected behavior:
No error

Actual behavior:
Bunch of errors on each JSX usage:

src/lib/components/CTagSelect/CTagSelect.tsx(193,24): error TS2324: Property 'constructor' is missing in type 'IntrinsicAttributes & IntrinsicClassAttributes<CButton> & CButtonProps & { children?: ReactNode; }'.
src/lib/components/CTagSelect/CTagSelect.tsx(193,24): error TS2324: Property 'hasOwnProperty' is missing in type 'IntrinsicAttributes & IntrinsicClassAttributes<CButton> & CButtonProps & { children?: ReactNode; }'.
src/lib/components/CTagSelect/CTagSelect.tsx(193,24): error TS2324: Property 'isPrototypeOf' is missing in type 'IntrinsicAttributes & IntrinsicClassAttributes<CButton> & CButtonProps & { children?: ReactNode; }'.
src/lib/components/CTagSelect/CTagSelect.tsx(193,24): error TS2324: Property 'propertyIsEnumerable' is missing in type 'IntrinsicAttributes & IntrinsicClassAttributes<CButton> & CButtonProps & { children?: ReactNode; }'.
src/lib/components/CTagSelect/CTagSelect.tsx(193,24): error TS2324: Property 'toLocaleString' is missing in type 'IntrinsicAttributes & IntrinsicClassAttributes<CButton> & CButtonProps & { children?: ReactNode; }'.
src/lib/components/CTagSelect/CTagSelect.tsx(193,24): error TS2324: Property 'toString' is missing in type 'IntrinsicAttributes & IntrinsicClassAttributes<CButton> & CButtonProps & { children?: ReactNode; }'.
src/lib/components/CTagSelect/CTagSelect.tsx(193,24): error TS2324: Property 'valueOf' is missing in type 'IntrinsicAttributes & IntrinsicClassAttributes<CButton> & CButtonProps & { children?: ReactNode; }'.

and it happens with almost every component in my project.
Usage of that components does not have spread operator.
I can't extract something special with that components or usage.
It happens only with 2.1 nightly

@RyanCavanaugh
Copy link
Member

It really sounds like someone wrote Object in a place where they should have written {}. Can you search your codebase for that type and see if that helps you narrow it down?

@RyanCavanaugh RyanCavanaugh added the Needs More Info The issue still hasn't been fully clarified label Aug 19, 2016
@Strate
Copy link
Author

Strate commented Aug 19, 2016

@RyanCavanaugh
I am really can't find source of issue and can not reproduce issue on clean project. It happens with only one component, but not with all usages. All failed usages looks likes that:

import {CButton} from "src/lib/components"

class Usage extends React.Component<void, void> {
  render() {
    return <CButton type="type" /* and other attributes with that style, without spread operator */ />
  }
}

Non-failed usages looks like exactly the same :)
Looks like TS treats CButton's properties as an Object, which passes properties from Object.prototype to CButton props.
Object as a type is not used neither in CButton declaration, neither in usage.

Is there some magical logs, which I could enable to catch the issue? :)

@RyanCavanaugh
Copy link
Member

What is the declaration of CButton?

@kruczy
Copy link

kruczy commented Aug 31, 2016

have the same problem when trying 2.1.0-dev.20160831

for me it is only hasOwnProperty missing:
error TS2324: Property 'hasOwnProperty' is missing in type 'CheckboxProps & ComponentProps'.

this is for all usages of Checkbox component and it does not happen for any other component

there is nothing special in the definition of Checkbox it extends the base class the same as everything else and defines an interface for its props

I removed all props from the definition of both CheckboxProps and ComponentProps and it still had the same problem + some bonus ones for not defined props

If I explicitly define props: CheckboxProps directly in Checkbox class it is fine

though if I define the interface to be the same it is coming from generic parent: props: CheckboxProps & ComponentProps; it is also broken

Hope this helps with the issue

@RyanCavanaugh
Copy link
Member

I really need some code that reproduces this issue to proceed. Can either of you post a zip or repo link that I can look at?

@Strate
Copy link
Author

Strate commented Sep 5, 2016

This issue still reproduces in 2RC.
Unfortunatelly, defining props: CButtonProps directly at CButton does not fixes the issue in my case. Trying to extract self-reproduceable example.

@Strate
Copy link
Author

Strate commented Sep 5, 2016

@RyanCavanaugh could you please give me email, where I can send you zip with reproduceable project? Unfortunatelly, I can't share it on github, because it is private.

@Strate
Copy link
Author

Strate commented Sep 15, 2016

@RyanCavanaugh I want to ping you, please, give me any email :)

@RyanCavanaugh
Copy link
Member

[email protected]

@Strate
Copy link
Author

Strate commented Sep 26, 2016

@RyanCavanaugh have you recevied my email? I've sent it to you 11 days ago.

@RyanCavanaugh
Copy link
Member

Sorry for the delay, looking now

@RyanCavanaugh
Copy link
Member

Tracking at a fresh bug #11187. Thanks again

@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
Needs More Info The issue still hasn't been fully clarified
Projects
None yet
Development

No branches or pull requests

3 participants