diff --git a/packages/runtime-core/src/component.ts b/packages/runtime-core/src/component.ts index ee9ae1be5..cfc1a531b 100644 --- a/packages/runtime-core/src/component.ts +++ b/packages/runtime-core/src/component.ts @@ -110,7 +110,7 @@ export interface ClassComponent { __vccOpts: ComponentOptions } -export type Component = ComponentOptions | FunctionalComponent +export type Component = ComponentOptions | FunctionalComponent // A type used in public APIs where a component type is expected. // The constructor type is an artificial type returned by defineComponent(). diff --git a/test-dts/functionalComponent.test-d.tsx b/test-dts/functionalComponent.test-d.tsx index 6783fed61..c53c4287a 100644 --- a/test-dts/functionalComponent.test-d.tsx +++ b/test-dts/functionalComponent.test-d.tsx @@ -1,4 +1,9 @@ -import { FunctionalComponent, expectError, expectType } from './index' +import { + FunctionalComponent, + expectError, + expectType, + Component +} from './index' // simple function signature const Foo = (props: { foo: number }) => props.foo @@ -51,3 +56,10 @@ expectError() expectError() // @ts-expect-error expectError() + +const Baz: FunctionalComponent<{}, string[]> = (props, { emit }) => { + expectType<{}>(props) + expectType<(event: string) => void>(emit) +} + +expectType(Baz)