国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

ts依賴引入報錯:無法找到模塊“xxxxxx”的聲明文件問題解決

瀏覽:3日期:2022-06-13 14:39:17

依賴引入報錯是因為ts沒有識別當前引入的依賴,在vite-env.d.ts中聲明該依賴即可解決,語法:declare module "依賴名";

declare module 'file-saver';

解決找不到模塊“./App.vue”或其相應的類型聲明。

declare module '*.vue' { import { DefineComponent } from 'vue'; const component: DefineComponent<{}, {}, any>; export default component;}

解決router引入報錯的問題

declare module '*./router' { import type { DefineComponent } from 'vue-router' const component: DefineComponent<{}, {}, any> export default component}

declare module 'vue-router'

一些依賴報錯問題的解決

// <reference types='vite/client' />// 解決引入vue的報錯declare module '*.vue' { import { DefineComponent } from 'vue'; const component: DefineComponent<{}, {}, any>; export default component;}// 解決引入scss報錯問題declare module '*.scss' { const scss: Record<string, string>; export default scss;}// 解決引入模塊的報錯提示declare module 'vuedraggable/src/vuedraggable';declare module '@pureadmin/components';declare module '@pureadmin/theme';declare module '@pureadmin/theme/dist/browser-utils';declare module 'nprogress';declare module 'file-saver';declare module 'element-plus/dist/locale/zh-cn.mjs'; /*解決element-plus國際化依賴報錯*//* 解決axios報錯:類型“{ params: any; '': any; }”的參數不能賦給類型“AxiosRequestConfig<any> 解決:屬性“xxxxx”在類型”{ $: ComponentInternalInstance; $data : {}; $props:Part......報錯問題 */declare module 'axios' { export interface AxiosRequestConfig { // 添加數據類型 handlerEnabled?: boolean; baseURL: string; timeout: number; }}// 處理TS數據類型問題 類型“AxiosResponse<any, any>”上不存在屬性“meta”。declare module 'axios' { interface AxiosResponse<T = any> { meta: any; // 這里追加你的參數 baseURL?: string; timeout?: number; } export function create(config?: AxiosRequestConfig): AxiosInstance;}

總結

到此這篇關于ts依賴引入報錯:無法找到模塊“xxxxxx”的聲明文件問題解決的文章就介紹到這了,更多相關ts無法找到模塊xxxxxx的聲明文件內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: JavaScript
主站蜘蛛池模板: 宜兰市| 定州市| 旬阳县| 新宁县| 武强县| 大丰市| 宝清县| 克什克腾旗| 平定县| 微山县| 勃利县| 英德市| 徐水县| 博罗县| 左贡县| 壤塘县| 海阳市| 平安县| 金沙县| 河北省| 宜君县| 木里| 珠海市| 昔阳县| 宁强县| 东方市| 宁陕县| 聂荣县| 景德镇市| 云阳县| 林周县| 西充县| 象州县| 寻甸| 垫江县| 甘德县| 呼伦贝尔市| 韶山市| 澄江县| 淮北市| 灵台县|