]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
types(h): Support passing `props` to `Component` when using `h` (#3219)
authorCarlos Rodrigues <carlos@hypermob.co.uk>
Wed, 26 Oct 2022 07:07:44 +0000 (08:07 +0100)
committerGitHub <noreply@github.com>
Wed, 26 Oct 2022 07:07:44 +0000 (03:07 -0400)
packages/runtime-core/src/h.ts
test-dts/h.test-d.ts

index 44f91340827dfc95a3a9898c91b22bd651776c83..520f568e7a80c67f146ec6a0500ccc61602dc18e 100644 (file)
@@ -141,9 +141,9 @@ export function h<P>(
 ): VNode
 
 // component without props
-export function h(
-  type: Component,
-  props: null,
+export function h<P>(
+  type: Component<P>,
+  props?: (RawProps & P) | null,
   children?: RawChildren | RawSlots
 ): VNode
 
index 5318f71fe9418c09931bcbc37602fb9e346fc16d..6116fff74a9f6b8f11edb522b2df27918e92a266 100644 (file)
@@ -145,12 +145,11 @@ describe('h inference w/ defineComponent', () => {
 //   expectError(h(Foo, { bar: 1, foo: 1 }))
 // })
 
-// #922
+// #922 and #3218
 describe('h support for generic component type', () => {
   function foo(bar: Component) {
     h(bar)
     h(bar, 'hello')
-    // @ts-expect-error
     h(bar, { id: 'ok' }, 'hello')
   }
   foo({})