From: Carlos Rodrigues Date: Wed, 26 Oct 2022 07:07:44 +0000 (+0100) Subject: types(h): Support passing `props` to `Component` when using `h` (#3219) X-Git-Tag: v3.2.42~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e792d93a8062e29d9da279eee2202f38897f42f;p=thirdparty%2Fvuejs%2Fcore.git types(h): Support passing `props` to `Component` when using `h` (#3219) --- diff --git a/packages/runtime-core/src/h.ts b/packages/runtime-core/src/h.ts index 44f9134082..520f568e7a 100644 --- a/packages/runtime-core/src/h.ts +++ b/packages/runtime-core/src/h.ts @@ -141,9 +141,9 @@ export function h

( ): VNode // component without props -export function h( - type: Component, - props: null, +export function h

( + type: Component

, + props?: (RawProps & P) | null, children?: RawChildren | RawSlots ): VNode diff --git a/test-dts/h.test-d.ts b/test-dts/h.test-d.ts index 5318f71fe9..6116fff74a 100644 --- a/test-dts/h.test-d.ts +++ b/test-dts/h.test-d.ts @@ -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({})