Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove `cannot find name` for the SpeechRecognition API in Typescript, aka what does 'Now provided by --lib dom' mean?

recognition: SpeechRecognition | undefined;
this.recognition = new webkitSpeechRecognition(); 
this.recognition.onresult = (event: SpeechRecognitionEvent) => {});

Each throw a cannot find name warning for each of SpeechRecognition, webkitSpeechRecognition, and SpeechRecognitionEvent

I tried yarn -D add @types/webspeechapi but it produced an error, and indeed it is deprecated with the message Now provided by --lib dom. Unfortunately, I have no idea what this means!

like image 210
Gazzer Avatar asked Feb 04 '26 04:02

Gazzer


1 Answers

try this instead npm install --save @types/dom-speech-recognition worked for me

like image 161
habbey Avatar answered Feb 05 '26 18:02

habbey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!