这不是都找到类型了吗?这个报错是什么意思?如何解决呢?
//1.d.ts
type nh = import('ant-design-vue/es/message').MessageApi;
interface nhanh {
nh: nh
}
// **.vue
<script setup lang="ts">
const { } = defineProps<nhanh>();
</script>
<template></template>
//vite.config.ts
***
export default defineConfig({
***
plugins: [
vue({
script: {
globalTypeFiles: [
"src/views/1.d.ts"
]
}
}),
],
})
// 版本
***
"dependencies": {
***
"@types/three": "^0.154.0",
"pinia": "^2.1.7",
"vue": "^3.3.4",
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.3.3",
"@tsconfig/node18": "^18.2.2",
"@types/jsdom": "^21.1.3",
"@types/node": "^18.18.5",
"@vitejs/plugin-vue": "^4.4.0",
"@vitejs/plugin-vue-jsx": "^3.0.2",
"@vue/eslint-config-prettier": "^8.0.0",
"@vue/eslint-config-typescript": "^12.0.0",
"@vue/test-utils": "^2.4.1",
"@vue/tsconfig": "^0.4.0",
"eslint": "^8.49.0",
"eslint-plugin-vue": "^9.17.0",
"jsdom": "^22.1.0",
"less": "^4.2.0",
"npm-run-all2": "^6.1.1",
"prettier": "^3.0.3",
"tsconfig-paths": "^4.2.0",
"typescript": "~5.2.0",
"unplugin-vue-components": "^0.25.2",
"vite": "^4.4.11",
"vitest": "^0.34.6",
"vue-tsc": "^1.8.19"
}
消除错误
vue 3.3+
才支持引用外部的typehttps://blog.vuejs.org/posts/vue-3-3#imported-and-complex-typ...