From 1353b6c1259281d2b563c081deeed5202027a1b8 Mon Sep 17 00:00:00 2001 From: streamich Date: Sun, 30 Jun 2019 12:37:00 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20fix=20test=20and=20add=20?= =?UTF-8?q?pre-push=20hook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 ++- src/useSpeech.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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({