]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
types: fix createComponent spec
authorEvan You <yyx990803@gmail.com>
Wed, 21 Aug 2019 21:10:37 +0000 (17:10 -0400)
committerEvan You <yyx990803@gmail.com>
Wed, 21 Aug 2019 21:10:37 +0000 (17:10 -0400)
packages/runtime-core/__tests__/createComponent.spec.tsx
packages/runtime-core/src/component.ts

index 7c81aadf1c68c3bc7a043d7f4a4f70fb50330ab0..9e7420ae6cebc27c8e27f9d85de225b2d5271da8 100644 (file)
@@ -1,5 +1,5 @@
 import { createComponent } from '../src/component'
-import { value } from '@vue/reactivity'
+import { ref } from '@vue/reactivity'
 import { PropType } from '../src/componentProps'
 
 // mock React just for TSX testing purposes
@@ -35,9 +35,9 @@ test('createComponent type inference', () => {
       props.cc && props.cc.push('hoo')
       props.dd.push('dd')
       return {
-        c: value(1),
+        c: ref(1),
         d: {
-          e: value('hi')
+          e: ref('hi')
         }
       }
     },
index 7268d83d9061c785f6645441b0daf31c92ac9228..b4008d7e63bba7663dc4337f5f95742d1ae5b04a 100644 (file)
@@ -125,8 +125,8 @@ export type ComponentInstance<P = Data, S = Data> = {
 // overload 1: direct setup function
 // (uses user defined props interface)
 export function createComponent<Props>(
-  setup: (props: Props, ctx: SetupContext) => (() => unknown)
-): (props: Props) => unknown
+  setup: (props: Props, ctx: SetupContext) => object | (() => VNodeChild)
+): (props: Props) => any
 // overload 2: object format with no props
 // (uses user defined props interface)
 // return type is for Vetur and TSX support