mirror of https://github.com/vuejs/core.git
fix(types): expose emits as props in functional components (#9234)
This commit is contained in:
parent
ad27473701
commit
887e54c347
|
|
@ -45,7 +45,7 @@ Bar.emits = {
|
|||
Bar.emits = { baz: () => void 0 }
|
||||
|
||||
// TSX
|
||||
expectType<JSX.Element>(<Bar foo={1} />)
|
||||
expectType<JSX.Element>(<Bar foo={1} onUpdate={() => {}} />)
|
||||
// @ts-expect-error
|
||||
;<Foo />
|
||||
// @ts-expect-error
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ import {
|
|||
ObjectEmitsOptions,
|
||||
EmitFn,
|
||||
emit,
|
||||
normalizeEmitsOptions
|
||||
normalizeEmitsOptions,
|
||||
EmitsToProps
|
||||
} from './componentEmits'
|
||||
import {
|
||||
EMPTY_OBJ,
|
||||
|
|
@ -131,7 +132,7 @@ export interface FunctionalComponent<
|
|||
> extends ComponentInternalOptions {
|
||||
// use of any here is intentional so it can be a valid JSX Element constructor
|
||||
(
|
||||
props: P,
|
||||
props: P & EmitsToProps<E>,
|
||||
ctx: Omit<SetupContext<E, IfAny<S, {}, SlotsType<S>>>, 'expose'>
|
||||
): any
|
||||
props?: ComponentPropsOptions<P>
|
||||
|
|
|
|||
Loading…
Reference in New Issue