@@ -6,7 +6,8 @@ import {
|
||||
ref,
|
||||
Fragment,
|
||||
Teleport,
|
||||
Suspense
|
||||
Suspense,
|
||||
Component
|
||||
} from './index'
|
||||
|
||||
describe('h inference w/ element', () => {
|
||||
@@ -58,17 +59,15 @@ describe('h inference w/ functional component', () => {
|
||||
expectError(h(Func, { bar: 123 }))
|
||||
})
|
||||
|
||||
describe('h inference w/ plain object component', () => {
|
||||
describe('h support w/ plain object component', () => {
|
||||
const Foo = {
|
||||
props: {
|
||||
foo: String
|
||||
}
|
||||
}
|
||||
|
||||
h(Foo, { foo: 'ok' })
|
||||
h(Foo, { foo: 'ok', class: 'extra' })
|
||||
// should fail on wrong type
|
||||
expectError(h(Foo, { foo: 1 }))
|
||||
// no inference in this case
|
||||
})
|
||||
|
||||
describe('h inference w/ defineComponent', () => {
|
||||
@@ -122,3 +121,13 @@ describe('h inference w/ defineComponent + direct function', () => {
|
||||
// should fail on wrong type
|
||||
expectError(h(Foo, { bar: 1, foo: 1 }))
|
||||
})
|
||||
|
||||
// #922
|
||||
describe('h support for generic component type', () => {
|
||||
function foo(bar: Component) {
|
||||
h(bar)
|
||||
h(bar, 'hello')
|
||||
h(bar, { id: 'ok' }, 'hello')
|
||||
}
|
||||
foo({})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user