jessuni / shikwasa

An audio player born for podcast
https://shikwasa.js.org
MIT License
476 stars 30 forks source link

How to import Shikwasa in a typescript project? #53

Closed editpetercolquhoun closed 2 years ago

editpetercolquhoun commented 2 years ago

I have installed the latest version of shikwasa with npm but we are currently using TS and I have seen on your roadmap that TS is something you are working on, is it possible to get early access to the TS version. Thanks

jessuni commented 2 years ago

The title is a bit confusing. Does it happen when trying to import Shikwasa in a typescript project? What is the error message? Also please include reproduction steps.

editpetercolquhoun commented 2 years ago

Sorry for the confusion, it does happen when using (import Shikwasa from 'shikwasa') into the TS project, the specific error message is (Could not find a declaration file for module 'shikwasa'). It recommends i install the module with (npm i --save-dev @types/shikwasa) but this returns a 404. Thanks for your help.

jessuni commented 2 years ago

Ok, so now we're clear that it isn't an internal library error. This happens a lot when you try to import javascript libraries to a typescript project. Installing @types/shikwasa won't work because I did not submit any type declaration files to @types.

As a quick fix-it-all, just make sure typescript could find the module. in a local type declaration file in your project, e.g. types.d.ts:

   declare module 'shikwasa'

This will eliminate the error.

editpetercolquhoun commented 2 years ago

Thanks this fixed the issue.