File tree 3 files changed +20
-4
lines changed
3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " expo-speech-recognition " : patch
3
+ ---
4
+
5
+ Add type guards to Web Speech API to avoid unresolved references
Original file line number Diff line number Diff line change 17
17
"expo-module" : " expo-module" ,
18
18
"open:ios" : " open -a \" Xcode\" example/ios" ,
19
19
"open:android" : " open -a \" Android Studio\" example/android" ,
20
+ "changeset" : " changeset" ,
20
21
"release" : " npm run prepare && changeset publish" ,
21
22
"ts:check" : " tsc -p . --noEmit"
22
23
},
Original file line number Diff line number Diff line change @@ -4,12 +4,22 @@ let browserSpeechRecognitionEvent: typeof SpeechRecognitionEvent | null = null;
4
4
5
5
if ( typeof webkitSpeechRecognition !== "undefined" ) {
6
6
browserSpeechRecognition = webkitSpeechRecognition ;
7
- browserSpeechGrammarList = webkitSpeechGrammarList ;
8
- browserSpeechRecognitionEvent = webkitSpeechRecognitionEvent ;
7
+ browserSpeechGrammarList =
8
+ typeof webkitSpeechGrammarList !== "undefined"
9
+ ? webkitSpeechGrammarList
10
+ : null ;
11
+ browserSpeechRecognitionEvent =
12
+ typeof webkitSpeechRecognitionEvent !== "undefined"
13
+ ? webkitSpeechRecognitionEvent
14
+ : null ;
9
15
} else if ( typeof SpeechRecognition !== "undefined" ) {
10
16
browserSpeechRecognition = SpeechRecognition ;
11
- browserSpeechGrammarList = SpeechGrammarList ;
12
- browserSpeechRecognitionEvent = SpeechRecognitionEvent ;
17
+ browserSpeechGrammarList =
18
+ typeof SpeechGrammarList !== "undefined" ? SpeechGrammarList : null ;
19
+ browserSpeechRecognitionEvent =
20
+ typeof SpeechRecognitionEvent !== "undefined"
21
+ ? SpeechRecognitionEvent
22
+ : null ;
13
23
}
14
24
15
25
export const ExpoWebSpeechRecognition = browserSpeechRecognition ;
You can’t perform that action at this time.
0 commit comments