-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
Usage in Typescript? #51
Comments
I was able to get a build working using the following, but it's quite messy: import '@justinribeiro/lite-youtube';
import { LiteYTEmbed } from '@justinribeiro/lite-youtube';
type CustomElement<T> = Partial<T & DOMAttributes<T> & { children: any }>;
declare global {
namespace JSX {
interface IntrinsicElements {
['lite-youtube']: CustomElement<LiteYTEmbed>;
}
}
}
// Then within the jsx:
<lite-youtube videoId="guJLfqTFfIw" autoLoad />; |
Cheers for the note and workaround. Humm, let me give this some thought about making this case easier. |
@justinribeiro note: I actually had to remove the I'm using Gatsby, and originally moved this import line to the However now that I have added other content to these files, once again that import statement throws that error on build. I'm forced to use the CDN script tag. |
I'm having trouble using this component in a Gatsby Typescript product.
The web-component is not recognized as a valid JSX element. Do you have any guidance on how we may overcome this issue?
I see that the source code is written in typescript, with a global declaration at the bottom. But perhaps this isn't being picked up by my Typescript settings?
Here is the specific error:
Property 'lite-youtube' does not exist on type 'JSX.IntrinsicElements'.
The text was updated successfully, but these errors were encountered: