Skip to content
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

Type declarations #148

Open
bsastregx opened this issue May 1, 2023 · 1 comment
Open

Type declarations #148

bsastregx opened this issue May 1, 2023 · 1 comment

Comments

@bsastregx
Copy link

bsastregx commented May 1, 2023

Hi, Greetings!

Do you have a type declarations file?
I am importing LiteYTEmbed on a typescript project and getting the following warning:

Could not find a declaration file for module 'lite-youtube-embed'. 
'd:/genexus/repos/gwds-lit/node_modules/lite-youtube-embed/src/lite-yt-embed.js' 
implicitly has an 'any' type.Try `npm i --save-dev @types/lite-youtube-embed` if it exists
or add a new declaration (.d.ts) file containing `declare module 'lite-youtube-embed';`ts(7016)
@smac89
Copy link

smac89 commented Oct 2, 2024

Here you go:

declare module "lite-youtube-embed" {
   declare class LiteYTEmbed extends HTMLElement {
      async getYTPlayer(): Promise<YT.Player>;
   }
   declare global {
      interface HTMLElementTagNameMap {
         "lite-youtube": LiteYTEmbed;
      }
   }
}

YT.Player comes from @types/youtube

Put that in a declaration file somewhere, and you're golden.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants