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

Add typescript Support #10

Closed
Andreas-Schoenefeldt opened this issue Feb 18, 2022 · 3 comments
Closed

Add typescript Support #10

Andreas-Schoenefeldt opened this issue Feb 18, 2022 · 3 comments
Assignees

Comments

@Andreas-Schoenefeldt
Copy link

Andreas-Schoenefeldt commented Feb 18, 2022

If I try to use the library in a typescript project I get the following compilation error:

TS7016: Could not find a declaration file for module 'lottie-web-vue'. './node_modules/lottie-web-vue/dist/lottie-web-vue.umd.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/lottie-web-vue` if it exists or add a new declaration (.d.ts) file containing `declare module 'lottie-web-vue';`

My main.ts (vue 3):

import { createApp } from 'vue'
import LottieAnimation from 'lottie-web-vue'
// ...

createApp(App).use(LottieAnimation);

It would be great, if you could adopt typescript support for the library :)

@Andreas-Schoenefeldt
Copy link
Author

It turned out there is a pretty simple solution :), thx to https://blog.kewah.com/2018/typescript-declaration-file/

in the tsconfig.json:

{
  "compilerOptions": {
    "noImplicitAny": false
  }
}

I leave the ticket open. It would be great to have the d.ts file for this lib eventually.

@garbit
Copy link
Owner

garbit commented Feb 20, 2022

Hi @Andreas-Schoenefeldt - I've been working on a new Typescript declared plugin that has just been released (v2.0.0). I'm testing it now and it's been entirely rewritten to support this ticket.

@Andreas-Schoenefeldt
Copy link
Author

Great news 🥳

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