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

No typescript? #16

Open
ollyde opened this issue Aug 18, 2023 · 5 comments · May be fixed by #17
Open

No typescript? #16

ollyde opened this issue Aug 18, 2023 · 5 comments · May be fixed by #17

Comments

@ollyde
Copy link

ollyde commented Aug 18, 2023

Not Found - GET https://registry.npmjs.org/@types%2flottiefiles__svelte-lottie-player - Not found

Could not find a declaration file for module '@lottiefiles/svelte-lottie-player'. '/Users/zzz/Projects/cto-for-hire/ctoforhire-svelte/node_modules/@lottiefiles/svelte-lottie-player/dist/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/lottiefiles__svelte-lottie-player` if it exists or add a new declaration (.d.ts) file containing `declare module '@lottiefiles/svelte-lottie-player';`ts(7016)

In 2023 you'd expect node modules to have TypeScript by default..

@jneuendorf
Copy link

From a quick look into LottiePlayer.svelte I came up with this declarations file (*.d.ts):

declare module '@lottiefiles/svelte-lottie-player' {
    import type { SvelteComponentTyped } from 'svelte'

    export class LottiePlayer extends SvelteComponentTyped<{
        autoplay?: boolean
        background: string
        controls: boolean
        controlsLayout?: string[]
        count?: number
        defaultFrame?: number
        direction?: number
        height: number
        hover?: boolean
        loop?: boolean
        mode?: 'normal' | 'bounce'
        onToggleZoom?: (boolean) => void
        renderer?: 'svg' | 'canvas'
        speed?: number
        src?: string
        style?: string
        width: number
    }> {}
}

@ollyde
Copy link
Author

ollyde commented Sep 2, 2023

@jneuendorf just need a PR now :-D thanks man

@jneuendorf jneuendorf linked a pull request Sep 2, 2023 that will close this issue
@jneuendorf
Copy link

jneuendorf commented Sep 2, 2023

@jneuendorf just need a PR now :-D thanks man

Done, see #17

@sebajans
Copy link

Any updates on whether this PR will be implemented?

Cheers

@berengamble
Copy link

In case you're a n00b like me, you need to put this code from the answer above in a file called svelte-lottie-player.d.ts in src and reload vscode.

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

Successfully merging a pull request may close this issue.

4 participants