当前位置:网站首页>对非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
}
边栏推荐
- Appuyez sur l'apprentissage de l'esprit de frappe - reconnaissance des coordonnées de fond multithreadées
- 数学建模之线性规划(含MATLAB代码)
- 递归处理组织的几种情况
- First hand evaluation of Reza electronics rz/g2l development board
- Meibeer company is called "Manhattan Project", and its product name is related to the atomic bomb, which has caused dissatisfaction among Japanese netizens
- 链表内指定区间反转
- 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
- [shutter] animation animation (shutter animation type | the core class of shutter animation)
- 飞凌搭载TI AM62x的ARM核心板/开发板首发上市,亮相Embedded World 2022
- Excel calculates the difference between time and date and converts it into minutes
猜你喜欢
![leetcode:701. Insertion in binary search tree [BST insertion]](/img/bc/1dda73198488eb81b49be2c1dff6c2.png)
leetcode:701. Insertion in binary search tree [BST insertion]
![[untitled]](/img/fd/f6b90536f10325a6fdeb68dc49c72d.png)
[untitled]

【C语言】分支和循环语句(上)

leetcode 6103 — 从树中删除边的最小分数

机器学习术语

寻找标杆战友 | 百万级实时数据平台,终身免费使用

每日一题之干草堆的移动

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

Data analysis, thinking, law breaking and professional knowledge -- analysis method (I)
![[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)
随机推荐
Strongly connected components of digraph
[C language] branch and loop statements (Part 1)
异步、郵件、定時三大任務
Explain the basic concepts and five attributes of RDD in detail
1696C. Fishingprince plays with array [thinking questions + intermediate state + optimized storage]
攻克哈希的基本概念与实现
【无标题】
全志A40i/T3如何通过SPI转CAN
Canvas drawing -- bingdd
leetcode:871. Minimum refueling times [Pat has done before + maximum stacking + greed]
MySQL foundation 07-dcl
按键精灵打怪学习-自动回城路线的判断
Solve the cache problem of reactnative using WebView
18_ The wechat video number of wechat applet scrolls and automatically plays the video effect to achieve 2.0
MySQL foundation 06 DDL
How to convert Quanzhi a40i/t3 to can through SPI
Key wizard hit strange learning - automatic path finding back to hit strange points
强化学习 Q-learning 实例详解
MySQL基础用法02
Usage of using clause in kingbases alter table