From 4ca30295d7d9f3dd7ba2e105952ff627f6b702a4 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Thu, 21 Dec 2017 13:10:05 +0100 Subject: Add strict typing Except for functions because of https://github.com/reactjs/redux/issues/2709 --- src/client/react/reducers/search.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/client/react/reducers') diff --git a/src/client/react/reducers/search.ts b/src/client/react/reducers/search.ts index 658d3ca..470e650 100644 --- a/src/client/react/reducers/search.ts +++ b/src/client/react/reducers/search.ts @@ -61,7 +61,7 @@ const search = (state = DEFAULT_STATE, action: Action): State => { if (isExactMatch) return state; const prevSelectedResult = state.selectedResult; - const prevSelectedResultIndex = results.indexOf(prevSelectedResult); + const prevSelectedResultIndex = prevSelectedResult ? results.indexOf(prevSelectedResult) : -1; let nextSelectedResultIndex = prevSelectedResultIndex + action.relativeChange; -- cgit v1.1