-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
TSX rejects custom elements #4648
Comments
declare module JSX {
interface IntrinsicElements {
"my-custom-element": MyCustomElementClass
}
} You can do this to remove the type error, if you'd like. |
@weswigham what if the element doesn't have a class? |
Try typing it as |
Isn't |
If you have no type which describes the attributes allowed on the object, |
See this, typescript complains if React component does not start with a capital letter. |
I confirm that changing my react components name first letter to uppercase did fix the problem on typescript version 2.3.2 |
@jyotendra thanks for that starting the component with capital letter fixed the error for me too. |
It's part of jsx - lowercased names are considered intrinsics, while uppercased names are custom components. They get called differently, too. Intrinsics are just a string passed into createElement, while custom components pass in their constructor. |
Results in error:
Property 'my-custom-element' does not exist on type 'JSX.IntrinsicElements'
. As far as I'm aware, this ought to be valid JSX and so compile to:I can get around this by using the second form, but it'd be nice to avoid the check for standard elements (unless it's there for a good reason?)
The text was updated successfully, but these errors were encountered: