diff --git a/packages/runtime-core/src/componentPublicInstance.ts b/packages/runtime-core/src/componentPublicInstance.ts index 2205e1ae484..28814527150 100644 --- a/packages/runtime-core/src/componentPublicInstance.ts +++ b/packages/runtime-core/src/componentPublicInstance.ts @@ -107,7 +107,7 @@ export type ComponentPublicInstanceConstructor< __isFragment?: never __isTeleport?: never __isSuspense?: never - new (): T + new (...args: any[]): T } export type CreateComponentPublicInstance< diff --git a/packages/runtime-core/src/h.ts b/packages/runtime-core/src/h.ts index d1fe4f0aceb..1939475b4ef 100644 --- a/packages/runtime-core/src/h.ts +++ b/packages/runtime-core/src/h.ts @@ -65,7 +65,7 @@ interface Constructor
{ __isFragment?: never __isTeleport?: never __isSuspense?: never - new (): { $props: P } + new (...args: any[]): { $props: P } } // The following is a series of overloads for providing props validation of diff --git a/test-dts/defineComponent.test-d.tsx b/test-dts/defineComponent.test-d.tsx index cd08a428893..18c3338abeb 100644 --- a/test-dts/defineComponent.test-d.tsx +++ b/test-dts/defineComponent.test-d.tsx @@ -701,6 +701,16 @@ describe('defineComponent', () => { components: { comp } }) }) + + test('should accept class components with receiving constructor arguments', () => { + class Comp { + static __vccOpts = {} + constructor(_props: { foo: string }) {} + } + defineComponent({ + components: { Comp } + }) + }) }) describe('emits', () => {