better code
Massimo Melina committed
Nov 23, 2023 at 01:11 UTC
c4f9e596b52edbf9fc4d3319da639a467038d3e4
2 files changed
+2
-2
shared/react.ts
+1
-1
@@ -12,7 +12,7 @@ export function useStateMounted<T>(init: T) {
12
if (isMounted())
13
set(newValue)
14
}, [isMounted, set])
15
- return [v, setIfMounted, isMounted] as [T, typeof setIfMounted, typeof isMounted]
15
+ return [v, setIfMounted, isMounted] as const
16
}
17
18
export function reactFilter(elements: any[]) {
src/util-files.ts
+1
-1
@@ -92,7 +92,7 @@ export async function* dirStream(path: string, deep=0) {
92
if (!isDir && !dirent.isFile()) continue
93
path = String(path)
94
if (!skip?.includes(path))
95
- yield [path, isDir] as [string, boolean]
95
+ yield [path, isDir] as const
96
}
97
98
async function getItemsToSkip(path: string) {