Fix tsc error with FileSystemFileHandle

This commit is contained in:
Tyler Hallada 2022-03-12 20:36:55 -05:00
parent 1fa2e3e660
commit 85630949c5
3 changed files with 16 additions and 2 deletions

View File

@ -24,11 +24,11 @@ export const DropZone: React.FC<Props> = ({ children, workerPool }) => {
return false; return false;
} }
const entry = await item.getAsFileSystemHandle(); const entry = await item.getAsFileSystemHandle();
if (entry.kind === "file") { if (entry?.kind === "file") {
const file = await (entry as FileSystemFileHandle).getFile(); const file = await (entry as FileSystemFileHandle).getFile();
dispatch(setPluginsTxtAndApplyLoadOrder(await file.text())); dispatch(setPluginsTxtAndApplyLoadOrder(await file.text()));
return true; return true;
} else if (entry.kind === "directory") { } else if (entry?.kind === "directory") {
const plugins: { getFile: () => Promise<File> }[] = []; const plugins: { getFile: () => Promise<File> }[] = [];
const values = ( const values = (
entry as FileSystemDirectoryHandle & { values: any } entry as FileSystemDirectoryHandle & { values: any }

13
package-lock.json generated
View File

@ -25,6 +25,7 @@
"@types/node": "17.0.8", "@types/node": "17.0.8",
"@types/react": "17.0.38", "@types/react": "17.0.38",
"@types/react-dom": "^17.0.11", "@types/react-dom": "^17.0.11",
"@types/wicg-file-system-access": "^2020.9.5",
"eslint": "8.6.0", "eslint": "8.6.0",
"eslint-config-next": "12.0.8", "eslint-config-next": "12.0.8",
"next-sitemap": "^2.1.14", "next-sitemap": "^2.1.14",
@ -602,6 +603,12 @@
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz", "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz",
"integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==" "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew=="
}, },
"node_modules/@types/wicg-file-system-access": {
"version": "2020.9.5",
"resolved": "https://registry.npmjs.org/@types/wicg-file-system-access/-/wicg-file-system-access-2020.9.5.tgz",
"integrity": "sha512-UYK244awtmcUYQfs7FR8710MJcefL2WvkyHMjA8yJzxd1mo0Gfn88sRZ1Bls7hiUhA2w7ne1gpJ9T5g3G0wOyA==",
"dev": true
},
"node_modules/@typescript-eslint/parser": { "node_modules/@typescript-eslint/parser": {
"version": "5.9.1", "version": "5.9.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.9.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.9.1.tgz",
@ -4833,6 +4840,12 @@
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz", "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz",
"integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==" "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew=="
}, },
"@types/wicg-file-system-access": {
"version": "2020.9.5",
"resolved": "https://registry.npmjs.org/@types/wicg-file-system-access/-/wicg-file-system-access-2020.9.5.tgz",
"integrity": "sha512-UYK244awtmcUYQfs7FR8710MJcefL2WvkyHMjA8yJzxd1mo0Gfn88sRZ1Bls7hiUhA2w7ne1gpJ9T5g3G0wOyA==",
"dev": true
},
"@typescript-eslint/parser": { "@typescript-eslint/parser": {
"version": "5.9.1", "version": "5.9.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.9.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.9.1.tgz",

View File

@ -28,6 +28,7 @@
"@types/node": "17.0.8", "@types/node": "17.0.8",
"@types/react": "17.0.38", "@types/react": "17.0.38",
"@types/react-dom": "^17.0.11", "@types/react-dom": "^17.0.11",
"@types/wicg-file-system-access": "^2020.9.5",
"eslint": "8.6.0", "eslint": "8.6.0",
"eslint-config-next": "12.0.8", "eslint-config-next": "12.0.8",
"next-sitemap": "^2.1.14", "next-sitemap": "^2.1.14",