vueuse / sound

🔊 A Vue composable for playing sound effects
https://sound.vueuse.org
MIT License
495 stars 26 forks source link

error in vue2 with typescript #14

Closed alfredcc closed 10 months ago

alfredcc commented 3 years ago

Thank you to share this amazing project. But I got some problems with setup on my vue2 project.

ERROR in /Users/---/Developer/**/node_modules/@vueuse/sound/dist/esm/src/types.d.ts 1:35 Could not find a declaration file for module 'howler'. '/Users/---/Developer/---/node_modules/howler/dist/howler.js' implicitly has an 'any' type. Try npm install @types/howler if it exists or add a new declaration (.d.ts) file containing declare module 'howler';

1 | import { Howl, HowlOptions } from 'howler'; | ^ 2 | import { ComputedRef, Ref } from 'vue-demi'; 3 | export interface HowlStatic { 4 | new (properties: HowlOptions): Howl; No lint errors found

alfredcc commented 3 years ago

i have tried declare module "howler"; in shims-vue.d.ts

ERROR in /Users/---/Developer/---/node_modules/@vueuse/sound/dist/esm/src/types.d.ts 4:22 Cannot use namespace 'HowlOptions' as a type. 2 | import { ComputedRef, Ref } from 'vue-demi'; 3 | export interface HowlStatic {

4 | new (properties: HowlOptions): Howl; | ^ 5 | } 6 | export declare type MaybeRef = T | Ref | ComputedRef; 7 | export declare type SpriteMap = { ERROR in /Users/---/Developer/---/node_modules/@vueuse/sound/dist/esm/src/types.d.ts 4:36 Cannot use namespace 'Howl' as a type. 2 | import { ComputedRef, Ref } from 'vue-demi'; 3 | export interface HowlStatic { 4 | new (properties: HowlOptions): Howl; | ^ 5 | } 6 | export declare type MaybeRef = T | Ref | ComputedRef; 7 | export declare type SpriteMap = { ERROR in /Users/---/Developer/---/node_modules/@vueuse/sound/dist/esm/src/types.d.ts 26:16 Cannot use namespace 'Howl' as a type. 24 | export interface ReturnedValue { 25 | play: PlayFunction; 26 | sound: Ref<Howl | null>; | ^ 27 | stop: (id?: number) => void; 28 | pause: (id?: number) => void; 29 | isPlaying: Ref;

alfredcc commented 3 years ago

also tried to clean up all node_modules

alfredcc commented 3 years ago

npm install @types/howler not work too.

alfredcc commented 3 years ago

find this https://github.com/joshwcomeau/use-sound/issues/20

Tahul commented 1 year ago

Hey, could you let me know if your issue has been fixed by v2?

Thanks a lot 🙏