diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-05-30 18:23:13 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-05-31 17:17:31 +0200 |
commit | e8adb97098c482c5512ad3e3dcddd4caf4c64e84 (patch) | |
tree | 7bf0dbc0e55e67e7f206fda750fbf3ebd3e0e3f7 /apps/files | |
parent | 297f0522b2263e7250844deb653549bb68949dce (diff) | |
download | nextcloud-server-e8adb97098c482c5512ad3e3dcddd4caf4c64e84.tar.gz nextcloud-server-e8adb97098c482c5512ad3e3dcddd4caf4c64e84.zip |
refactor(files): Properly add type information to FilesListTableFooter
- Add correct type for `nodes` prop.
- Use `defineComponent` to properly infer Typescript information
- Correct usage of nullish coalescing operator
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/src/components/FilesListTableFooter.vue | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/apps/files/src/components/FilesListTableFooter.vue b/apps/files/src/components/FilesListTableFooter.vue index cc09d7966a1..5b4108fcaf1 100644 --- a/apps/files/src/components/FilesListTableFooter.vue +++ b/apps/files/src/components/FilesListTableFooter.vue @@ -41,19 +41,19 @@ </template> <script lang="ts"> +import type { Node } from '@nextcloud/files' +import type { PropType } from 'vue' + import { formatFileSize } from '@nextcloud/files' import { translate } from '@nextcloud/l10n' -import Vue from 'vue' +import { defineComponent } from 'vue' import { useFilesStore } from '../store/files.ts' import { usePathsStore } from '../store/paths.ts' -export default Vue.extend({ +export default defineComponent({ name: 'FilesListTableFooter', - components: { - }, - props: { isMtimeAvailable: { type: Boolean, @@ -64,7 +64,7 @@ export default Vue.extend({ default: false, }, nodes: { - type: Array, + type: Array as PropType<Node[]>, required: true, }, summary: { @@ -104,7 +104,7 @@ export default Vue.extend({ if (this.dir === '/') { return this.filesStore.getRoot(this.currentView.id) } - const fileId = this.pathsStore.getPath(this.currentView.id, this.dir) + const fileId = this.pathsStore.getPath(this.currentView.id, this.dir)! return this.filesStore.getNode(fileId) }, @@ -123,7 +123,7 @@ export default Vue.extend({ } // Otherwise let's compute it - return formatFileSize(this.nodes.reduce((total, node) => total + node.size || 0, 0), true) + return formatFileSize(this.nodes.reduce((total, node) => total + (node.size ?? 0), 0), true) }, }, |