当前位置:网站首页>对非ts/js文件模块进行类型扩充
对非ts/js文件模块进行类型扩充
2022-07-03 00:54:00 【程序猿向前跑】
对非ts/js文件模块进行类型扩充
ts只支持模块的导入导出, 但是有些时候你可能需要引入css/html等文件, 这时候就需要用通配符让ts把他们当做模块, 下面是对".vue"文件的导入支持(来自vue官方):
找不到 .vue 的声明文件,实际上就是 TS 无法识别 .vue 类型的文件。
引入.vue文件提示“Could not find a declaration file for module ‘xxx.vue’…”
有时候在开发过程中只是提示有错,不影响项目运行,但在打包时会报错,导致无法打包。
在src文件目录下(也就是你开发代码所在的文件夹)添加 shims-vue.d.ts 文件,内容为
// global.d.ts
declare module '*.vue' {
import {
DefineComponent } from 'vue'
const component: DefineComponent<{
}, {
}, any>
export default component
}
边栏推荐
- Explain the basic concepts and five attributes of RDD in detail
- 机器学习术语
- 12_微信小程序之微信视频号滚动自动播放视频效果实现
- [AUTOSAR eight OS]
- matlab 多普勒效应产生振动信号和处理
- Key wizard play strange learning - front desk and Intranet send background verification code
- 链表内指定区间反转
- 异步、邮件、定时三大任务
- Matlab Doppler effect produces vibration signal and processing
- Matlab finds the position of a row or column in the matrix
猜你喜欢

(C language) data storage
![leetcode:701. Insertion in binary search tree [BST insertion]](/img/bc/1dda73198488eb81b49be2c1dff6c2.png)
leetcode:701. Insertion in binary search tree [BST insertion]

Merge K sorted linked lists

leetcode 2097 — 合法重新排列数对
![1696C. Fishingprince plays with array [thinking questions + intermediate state + optimized storage]](/img/bf/ab6838e34a3074130eac0a9992e77c.png)
1696C. Fishingprince plays with array [thinking questions + intermediate state + optimized storage]

用Go+绘制爱心给心爱的她表白

有向图的强连通分量

Basis of information entropy
![[flutter] icons component (fluttericon Download Icon | customize SVG icon to generate TTF font file | use the downloaded TTF icon file)](/img/ca/1d2473ae51c59b84864352eb17de94.jpg)
[flutter] icons component (fluttericon Download Icon | customize SVG icon to generate TTF font file | use the downloaded TTF icon file)

Linear programming of mathematical modeling (including Matlab code)
随机推荐
按键精灵打怪学习-回城买药加血
R language ggplot2 visualization: use ggplot2 to display dataframe data that are all classified variables in the form of thermal diagram, and customize the legend color legend of factor
Solve the cache problem of reactnative using WebView
MySQL
JS inheritance and prototype chain
[AUTOSAR I overview]
leetcode:701. 二叉搜索树中的插入操作【bst的插入】
Key wizard play strange learning - multithreaded background coordinate recognition
excel IF公式判断两列是否相同
MySQL basic usage 02
Initial order of pointer (basic)
机器学习术语
matlab 多普勒效应产生振动信号和处理
Esp32 simple speed message test of ros2 (limit frequency)
Key wizard play strange learning - front desk and Intranet send background verification code
数据分析思维分析犯法和业务知识——分析方法(一)
leetcode:871. Minimum refueling times [Pat has done before + maximum stacking + greed]
数学建模之线性规划(含MATLAB代码)
[introduction to AUTOSAR seven tool chain]
无向图的割点