TypeScript check and typing corrections.
This commit is contained in:
1 parent
21250a1a2d
commit
4f39875786
14 files changed
+27
-22
No files matched your search
@@ -41,7 +41,7 @@ export const sortedGrouped = (documents: Doc[], order: SortOrder) => {
|
||||
// Find the "best" item in each folder (first after sorting = best according to criteria)
|
||||
const folderBest = new Map<string, Doc>()
|
||||
for (const [folder, docs] of byFolder) {
|
||||
folderBest.set(folder, docs[0])
|
||||
folderBest.set(folder, docs[0]!)
|
||||
}
|
||||
|
||||
// Sort folders: by path for name sort, by best item for modified/size
|
||||
|
||||
@@ -70,7 +70,7 @@ export function getFileType(name: string): string {
|
||||
const dotIndex = name.lastIndexOf('.')
|
||||
if (dotIndex === -1 || dotIndex === name.length - 1) return 'unknown'
|
||||
const ext = name.slice(dotIndex + 1).toLowerCase()
|
||||
return Object.keys(filetypes).find(type => filetypes[type].includes(ext)) || 'unknown'
|
||||
return Object.keys(filetypes).find(type => filetypes[type]!.includes(ext)) || 'unknown'
|
||||
}
|
||||
|
||||
// Prebuilt for fast & consistent sorting
|
||||
|
||||
Reference in new issue
Block a user