From f560326f5e51c8724efeaadfd8167fd4a60b83a0 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 22 Jul 2024 18:35:44 +0200 Subject: [PATCH] fix: Adjust type definitions for global Nextcloud variables Signed-off-by: Ferdinand Thiessen --- package-lock.json | 18 ++++++------------ package.json | 3 ++- src/custom.d.ts | 2 +- src/globals.d.ts | 16 ++++++++++++++++ src/main.ts | 8 -------- 5 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 src/globals.d.ts diff --git a/package-lock.json b/package-lock.json index 941e0313a..38d037961 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,6 +38,7 @@ "@nextcloud/cypress": "^1.0.0-beta.6", "@nextcloud/eslint-config": "^8.3.0", "@nextcloud/stylelint-config": "^2.4.0", + "@nextcloud/typings": "^1.9.1", "@nextcloud/webpack-vue-config": "^5.5.1", "@types/bootstrap": "^5.2.10", "@types/dockerode": "^3.3.30", @@ -69,7 +70,7 @@ }, "engines": { "node": "^20.0.0", - "npm": "^9.0.0" + "npm": "^10.0.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -3894,13 +3895,11 @@ } }, "node_modules/@nextcloud/typings": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@nextcloud/typings/-/typings-1.8.0.tgz", - "integrity": "sha512-q9goE0wc+1BCI9Ku0MebCHmqOMwz2K7ESKQrcHDs6O+HqbKA8zGiEtXL5XGrMS7Ovtl1YOIwxlP9kEvgvXt52Q==", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@nextcloud/typings/-/typings-1.9.1.tgz", + "integrity": "sha512-i0l/L5gKW8EACbXHVxXM6wn3sUhY2qmnL2OijppzU4dENC7/hqySMQDer7/+cJbNSNG7uHF/Z+9JmHtDfRfuGg==", "dependencies": { - "@types/jquery": "3.5.16", - "vue": "^2.7.15", - "vue-router": "<4" + "@types/jquery": "3.5.16" }, "engines": { "node": "^20.0.0", @@ -22040,11 +22039,6 @@ "vue": "^2.6.0" } }, - "node_modules/vue-router": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.6.5.tgz", - "integrity": "sha512-VYXZQLtjuvKxxcshuRAwjHnciqZVoXAjTjcqBTz4rKc8qih9g9pI3hbDjmqXaHdgL3v8pV6P8Z335XvHzESxLQ==" - }, "node_modules/vue-style-loader": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.3.tgz", diff --git a/package.json b/package.json index b1f3d0d3a..25ab24119 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ }, "engines": { "node": "^20.0.0", - "npm": "^9.0.0" + "npm": "^10.0.0" }, "devDependencies": { "@babel/preset-react": "^7.24.1", @@ -25,6 +25,7 @@ "@nextcloud/cypress": "^1.0.0-beta.6", "@nextcloud/eslint-config": "^8.3.0", "@nextcloud/stylelint-config": "^2.4.0", + "@nextcloud/typings": "^1.9.1", "@nextcloud/webpack-vue-config": "^5.5.1", "@types/bootstrap": "^5.2.10", "@types/dockerode": "^3.3.30", diff --git a/src/custom.d.ts b/src/custom.d.ts index b83a3f452..f4849f567 100644 --- a/src/custom.d.ts +++ b/src/custom.d.ts @@ -20,6 +20,6 @@ * */ declare module '*.svg?raw' { - const content: any + const content: string export default content } diff --git a/src/globals.d.ts b/src/globals.d.ts new file mode 100644 index 000000000..5e219bc4e --- /dev/null +++ b/src/globals.d.ts @@ -0,0 +1,16 @@ +/// + +declare global { + interface Window { + OC: Nextcloud.v29.OC + OCP: Nextcloud.v29.OCP + // eslint-disable-next-line @typescript-eslint/no-explicit-any + OCA: any + } + /** + * Injected by webpack + */ + const appName: string +} + +export {} diff --git a/src/main.ts b/src/main.ts index 466cf0c60..a74f1e667 100644 --- a/src/main.ts +++ b/src/main.ts @@ -26,14 +26,6 @@ import FolderSvg from '@mdi/svg/svg/folder-account.svg?raw' import { getContents } from './services/groupfolders' import './actions/openGroupfolderAction' -declare global { - interface Window { - OCA: any - OCP: any - } - const appName: string -} - const Navigation = getNavigation() Navigation.register(new View({ id: appName,