Typescript 模块没有导出的成员Vue3

Typescript 模块没有导出的成员Vue3,typescript,vue.js,vue-component,Typescript,Vue.js,Vue Component,我需要一些关于Vue组件的帮助 我得到了这个错误: Failed to compile. src/components/Btn/Btn.vue:11:14 TS2305: Module '"../../typings/button-type"' has no exported member 'ButtonType'. 9 | import { defineComponent, computed } from '@vue/runtime-core'; &

我需要一些关于Vue组件的帮助

我得到了这个错误:

Failed to compile.

src/components/Btn/Btn.vue:11:14
TS2305: Module '"../../typings/button-type"' has no exported member 'ButtonType'.
     9 |     import { defineComponent, computed } from '@vue/runtime-core';
  > 11 |     import { ButtonType } from '@/typings/button-type';
       |              ^^^^^^^^^^
    12 | // components
    13 |
    14 |     export default defineComponent({
我正在尝试在一个单独的文件中创建我自己的Ts类型,并将其导入到我的组件中

类型:

在我的组件中,我有以下内容:

   import { ButtonType } from '@/typings/button-type';
// components

export default defineComponent({
    name: 'Btn',
    components: {},
    props: {
        size: {
            default: 'md',
        } as ButtonType.Button.size,
        type: {
            default: 'primary',
        } as ButtonType.Button.type,
    }
我试过ButtonType.Button['size']但都不起作用

我有一些计算数据等,但与案件无关。其主要思想是创建一个类型,以便在为按钮组件设置错误的大小或类型时识别错误


知道发生了什么吗?

Vue使用
PropType
作为道具类型

从“vue”导入{defineComponent,PropType}
从“@/typings/button type”导入{ButtonType};
导出默认定义组件({
道具:{
尺寸:{
默认值:“md”,
类型:字符串作为PropType
},
类型:{
默认值:“主”,
类型:字符串作为PropType
}
}
}
})

我已经尝试过了,但出现了以下错误:TS2352:将类型“string”转换为类型“PropType”可能是错误的,因为两种类型都没有充分重叠。如果这是故意的,请先将表达式转换为“未知”。@PaulB抱歉,我犯了一些错误,请尝试更新后的答案。我必须更改ButtonType,因为它是一个命名空间,因此无法将其与PropType一起使用。现在,我只将ButtonType导出为一个类型,并像您那样引用它,但出现另一个错误,
Module'././typings/button type'.'没有导出的成员“button”。
我不确定会发生什么,我尝试了一些东西。另外,如果我只使用大小和类型作为类型,它可以工作
export-Type Size='sm'|'md'|'lg'
,但导出按钮则无法工作
   import { ButtonType } from '@/typings/button-type';
// components

export default defineComponent({
    name: 'Btn',
    components: {},
    props: {
        size: {
            default: 'md',
        } as ButtonType.Button.size,
        type: {
            default: 'primary',
        } as ButtonType.Button.type,
    }