mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: typecast file to fix the build (#5410)
* fix: typecast file to fix the build * update type for fileOpen * fix
This commit is contained in:
parent
88c313bf86
commit
d05745070b
1 changed files with 2 additions and 7 deletions
|
@ -1,5 +1,4 @@
|
||||||
import {
|
import {
|
||||||
FileWithHandle,
|
|
||||||
fileOpen as _fileOpen,
|
fileOpen as _fileOpen,
|
||||||
fileSave as _fileSave,
|
fileSave as _fileSave,
|
||||||
FileSystemHandle,
|
FileSystemHandle,
|
||||||
|
@ -26,13 +25,9 @@ export const fileOpen = <M extends boolean | undefined = false>(opts: {
|
||||||
extensions?: FILE_EXTENSION[];
|
extensions?: FILE_EXTENSION[];
|
||||||
description: string;
|
description: string;
|
||||||
multiple?: M;
|
multiple?: M;
|
||||||
}): Promise<
|
}): Promise<M extends false | undefined ? File : File[]> => {
|
||||||
M extends false | undefined ? FileWithHandle : FileWithHandle[]
|
|
||||||
> => {
|
|
||||||
// an unsafe TS hack, alas not much we can do AFAIK
|
// an unsafe TS hack, alas not much we can do AFAIK
|
||||||
type RetType = M extends false | undefined
|
type RetType = M extends false | undefined ? File : File[];
|
||||||
? FileWithHandle
|
|
||||||
: FileWithHandle[];
|
|
||||||
|
|
||||||
const mimeTypes = opts.extensions?.reduce((mimeTypes, type) => {
|
const mimeTypes = opts.extensions?.reduce((mimeTypes, type) => {
|
||||||
mimeTypes.push(MIME_TYPES[type]);
|
mimeTypes.push(MIME_TYPES[type]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue