Closed webdiego closed 3 years ago
I am also having this issue, would love a demo file with typescript.
Yes, exactly. I've just built a website for a Records and I would like to add some cool sound effect! Hope someone can help us :)
For now I am able to get by with a defined click handler function like this:
const clickHandler = () => {
console.log('test'); //Just to verify its working
play();
};
onClick={clickHandler}. //on button or div
I used a declaration file I named audio.d.ts in the root of my src folder like this:
declare module '*.mp3';
declare module '*.wav';
Tbh I am new to typescript so I am not sure if these are the best practices but the audio plays.
Nice! Me as well, I've just started to learn it. I'm going to try right now! If you want we can open a project and try to figure out together! ;)
Im @trevva_ on twitter hit me up
same here this worked for me too. Can someone pls help with an explanation or another method to go about it.Thanks
Hello,
I would love to use this amazing tool, but I'm not able to use with React+Typescript (I've just started to learn them). Tried multiple times, but I've encountered with 2 main error.
I'm not able to import from my folder the mp3 as I get this TS error : Cannot find module or its corresponding type declarations.ts(2307)
type 'PlayFunction' is not assignable to type 'MouseEventHandler'
I hope someone can help me
Thanks! :) @joshwcomeau