Преглед изворни кода

types: fix createComponent type when using simple function (#334)

Dmitry Sharshakov пре 6 година
родитељ
комит
068902abec
1 измењених фајлова са 5 додато и 3 уклоњено
  1. 5 3
      packages/runtime-core/src/apiCreateComponent.ts

+ 5 - 3
packages/runtime-core/src/apiCreateComponent.ts

@@ -13,9 +13,11 @@ import { isFunction } from '@vue/shared'
 
 // overload 1: direct setup function
 // (uses user defined props interface)
-export function createComponent<Props>(
-  setup: (props: Props, ctx: SetupContext) => object | (() => VNodeChild)
-): (props: Props) => any
+export function createComponent<Props, RawBindings = object>(
+  setup: (props: Props, ctx: SetupContext) => RawBindings | (() => VNodeChild)
+): {
+  new (): ComponentPublicInstance<Props, RawBindings>
+}
 
 // overload 2: object format with no props
 // (uses user defined props interface)