mirror of
https://github.com/vuejs/vue.git
synced 2024-11-21 20:28:54 +00:00
fix(types): global component registration type compat w/ defineComponent
fix #12622
This commit is contained in:
parent
b70a2585fc
commit
26ff4bc0ed
@ -1,3 +1,4 @@
|
||||
import Vue, { VueConstructor } from '../../index'
|
||||
import {
|
||||
Component,
|
||||
defineComponent,
|
||||
@ -8,12 +9,12 @@ import {
|
||||
} from '../../index'
|
||||
import { describe, test, expectType, expectError, IsUnion } from '../utils'
|
||||
|
||||
defineComponent({
|
||||
props: {
|
||||
foo: Number
|
||||
},
|
||||
render() {
|
||||
this.foo
|
||||
describe('compat with v2 APIs', () => {
|
||||
const comp = defineComponent({})
|
||||
|
||||
Vue.component('foo', comp)
|
||||
function install(app: VueConstructor) {
|
||||
app.component('foo', comp)
|
||||
}
|
||||
})
|
||||
|
||||
|
5
types/vue.d.ts
vendored
5
types/vue.d.ts
vendored
@ -14,6 +14,7 @@ import {
|
||||
} from './options'
|
||||
import { VNode, VNodeData, VNodeChildren, NormalizedScopedSlot } from './vnode'
|
||||
import { PluginFunction, PluginObject } from './plugin'
|
||||
import { DefineComponent } from './v3-define-component'
|
||||
|
||||
export interface CreateElement {
|
||||
(
|
||||
@ -313,6 +314,10 @@ export interface VueConstructor<V extends Vue = Vue> {
|
||||
id: string,
|
||||
definition?: ComponentOptions<V>
|
||||
): ExtendedVue<V, {}, {}, {}, {}, {}>
|
||||
component<T extends DefineComponent<any, any, any, any, any, any, any, any>>(
|
||||
id: string,
|
||||
definition?: T
|
||||
): T
|
||||
|
||||
use<T>(
|
||||
plugin: PluginObject<T> | PluginFunction<T>,
|
||||
|
Loading…
Reference in New Issue
Block a user