types: fix createComponent spec
This commit is contained in:
parent
b5384006d2
commit
8a01c8e549
@ -1,5 +1,5 @@
|
|||||||
import { createComponent } from '../src/component'
|
import { createComponent } from '../src/component'
|
||||||
import { value } from '@vue/reactivity'
|
import { ref } from '@vue/reactivity'
|
||||||
import { PropType } from '../src/componentProps'
|
import { PropType } from '../src/componentProps'
|
||||||
|
|
||||||
// mock React just for TSX testing purposes
|
// mock React just for TSX testing purposes
|
||||||
@ -35,9 +35,9 @@ test('createComponent type inference', () => {
|
|||||||
props.cc && props.cc.push('hoo')
|
props.cc && props.cc.push('hoo')
|
||||||
props.dd.push('dd')
|
props.dd.push('dd')
|
||||||
return {
|
return {
|
||||||
c: value(1),
|
c: ref(1),
|
||||||
d: {
|
d: {
|
||||||
e: value('hi')
|
e: ref('hi')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -125,8 +125,8 @@ export type ComponentInstance<P = Data, S = Data> = {
|
|||||||
// overload 1: direct setup function
|
// overload 1: direct setup function
|
||||||
// (uses user defined props interface)
|
// (uses user defined props interface)
|
||||||
export function createComponent<Props>(
|
export function createComponent<Props>(
|
||||||
setup: (props: Props, ctx: SetupContext) => (() => unknown)
|
setup: (props: Props, ctx: SetupContext) => object | (() => VNodeChild)
|
||||||
): (props: Props) => unknown
|
): (props: Props) => any
|
||||||
// overload 2: object format with no props
|
// overload 2: object format with no props
|
||||||
// (uses user defined props interface)
|
// (uses user defined props interface)
|
||||||
// return type is for Vetur and TSX support
|
// return type is for Vetur and TSX support
|
||||||
|
Loading…
Reference in New Issue
Block a user