From d05745070bcc3b91527d0eadd4e7a2e0c0e2fea6 Mon Sep 17 00:00:00 2001 From: Aakansha Doshi Date: Mon, 4 Jul 2022 17:44:20 +0530 Subject: [PATCH] fix: typecast file to fix the build (#5410) * fix: typecast file to fix the build * update type for fileOpen * fix --- src/data/filesystem.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/data/filesystem.ts b/src/data/filesystem.ts index 8db365c6..ffe088fa 100644 --- a/src/data/filesystem.ts +++ b/src/data/filesystem.ts @@ -1,5 +1,4 @@ import { - FileWithHandle, fileOpen as _fileOpen, fileSave as _fileSave, FileSystemHandle, @@ -26,13 +25,9 @@ export const fileOpen = (opts: { extensions?: FILE_EXTENSION[]; description: string; multiple?: M; -}): Promise< - M extends false | undefined ? FileWithHandle : FileWithHandle[] -> => { +}): Promise => { // an unsafe TS hack, alas not much we can do AFAIK - type RetType = M extends false | undefined - ? FileWithHandle - : FileWithHandle[]; + type RetType = M extends false | undefined ? File : File[]; const mimeTypes = opts.extensions?.reduce((mimeTypes, type) => { mimeTypes.push(MIME_TYPES[type]);