diff --git a/packages/runtime-core/src/component.ts b/packages/runtime-core/src/component.ts index 21d4fe67..404bb15b 100644 --- a/packages/runtime-core/src/component.ts +++ b/packages/runtime-core/src/component.ts @@ -132,7 +132,7 @@ export const enum LifecycleHooks { ERROR_CAPTURED = 'ec' } -export interface SetupContext { +export interface SetupContext { attrs: Data slots: Slots emit: EmitFn diff --git a/test-dts/defineComponent.test-d.tsx b/test-dts/defineComponent.test-d.tsx index 009ddbf5..9063ef5d 100644 --- a/test-dts/defineComponent.test-d.tsx +++ b/test-dts/defineComponent.test-d.tsx @@ -7,7 +7,9 @@ import { createApp, expectError, expectType, - ComponentPublicInstance + ComponentPublicInstance, + ComponentOptions, + SetupContext } from './index' describe('with object props', () => { @@ -684,3 +686,10 @@ describe('emits', () => { instance.$emit('test', 1) instance.$emit('test') }) + +describe('componentOptions setup should be `SetupContext`', () => { + expect({} as ( + props: Record, + ctx: SetupContext + ) => any) +})