Skip to content

针对.vue文件的类型声明文件的生成,vue组件的类型缺失问题! #454

@weimengdexiaolaohu-8

Description

@weimengdexiaolaohu-8

Describe the bug

我想构建我的一个组件库,在构建后并生成对应的类型声明文件,目前用此插件,生成的组件类型都是缺失的。生成的都是粗略的组件类型,而我在组件内声明的props,都没有类型约束和提示了。

用此插件构建生成的类型内容如下:
import { default as SvgIcon } from './components/svg-icon/svg-icon.vue';
export { SvgIcon };

期望的类型内容如下:
declare const _default: import("vue").DefineComponent<{
prefix: {
type: StringConstructor;
default: string;
};
name: {
type: StringConstructor;
required: true;
};
color: {
type: StringConstructor;
default: string;
};
style: {
type: ObjectConstructor;
};
width: {
type: StringConstructor;
default: string;
};
height: {
type: StringConstructor;
default: string;
};
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
prefix: {
type: StringConstructor;
default: string;
};
name: {
type: StringConstructor;
required: true;
};
color: {
type: StringConstructor;
default: string;
};
style: {
type: ObjectConstructor;
};
width: {
type: StringConstructor;
default: string;
};
height: {
type: StringConstructor;
default: string;
};
}>>, {
prefix: string;
color: string;
width: string;
height: string;
}>;
export default _default;

还请帮忙看下是什么原因造成的,具体代码例子在连接中!!

Reproduction

https://stackblitz.com/edit/vitejs-vite-a4djo7xk?terminal=dev

Steps to reproduce

No response

System Info

设备名称	DESKTOP-PMQ5CLL
处理器	13th Gen Intel(R) Core(TM) i5-13500H (2.60 GHz)
机带 RAM	16.0 GB (15.7 GB 可用)
设备 ID	7FC6CBD1-0794-447B-BE8C-9B3E9E40B531
产品 ID	00331-20020-00000-AA412
系统类型	64 位操作系统, 基于 x64 的处理器
笔和触控	没有可用于此显示器的笔或触控输入

浏览器版本:142.0.7444.163(正式版本) (64 位)

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions