]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(config): Adjust typescript config to allow `.ts` imports and Typescript in Vue...
authorFerdinand Thiessen <opensource@fthiessen.de>
Thu, 23 Nov 2023 19:42:33 +0000 (20:42 +0100)
committerFerdinand Thiessen <opensource@fthiessen.de>
Mon, 27 Nov 2023 16:35:14 +0000 (17:35 +0100)
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
apps/files/src/components/DragAndDropNotice.vue
apps/files/src/components/FilesListVirtual.vue
apps/files/src/views/FilesList.vue
tsconfig.json

index d18f82978a4506b84417f762c11c9b06e3112025..73f6ad13f47d727b7f791fd86784b8244ed58214 100644 (file)
@@ -33,7 +33,6 @@
 </template>
 
 <script lang="ts">
-import type { Upload } from '@nextcloud/upload'
 import { showError, showSuccess } from '@nextcloud/dialogs'
 import { translate as t } from '@nextcloud/l10n'
 import { getUploader } from '@nextcloud/upload'
index 0f772aedffcf5e45c6dffbfc1cb0aeb5c91804a7..c640ad72aca5140dd9af350b6d0072b88a81e67f 100644 (file)
@@ -72,20 +72,21 @@ import { getFileListHeaders, Folder, View, getFileActions } from '@nextcloud/fil
 import { showError } from '@nextcloud/dialogs'
 import { loadState } from '@nextcloud/initial-state'
 import { translate as t, translatePlural as n } from '@nextcloud/l10n'
-import Vue from 'vue'
+import { defineComponent } from 'vue'
+
+import { action as sidebarAction } from '../actions/sidebarAction.ts'
+import { useUserConfigStore } from '../store/userconfig.ts'
 
-import { action as sidebarAction } from '../actions/sidebarAction.js'
-import { useUserConfigStore } from '../store/userconfig.js'
 import FileEntry from './FileEntry.vue'
 import FileEntryGrid from './FileEntryGrid.vue'
 import FilesListHeader from './FilesListHeader.vue'
 import FilesListTableFooter from './FilesListTableFooter.vue'
 import FilesListTableHeader from './FilesListTableHeader.vue'
-import filesListWidthMixin from '../mixins/filesListWidth.js'
-import logger from '../logger.js'
+import filesListWidthMixin from '../mixins/filesListWidth.ts'
 import VirtualList from './VirtualList.vue'
+import logger from '../logger.js'
 
-export default Vue.extend({
+export default defineComponent({
        name: 'FilesListVirtual',
 
        components: {
index 07366f351a5b3b9749b81c079a191d828bfad5db..42423e1f4516925dffdf67d1536612f47ccbc2b5 100644 (file)
@@ -113,7 +113,7 @@ import { orderBy } from 'natural-orderby'
 import { translate, translatePlural } from '@nextcloud/l10n'
 import { Type } from '@nextcloud/sharing'
 import { UploadPicker } from '@nextcloud/upload'
-import Vue from 'vue'
+import { defineComponent } from 'vue'
 
 import LinkIcon from 'vue-material-design-icons/Link.vue'
 import ListViewIcon from 'vue-material-design-icons/FormatListBulletedSquare.vue'
@@ -125,23 +125,23 @@ import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
 import ShareVariantIcon from 'vue-material-design-icons/ShareVariant.vue'
 import ViewGridIcon from 'vue-material-design-icons/ViewGrid.vue'
 
-import { action as sidebarAction } from '../actions/sidebarAction.js'
-import { useFilesStore } from '../store/files.js'
-import { usePathsStore } from '../store/paths.js'
-import { useSelectionStore } from '../store/selection.js'
-import { useUploaderStore } from '../store/uploader.js'
-import { useUserConfigStore } from '../store/userconfig.js'
-import { useViewConfigStore } from '../store/viewConfig.js'
+import { action as sidebarAction } from '../actions/sidebarAction.ts'
+import { useFilesStore } from '../store/files.ts'
+import { usePathsStore } from '../store/paths.ts'
+import { useSelectionStore } from '../store/selection.ts'
+import { useUploaderStore } from '../store/uploader.ts'
+import { useUserConfigStore } from '../store/userconfig.ts'
+import { useViewConfigStore } from '../store/viewConfig.ts'
 import BreadCrumbs from '../components/BreadCrumbs.vue'
 import FilesListVirtual from '../components/FilesListVirtual.vue'
-import filesListWidthMixin from '../mixins/filesListWidth.js'
-import filesSortingMixin from '../mixins/filesSorting.js'
+import filesListWidthMixin from '../mixins/filesListWidth.ts'
+import filesSortingMixin from '../mixins/filesSorting.ts'
 import logger from '../logger.js'
 import DragAndDropNotice from '../components/DragAndDropNotice.vue'
 
 const isSharingEnabled = (getCapabilities() as { files_sharing?: boolean })?.files_sharing !== undefined
 
-export default Vue.extend({
+export default defineComponent({
        name: 'FilesList',
 
        components: {
index 84026597f6fa902eab3ff58e60d94de9c60138fb..6049d7299382d01590d75dea8c12ffdc226fba06 100644 (file)
@@ -1,12 +1,15 @@
 {
        "extends": "@vue/tsconfig/tsconfig.json",
-       "include": ["./apps/**/*.ts", "./core/**/*.ts", "./*.d.ts"],
+       "include": ["./apps/**/*.ts", "./apps/**/*.vue", "./core/**/*.ts", "./*.d.ts"],
        "compilerOptions": {
-               "types": ["jest", "node", "vue"],
+               "types": ["jest", "node", "vue", "vue-router"],
                "outDir": "./dist/",
                "target": "ESNext",
                "module": "esnext",
-               "moduleResolution": "node",
+               // Set module resolution to bundler and `noEmit` to be able to set `allowImportingTsExtensions`, so we can import Typescript with .ts extension
+               "moduleResolution": "Bundler",
+               "allowImportingTsExtensions": true,
+               "noEmit": true,
                // Allow ts to import js files
                "allowJs": true,
                "allowSyntheticDefaultImports": true,
@@ -19,6 +22,7 @@
                // these options are overrides used only by ts-node
                // same as our --compilerOptions flag and our TS_NODE_COMPILER_OPTIONS environment variable
                "compilerOptions": {
+                       "moduleResolution": "node",
                        "module": "commonjs",
                        "verbatimModuleSyntax": false
                }