add @types/wicg-file-system-access to fix build errors

- https://stackoverflow.com/a/71343465/9439899
- https://github.com/WICG/file-system-access
This commit is contained in:
Joscha
2025-01-06 19:26:36 +01:00
parent 9208924ffe
commit 09996516de
5 changed files with 19 additions and 13 deletions

8
package-lock.json generated
View File

@@ -94,6 +94,7 @@
"@types/react-icon-base": "^2.1.6",
"@types/string-hash": "^1.1.3",
"@types/uuid": "^9.0.8",
"@types/wicg-file-system-access": "^2023.10.5",
"@vitejs/plugin-react": "^4.2.1",
"cors": "^2.8.5",
"cypress": "^13.13.0",
@@ -2395,6 +2396,13 @@
"integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==",
"dev": true
},
"node_modules/@types/wicg-file-system-access": {
"version": "2023.10.5",
"resolved": "https://registry.npmjs.org/@types/wicg-file-system-access/-/wicg-file-system-access-2023.10.5.tgz",
"integrity": "sha512-e9kZO9kCdLqT2h9Tw38oGv9UNzBBWaR1MzuAavxPcsV/7FJ3tWbU6RI3uB+yKIDPGLkGVbplS52ub0AcRLvrhA==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/yauzl": {
"version": "2.10.3",
"resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz",

View File

@@ -125,6 +125,7 @@
"@types/react-icon-base": "^2.1.6",
"@types/string-hash": "^1.1.3",
"@types/uuid": "^9.0.8",
"@types/wicg-file-system-access": "^2023.10.5",
"@vitejs/plugin-react": "^4.2.1",
"cors": "^2.8.5",
"cypress": "^13.13.0",

View File

@@ -113,16 +113,14 @@ class ModalExportInternal extends React.Component<ModalExportInternalProps> {
}
async createFileHandle() : Promise<FileSystemFileHandle | null> {
const pickerOpts = {
const pickerOpts: SaveFilePickerOptions = {
types: [
{
description: "Style JSON",
accept: {"application/json": [".json"]},
suggestedName: this.exportName(),
description: "json",
accept: { "application/json": [".json"] },
},
],
excludeAcceptAllOption: true,
multiple: false,
suggestedName: this.exportName(),
};
const fileHandle = await window.showSaveFilePicker(pickerOpts) as FileSystemFileHandle;

View File

@@ -138,14 +138,13 @@ class ModalOpenInternal extends React.Component<ModalOpenInternalProps, ModalOpe
onOpenFile = async () => {
this.clearError();
const pickerOpts = {
const pickerOpts: OpenFilePickerOptions = {
types: [
{
description: "Style JSON",
accept: {"application/json": [".json"]},
description: "json",
accept: { "application/json": [".json"] },
},
],
excludeAcceptAllOption: true,
multiple: false,
};

View File

@@ -3,7 +3,7 @@
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"types": ["geojson"],
"types": ["geojson", "@types/wicg-file-system-access"],
"module": "ESNext",
"skipLibCheck": true,
@@ -27,7 +27,7 @@
"ts-node": {
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Node"
"moduleResolution": "Node",
}
}
}
}