当前位置:网站首页>对非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
}
边栏推荐
- MySQL
- excel表格计算时间日期的差值,并转化为分钟数
- 链表内指定区间反转
- 【FPGA教程案例5】基于vivado核的ROM设计与实现
- Foundations of data science is free to download
- The difference between relational database and non relational database
- Win10 can't be installed in many ways Problems with NET3.5
- Initial order of pointer (basic)
- 链表中的节点每k个一组翻转
- MySQL foundation 04 MySQL architecture
猜你喜欢
MySQL基础用法02
leetcode:701. Insertion in binary search tree [BST insertion]
[AUTOSAR nine c/s principle Architecture]
Lu Zhe, chief scientist of Shiping information: building data and personnel centered security capabilities
Matlab Doppler effect produces vibration signal and processing
Linear programming of mathematical modeling (including Matlab code)
Matlab saves the digital matrix as geospatial data, and the display subscript index must be of positive integer type or logical type. Solve the problem
12_微信小程序之微信视频号滚动自动播放视频效果实现
Telephone network problems
Draw love with go+ to express love to her beloved
随机推荐
[love crash] neglected details of gibaro
攻克哈希的基本概念与实现
机器学习术语
MySQL basic usage 02
leetcode:701. Insertion in binary search tree [BST insertion]
安全运营四要素之资产、脆弱性、威胁和事件
Matlab saves the digital matrix as geospatial data, and the display subscript index must be of positive integer type or logical type. Solve the problem
【第29天】给定一个整数,请你求出它的因子数
465. DFS backtracking of optimal bill balance
[C language] branch and loop statements (Part 1)
合并K个已排序的链表
R language ggplot2 visual faceting, visual facet_wrap bar plot, using strip Text function customize the size of the strip of each facet title in the facet graph (cutimi
excel去除小数点后面的数据,将数字取整
Basic remote connection tool xshell
【FPGA教程案例6】基于vivado核的双口RAM设计与实现
详解RDD基本概念、RDD五大属性
FPGA - 7 Series FPGA internal structure clocking -04- multi area clock
MySQL基础用法02
[overview of AUTOSAR four BSW]
Niu Ke swipes questions and clocks in