From 2b63093353891da99a12ceef0f7f27df9491f757 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 - not many changes almost surprisingly - guess because I already resolved most implicit any warnings before --- src/index.ts | 8 +++++--- tsconfig.json | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 71abbf5..3cf1b26 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,7 +22,7 @@ export const persist: IArgs = (name, store, options = {}) => { const whitelistDict = arrToDict(whitelist) const blacklistDict = arrToDict(blacklist) - onSnapshot(store, (_snapshot) => { + onSnapshot(store, (_snapshot: any) => { const snapshot = { ..._snapshot } Object.keys(snapshot).forEach((key) => { if (whitelist && !whitelistDict[key]) { @@ -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,