当前位置:网站首页>对非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
}
边栏推荐
- [自我管理]时间、精力与习惯管理
- The R language uses the ctree function in the party package to build conditional inference decision trees, uses the plot function to visualize the trained conditional inference decision tree, and the
- Thank you for being together for these extraordinary two years!
- 18_ The wechat video number of wechat applet scrolls and automatically plays the video effect to achieve 2.0
- 电话网络问题
- Basic use of sringcloud & use of component Nacos
- 信息熵的基础
- 异步、邮件、定时三大任务
- Machine learning terminology
- 按键精灵打怪学习-多线程后台坐标识别
猜你喜欢

Machine learning terminology

leetcode 2097 — 合法重新排列数对
![leetcode:701. Insertion in binary search tree [BST insertion]](/img/bc/1dda73198488eb81b49be2c1dff6c2.png)
leetcode:701. Insertion in binary search tree [BST insertion]

【无标题】

Foundations of data science is free to download

瑞萨RZ/G2L ARM开发板存储读写速度与网络实测

电话网络问题

Reading and writing speed of Reza rz/g2l arm development board storage and network measurement

JS inheritance and prototype chain

拥抱平台化交付的安全理念
随机推荐
Draw love with go+ to express love to her beloved
Usage of using clause in kingbases alter table
Canvas drawing -- bingdd
Machine learning terminology
excel表格计算时间日期的差值,并转化为分钟数
Array and collection performance comparison
[love crash] neglected details of gibaro
1696C. Fishingprince plays with array [thinking questions + intermediate state + optimized storage]
MySQL
The difference between relational database and non relational database
Solve the cache problem of reactnative using WebView
Basic remote connection tool xshell
leetcode 2097 — 合法重新排列数对
Kivy教程大全之 创建您的第一个kivy程序 hello word(教程含源码)
The arm core board / development board of Feiling equipped with Ti am62x made its debut in embedded world 2022
dotConnect for PostgreSQL数据提供程序
Every k nodes in the linked list are flipped
[AUTOSAR five methodology]
Lu Zhe, chief scientist of Shiping information: building data and personnel centered security capabilities
Appuyez sur l'apprentissage de l'esprit de frappe - reconnaissance des coordonnées de fond multithreadées