I'm writing a simple react-native app using typescript and expo-cli. I've imported expo-av but I'm having some trouble when trying to play audio. I'm following [this guide][1] but it's written in javascript and I guess that's the problem here since it's complaining about types.
import { Audio } from "expo-av";
export const useAudio = () => {
const [sound, setSound] = useState();
const playSound = async () => {
const { sound } = await Audio.Sound.createAsync( // this line causes the error
require("../assets/sound/ding.mp3")
);
setSound(sound);
await sound.playAsync();
}
};
[![error message][2]][2]
[1]: https://docs.expo.dev/versions/v42.0.0/sdk/audio/
[2]: https://i.stack.imgur.com/PqDgC.png