Closed
Description
from Vue 2.x , when use with TypeScript we always write shims file d.ts
whichs support static type property used inside vue component object.
ex: in Nuxt, each component use as page
need defined $options.layout = 'layout name'
like this:
{
name: 'page',
layout: 'myLayout'
}
To typesafe this custom property, they provide d.ts
:
// ComponentOptions is declared in types/options.d.ts
declare module 'vue/types/options' {
interface ComponentOptions<V extends Vue> {
layout?: string
}
}
For now vue-function-api
provide function createComponent
to help TS's developer can inherit typesafe from package. View d.ts
file i see function defined:
export declare function createComponent<PropsOptions, RawBindings>(options: ComponentOptions<PropsOptions, RawBindings>): VueProxy<PropsOptions, RawBindings>;
export interface ComponentOptions<PropsOptions = ComponentPropsOptions, RawBindings = Data, Props = ExtractPropTypes<PropsOptions>> {
props?: PropsOptions;
setup?: SetupFunction<Props, RawBindings>;
}
This not inherit from Vue ComponentOptions , so we lost all typesafe from shims file.
A modify d.ts code will help a lot to inherit from Vue 2.x setup env .
Thankyou!
Metadata
Metadata
Assignees
Labels
No labels