Boolean filter improvement alternative: TS upgrade (#4840)
* upgrade typescript and use new feature * fix: typing errorzio/stable
parent
50769b0b6f
commit
4437b9a557
|
@ -270,7 +270,7 @@
|
||||||
"react-scripts": "^5.0.1",
|
"react-scripts": "^5.0.1",
|
||||||
"react-test-renderer": "18.2.0",
|
"react-test-renderer": "18.2.0",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^5.3.3",
|
"typescript": "^5.5.4",
|
||||||
"url-loader": "^4.1.1",
|
"url-loader": "^4.1.1",
|
||||||
"webpack": "^5.75.0",
|
"webpack": "^5.75.0",
|
||||||
"webpack-bundle-analyzer": "^4.10.1",
|
"webpack-bundle-analyzer": "^4.10.1",
|
||||||
|
|
|
@ -74,7 +74,9 @@ function DialogContent({
|
||||||
|
|
||||||
const onPressAudience = (setting: ThreadgateSetting) => {
|
const onPressAudience = (setting: ThreadgateSetting) => {
|
||||||
// remove nobody
|
// remove nobody
|
||||||
let newSelected = draft.filter(v => v.type !== 'nobody')
|
let newSelected: ThreadgateSetting[] = draft.filter(
|
||||||
|
v => v.type !== 'nobody',
|
||||||
|
)
|
||||||
// toggle
|
// toggle
|
||||||
const i = newSelected.findIndex(v => isEqual(v, setting))
|
const i = newSelected.findIndex(v => isEqual(v, setting))
|
||||||
if (i === -1) {
|
if (i === -1) {
|
||||||
|
|
|
@ -375,11 +375,11 @@ export function usePostFeedQuery(
|
||||||
}
|
}
|
||||||
return undefined
|
return undefined
|
||||||
})
|
})
|
||||||
.filter(<T>(n?: T): n is T => Boolean(n)),
|
.filter(n => !!n),
|
||||||
}
|
}
|
||||||
return feedPostSlice
|
return feedPostSlice
|
||||||
})
|
})
|
||||||
.filter(<T>(n?: T): n is T => Boolean(n)),
|
.filter(n => !!n),
|
||||||
})),
|
})),
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,6 @@ export function threadgateViewToSettings(
|
||||||
}
|
}
|
||||||
return setting
|
return setting
|
||||||
})
|
})
|
||||||
.filter(<T>(n?: T): n is T => Boolean(n))
|
.filter(n => !!n)
|
||||||
return settings
|
return settings
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ function LoadMore({
|
||||||
}
|
}
|
||||||
return loadMoreItem
|
return loadMoreItem
|
||||||
})
|
})
|
||||||
.filter(<T,>(n?: T): n is T => Boolean(n))
|
.filter(n => !!n)
|
||||||
}, [item.items, moderationOpts])
|
}, [item.items, moderationOpts])
|
||||||
|
|
||||||
if (items.length === 0) return null
|
if (items.length === 0) return null
|
||||||
|
|
|
@ -21378,10 +21378,10 @@ typedarray-to-buffer@^3.1.5:
|
||||||
dependencies:
|
dependencies:
|
||||||
is-typedarray "^1.0.0"
|
is-typedarray "^1.0.0"
|
||||||
|
|
||||||
typescript@^5.3.3:
|
typescript@^5.5.4:
|
||||||
version "5.3.3"
|
version "5.5.4"
|
||||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37"
|
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.4.tgz#d9852d6c82bad2d2eda4fd74a5762a8f5909e9ba"
|
||||||
integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==
|
integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==
|
||||||
|
|
||||||
ua-parser-js@^0.7.33:
|
ua-parser-js@^0.7.33:
|
||||||
version "0.7.35"
|
version "0.7.35"
|
||||||
|
|
Loading…
Reference in New Issue