Skip to content

Commit

Permalink
(types): enable strict mode
Browse files Browse the repository at this point in the history
- not many changes almost surprisingly
  - guess because I already resolved most implicit any warnings before
  • Loading branch information
agilgur5 committed Jul 11, 2019
1 parent 2255b20 commit 2b63093
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand All @@ -46,9 +46,11 @@ export const persist: IArgs = (name, store, options = {}) => {
})
}

function arrToDict (arr?: Array<string>): object {
type StrToBoolMap = {[key: string]: boolean}

function arrToDict (arr?: Array<string>): StrToBoolMap {
if (!arr) { return {} }
return arr.reduce((dict, elem) => {
return arr.reduce((dict: StrToBoolMap, elem) => {
dict[elem] = true
return dict
}, {})
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"declaration": true,
"sourceMap": true,
"rootDir": "./",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
Expand Down

0 comments on commit 2b63093

Please sign in to comment.