vue
vue copied to clipboard
conflict between docs and typescript api
Version
2.6.10
Reproduction link
Steps to reproduce
What is expected?
Figure out which is exact.
What is actually happening?
doc:
https://github.com/vuejs/vuejs.org/blame/master/src/v2/guide/render-function.md#L142
doc said the first argument of createElement could be string/ComponentOptions or async return them (string/ComponentOptions),
tsd:
https://github.com/vuejs/vue/blame/dev/types/vue.d.ts#L18
while tsd file need string/ComponentOptions/ComponentConstructor (add ComponentConstructor) or sync return ComponentOptions/ComponentConstructor (both added) or async return ComponentOptions/ComponentConstructor (no string and add ComponentConstructor).
import Vue, { ComponentOptions, ComponentConstructor } from 'vue';
declare module 'vue/types/vue' {
interface VueConstructor {
extend<Instance extends Vue, Data, Methods, Computed, Props>(
options?: ComponentOptions<Instance, Data, Methods, Computed, Props>
): ComponentConstructor<Instance>;
}
}
declare module 'vue/types/options' {
interface ComponentOptions<V extends Vue> {
extends?: ComponentOptions<V> | ComponentConstructor<V>;
}
}