当前位置:网站首页>对非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
}
边栏推荐
- [AUTOSAR XIII NVM]
- 寻找标杆战友 | 百万级实时数据平台,终身免费使用
- Reading and writing speed of Reza rz/g2l arm development board storage and network measurement
- [C language] branch and loop statements (Part 1)
- 产业互联网的产业范畴足够大 消费互联网时代仅是一个局限在互联网行业的存在
- 1038 Recover the Smallest Number
- MySQL foundation 04 MySQL architecture
- [AUTOSAR II appl overview]
- Correctly distinguish the similarities and differences among API, rest API, restful API and web service
- Database SQL language 01 where condition
猜你喜欢

Excel if formula determines whether the two columns are the same

Linear programming of mathematical modeling (including Matlab code)

leetcode 2097 — 合法重新排列数对
![[overview of AUTOSAR three RTE]](/img/6a/0df33beb42f165af77a17b5d8b01e2.png)
[overview of AUTOSAR three RTE]

Correctly distinguish the similarities and differences among API, rest API, restful API and web service
![[AUTOSAR eight OS]](/img/ac/fbc84c077ff9c94c840e1871171d19.png)
[AUTOSAR eight OS]

Excel calculates the difference between time and date and converts it into minutes

ROS2之ESP32简单速度消息测试(极限频率)

MySQL基础用法02

Esp32 simple speed message test of ros2 (limit frequency)
随机推荐
删除有序链表中重复的元素-II
Basic concept and implementation of overcoming hash
[AUTOSAR VI description document]
Array and collection performance comparison
(C语言)数据的存储
安全运营四要素之资产、脆弱性、威胁和事件
Mongodb common commands of mongodb series
[AUTOSAR nine c/s principle Architecture]
12_微信小程序之微信视频号滚动自动播放视频效果实现
Cut point of undirected graph
产业互联网的产业范畴足够大 消费互联网时代仅是一个局限在互联网行业的存在
Basis of information entropy
Explain the basic concepts and five attributes of RDD in detail
18_微信小程序之微信视频号滚动自动播放视频效果实现2.0
leetcode:701. 二叉搜索树中的插入操作【bst的插入】
Trois tâches principales: asynchrone, courrier et timing
Merge K sorted linked lists
[overview of AUTOSAR three RTE]
[AUTOSAR 11 communication related mechanism]
matlab查找某一行或者某一列在矩阵中的位置