mirror of https://github.com/vuejs/core.git
test(types): component type check when props is an empty object (#7419)
ref #4051 ref #8825
This commit is contained in:
parent
d875de54e9
commit
d6ccce9049
|
@ -480,6 +480,26 @@ describe('type inference w/ options API', () => {
|
|||
})
|
||||
})
|
||||
|
||||
// #4051
|
||||
describe('type inference w/ empty prop object', () => {
|
||||
const MyComponent = defineComponent({
|
||||
props: {},
|
||||
setup(props) {
|
||||
return {}
|
||||
},
|
||||
render() {},
|
||||
})
|
||||
expectType<JSX.Element>(<MyComponent />)
|
||||
// AllowedComponentProps
|
||||
expectType<JSX.Element>(<MyComponent class={'foo'} />)
|
||||
// ComponentCustomProps
|
||||
expectType<JSX.Element>(<MyComponent custom={1} />)
|
||||
// VNodeProps
|
||||
expectType<JSX.Element>(<MyComponent key="1" />)
|
||||
// @ts-expect-error
|
||||
expectError(<MyComponent other="other" />)
|
||||
})
|
||||
|
||||
describe('with mixins', () => {
|
||||
const MixinA = defineComponent({
|
||||
emits: ['bar'],
|
||||
|
|
Loading…
Reference in New Issue