Skip to content

Commit

Permalink
types(h): Support passing props to Component when using h (vuej…
Browse files Browse the repository at this point in the history
  • Loading branch information
pikax authored and chrislone committed Feb 4, 2023
1 parent 16128e1 commit c3f22c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/runtime-core/src/h.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions test-dts/h.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({})
Expand Down

0 comments on commit c3f22c4

Please sign in to comment.