facing-dev/vue-facing-decorator

TSX component typing does not include PublicProps attributes

Opened this issue · 0 comments

s-elo commented

when using tsx, there is no intrinsic typing for class, style which are included in DefineComponent typing.

may be we can add these typing at TSX, instead of extends them at each component's Props interface?

import type { PublicProps } from 'vue';

export declare function TSX<Properties extends {} = {}, Events extends {} = {}>(): <C extends VueCons<{}>>(cons: C) => new () => Omit<ComponentPublicInstance<InstanceType<C>["$props"] & Properties & { [index in keyof Events as `on${Capitalize<index & string>}`]: Events[index] extends Function ? Events[index] : (param: Events[index]) => any; }>, keyof Properties | keyof { [index in keyof Events as `on${Capitalize<index & string>}`]: Events[index] extends Function ? Events[index] : (param: Events[index]) => any; }> & InstanceType<C> 
// add extra attributes
& { $props?: PublicProps };