parent
17c50ce18d
commit
8dcb6c7bbd
|
@ -103,7 +103,7 @@ export function defineComponent<
|
|||
M extends MethodOptions = {},
|
||||
Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
|
||||
Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
|
||||
E extends EmitsOptions = EmitsOptions,
|
||||
E extends EmitsOptions = {},
|
||||
EE extends string = string
|
||||
>(
|
||||
options: ComponentOptionsWithoutProps<
|
||||
|
@ -130,7 +130,7 @@ export function defineComponent<
|
|||
M extends MethodOptions = {},
|
||||
Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
|
||||
Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
|
||||
E extends EmitsOptions = Record<string, any>,
|
||||
E extends EmitsOptions = {},
|
||||
EE extends string = string
|
||||
>(
|
||||
options: ComponentOptionsWithArrayProps<
|
||||
|
@ -168,7 +168,7 @@ export function defineComponent<
|
|||
M extends MethodOptions = {},
|
||||
Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
|
||||
Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
|
||||
E extends EmitsOptions = Record<string, any>,
|
||||
E extends EmitsOptions = {},
|
||||
EE extends string = string
|
||||
>(
|
||||
options: ComponentOptionsWithObjectProps<
|
||||
|
|
|
@ -1163,6 +1163,38 @@ describe('should allow to assign props', () => {
|
|||
expectType<JSX.Element>(<Parent {...child.$props} />)
|
||||
})
|
||||
|
||||
// #6052
|
||||
describe('prop starting with `on*` is broken', () => {
|
||||
defineComponent({
|
||||
props: {
|
||||
onX: {
|
||||
type: Function as PropType<(a: 1) => void>,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
setup(props) {
|
||||
expectType<(a: 1) => void>(props.onX)
|
||||
props.onX(1)
|
||||
}
|
||||
})
|
||||
|
||||
defineComponent({
|
||||
props: {
|
||||
onX: {
|
||||
type: Function as PropType<(a: 1) => void>,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
emits: {
|
||||
test: (a: 1) => true
|
||||
},
|
||||
setup(props) {
|
||||
expectType<(a: 1) => void>(props.onX)
|
||||
expectType<undefined | ((a: 1) => any)>(props.onTest)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// check if defineComponent can be exported
|
||||
export default {
|
||||
// function components
|
||||
|
@ -1209,5 +1241,4 @@ declare const MyButton: DefineComponent<
|
|||
Readonly<ExtractPropTypes<{}>>,
|
||||
{}
|
||||
>
|
||||
|
||||
;<MyButton class="x" />
|
||||
|
|
Loading…
Reference in New Issue