mirror of
https://github.com/vuejs/vue.git
synced 2024-11-21 20:28:54 +00:00
fix(types): fix type inference when using components option
This commit is contained in:
parent
dc8a68e8c6
commit
1d5a411c1e
6
types/options.d.ts
vendored
6
types/options.d.ts
vendored
@ -20,7 +20,7 @@ export type Component<
|
||||
| typeof Vue
|
||||
| FunctionalComponentOptions<Props>
|
||||
| ComponentOptions<never, Data, Methods, Computed, Props, SetupBindings>
|
||||
| DefineComponent<any, any, any, any, any>
|
||||
| DefineComponent<any, any, any, any, any, any, any, any, any, any, any>
|
||||
|
||||
type EsModule<T> = T | { default: T }
|
||||
|
||||
@ -201,9 +201,9 @@ export interface ComponentOptions<
|
||||
directives?: { [key: string]: DirectiveFunction | DirectiveOptions }
|
||||
components?: {
|
||||
[key: string]:
|
||||
| Component<any, any, any, any>
|
||||
| {}
|
||||
| Component<any, any, any, any, any>
|
||||
| AsyncComponent<any, any, any, any>
|
||||
| DefineComponent<any, any, any, any, any, any, any, any, any, any>
|
||||
}
|
||||
transitions?: { [key: string]: object }
|
||||
filters?: { [key: string]: Function }
|
||||
|
@ -1115,3 +1115,26 @@ describe('functional w/ object props', () => {
|
||||
// @ts-expect-error
|
||||
;<Foo bar={123} />
|
||||
})
|
||||
|
||||
// #12628
|
||||
defineComponent({
|
||||
components: {
|
||||
App: defineComponent({})
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
provide(): any {
|
||||
return {
|
||||
fetchData: this.fetchData
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
fetchData() {
|
||||
throw new Error('Not implemented.')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user