fix(type): 修复类型检查错误

This commit is contained in:
PKC278
2025-12-30 01:47:45 +08:00
parent b98512789f
commit c5d1c5a468
7 changed files with 16 additions and 14 deletions

1
shims.d.ts vendored
View File

@@ -12,3 +12,4 @@ declare module 'vue-prism-component' {
export default component
}
declare module 'vue-shepherd';
declare module 'colorthief';

View File

@@ -1,4 +1,4 @@
import type { ValidationRule } from 'vuetify/types/services/validation'
type ValidationRule = (value: any) => string | boolean
// 必输校验
export const requiredValidator: ValidationRule = (value: any) => {

View File

@@ -4,6 +4,7 @@ import FileToolbar from './filebrowser/FileToolbar.vue'
import FileNavigator from './filebrowser/FileNavigator.vue'
import type { EndPoints, FileItem, StorageConf } from '@/api/types'
import { storageIconDict } from '@/api/constants'
import type { AxiosInstance } from 'axios'
// LocalStorage keys
const SORT_KEY = 'fileBrowser.sort'
@@ -16,7 +17,7 @@ const props = defineProps({
tree: Boolean,
endpoints: Object as PropType<EndPoints>,
axios: {
type: Function,
type: Object as PropType<AxiosInstance>,
required: true,
},
axiosconfig: Object,

View File

@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { AxiosRequestConfig } from 'axios'
import type { AxiosRequestConfig, AxiosInstance } from 'axios'
import type { PropType } from 'vue'
import { useConfirm } from '@/composables/useConfirm'
import { useToast } from 'vue-toastification'
@@ -28,7 +28,7 @@ const inProps = defineProps({
icons: Object,
endpoints: Object as PropType<EndPoints>,
axios: {
type: Function,
type: Object as PropType<AxiosInstance>,
required: true,
},
refreshpending: Boolean,
@@ -196,7 +196,7 @@ async function list_files() {
}
// 加载数据
const data = (await inProps.axios.request(config)) ?? []
const data = ((await inProps.axios.request(config)) as any) ?? []
// 如果当前路径已经变化,则放弃此次加载结果
if (prevURI !== takeURISnapshot()) {
return;
@@ -300,7 +300,7 @@ async function download(item: FileItem) {
responseType: 'blob',
}
// 加载数据
const result: Blob = await inProps.axios.request(config)
const result: Blob = (await inProps.axios.request(config)) as any
if (result) {
const downloadUrl = URL.createObjectURL(result)
window.open(downloadUrl, '_blank')
@@ -318,7 +318,7 @@ async function getImgLink(item: FileItem) {
responseType: 'blob',
}
// 加载二进制数据
const result: Blob = await inProps.axios.request(config)
const result: Blob = (await inProps.axios.request(config)) as any
if (result) {
// 创建图片地址
currentImgLink.value = URL.createObjectURL(result)
@@ -395,7 +395,7 @@ async function rename() {
method: inProps.endpoints?.rename.method || 'post',
data: currentItem.value,
}
const result: { [key: string]: any } = await inProps.axios?.request(config)
const result: { [key: string]: any } = (await inProps.axios?.request(config)) as any
if (!result.success) {
$toast.error(result.message)
}

View File

@@ -2,7 +2,7 @@
import type { PropType } from 'vue'
import type { FileItem } from '@/api/types'
import { useDisplay } from 'vuetify'
import type { AxiosRequestConfig } from 'axios'
import type { AxiosRequestConfig, AxiosInstance } from 'axios'
import { useI18n } from 'vue-i18n'
import { usePWA } from '@/composables/usePWA'
@@ -54,7 +54,7 @@ const props = defineProps({
},
endpoints: Object,
axios: {
type: Function,
type: Object as PropType<AxiosInstance>,
required: true,
},
})
@@ -131,7 +131,7 @@ async function loadSubdirectories(path: string) {
data: fakeItem,
}
const result = await props.axios?.request(config)
const result = (await props.axios?.request(config)) as any
if (result && Array.isArray(result)) {
// 过滤出目录项
const dirs = result.filter(item => item.type === 'dir')

View File

@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { AxiosRequestConfig } from 'axios'
import type { AxiosRequestConfig, AxiosInstance } from 'axios'
import type { EndPoints, FileItem } from '@/api/types'
import { useDisplay } from 'vuetify'
import { useI18n } from 'vue-i18n'
@@ -23,7 +23,7 @@ const inProps = defineProps({
},
endpoints: Object as PropType<EndPoints>,
axios: {
type: Function,
type: Object as PropType<AxiosInstance>,
required: true,
},
sort: {

View File

@@ -1,5 +1,5 @@
import { Icon } from '@iconify/vue'
import { aliases } from 'vuetify/lib/iconsets/mdi'
import { aliases } from 'vuetify/iconsets/mdi'
const alertTypeIcon = {
success: 'mdi-check-circle-outline',