您现在的位置是:首页 >其他 >shims.tsx.d.ts 文件在 Vue-Typescript 项目中有什么作用?网站首页其他
shims.tsx.d.ts 文件在 Vue-Typescript 项目中有什么作用?
本文介绍了shims.tsx.d.ts 文件在 Vue-Typescript 项目中有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用 typescript 创建 Vue 项目时,包含两个声明文件:shims-vue.d.ts 和 shims.tsx.d.ts.
When creating a Vue project with typescript, two declaration files are included: shims-vue.d.ts and shims.tsx.d.ts.
//shims-vue.d.ts
declare module "*.vue" {
import Vue from 'vue';
export default Vue;
}
还有:
//shims.tsx.d.ts
import Vue, { VNode } from 'vue';
declare global {
namespace JSX {
// tslint:disable no-empty-interface
interface Element extends VNode {}
// tslint:disable no-empty-interface
interface ElementClass extends Vue {}
interface IntrinsicElements {
[elem: string]: any;
}
}
}
在创建一个小项目(没有 Vue CLI)时,我忘记包含第二个 (shims.tsx.d.ts),我的项目按预期编译





U8W/U8W-Mini使用与常见问题解决
QT多线程的5种用法,通过使用线程解决UI主界面的耗时操作代码,防止界面卡死。...
stm32使用HAL库配置串口中断收发数据(保姆级教程)
分享几个国内免费的ChatGPT镜像网址(亲测有效)
Allegro16.6差分等长设置及走线总结