尝试使用辅助组件(项目目录外部)时出现TypeScript错误:
TS2345: Argument of type '{ template: string; components: { SimpleCheckbox: typeof SimpleCheckbox; }; }'
is not assignable to parameter of type 'VueClass<Vue>'.
Object literal may only specify known properties, and 'template' does not exist in type
'VueClass<Vue>'.
Run Code Online (Sandbox Code Playgroud)
我的WebStorm IDE没有检测到此错误;当我使用TypeScript加载程序运行Webpack时,in在控制台中输出。
错误发生在:
import { Vue, Component, Prop } from 'vue-property-decorator';
import template from './SkipProjectInitializationStepPanel.pug';
import SimpleCheckbox from './../../../../ui-kit-libary-in-development/UiComponents/Checkboxes/MaterialDesign/SimpleCheckbox.vue';
@Component({ template, components: { SimpleCheckbox } }) // here !
export default class SkipProjectInitializationStepPanel extends Vue {
@Prop({ type: String, required: true }) …Run Code Online (Sandbox Code Playgroud) typescript vue.js vue-component typescript-decorator typescript-definitions