diff --git a/package.json b/package.json index 82d80d8d55..869fe79a2d 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,8 @@ }, "husky": { "hooks": { - "pre-commit": "yarn lint:types && lint-staged" + "pre-commit": "yarn lint:types && lint-staged", + "pre-push": "yarn lint && yarn clean && yarn build && yarn test" } }, "author": "@streamich", diff --git a/src/useSpeech.ts b/src/useSpeech.ts index 05b980afba..5198b5e1c1 100644 --- a/src/useSpeech.ts +++ b/src/useSpeech.ts @@ -19,7 +19,8 @@ export interface SpeechOptions { volume?: number; } -const voices = window.speechSynthesis.getVoices(); +const voices = + typeof window === 'object' && typeof window.speechSynthesis === 'object' ? window.speechSynthesis.getVoices() : []; const useSpeech = (text: string, opts: SpeechOptions = {}): SpeechState => { const [state, setState] = useSetState({