From 66f25f8394eb091c31d7908e544b0d24c8ebc497 Mon Sep 17 00:00:00 2001 From: Anton Gilgur Date: Mon, 8 Jul 2019 01:02:24 -0400 Subject: [PATCH] (types): enable strict mode - only one real change almost surprisingly - guess because I already resolved the implicit any warnings before --- src/index.ts | 6 ++++-- tsconfig.json | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index b31d1c9..3a4abb0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -46,9 +46,11 @@ export const persist: IArgs = (name, store, options = {}) => { }) } -function arrToDict (arr?: Array): object { +type StrToBoolMap = {[key: string]: boolean} + +function arrToDict (arr?: Array): StrToBoolMap { if (!arr) { return {} } - return arr.reduce((dict, elem) => { + return arr.reduce((dict: StrToBoolMap, elem) => { dict[elem] = true return dict }, {}) diff --git a/tsconfig.json b/tsconfig.json index aa85060..0754ab3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,7 @@ "declaration": true, "sourceMap": true, "rootDir": "./", + "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noImplicitReturns": true,