@@ -30,7 +30,14 @@ import type {
3030import { warn } from './warning'
3131import type { SlotsType , StrictUnwrapSlotsType } from './componentSlots'
3232import type { Ref } from '@vue/reactivity'
33- import type { CreateComponentPublicInstanceWithMixins } from './componentPublicInstance'
33+ import type {
34+ ComponentPublicInstance ,
35+ EnsureNonVoid ,
36+ ExtractMixinComputed ,
37+ ExtractMixinData ,
38+ ExtractMixinMethods ,
39+ ExtractMixinSetupBindings ,
40+ } from './componentPublicInstance'
3441
3542// dev only
3643const warnRuntimeUsage = ( method : string ) =>
@@ -189,27 +196,28 @@ export function defineExpose<
189196 * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineoptions }
190197 */
191198export function defineOptions <
199+ RawBindings = { } ,
192200 D = { } ,
193201 C extends ComputedOptions = { } ,
194202 M extends MethodOptions = { } ,
195203 Mixin = { } ,
196204 Extends = { } ,
197- DataVM = CreateComponentPublicInstanceWithMixins <
198- { } ,
199- { } ,
205+ InternalInstance = ComponentPublicInstance <
200206 { } ,
201- { } ,
202- MethodOptions ,
203- Mixin ,
204- Extends
207+ ExtractMixinSetupBindings < Mixin > &
208+ ExtractMixinSetupBindings < Extends > &
209+ RawBindings ,
210+ ExtractMixinData < Mixin > & ExtractMixinData < Extends > & EnsureNonVoid < D > ,
211+ ExtractMixinComputed < Mixin > & ExtractMixinComputed < Extends > & C ,
212+ ExtractMixinMethods < Mixin > & ExtractMixinMethods < Extends > & M
205213 > ,
206214> (
207215 options ?: {
208216 computed ?: C
209217 methods ?: M
210218 mixins ?: Mixin [ ]
211219 extends ?: Extends
212- data ?: ( this : DataVM , vm : DataVM ) => D
220+ data ?: ( vm : NoInfer < InternalInstance > ) => D
213221 /**
214222 * setup should be defined via `<script setup>`.
215223 */
@@ -230,7 +238,12 @@ export function defineOptions<
230238 * slots should be defined via defineSlots().
231239 */
232240 slots ?: never
233- } & ComponentStaticOptions ,
241+ } & ComponentStaticOptions &
242+ ThisType <
243+ NoInfer < InternalInstance > & {
244+ $options : typeof options
245+ }
246+ > ,
234247) : void {
235248 if ( __DEV__ ) {
236249 warnRuntimeUsage ( `defineOptions` )
0 commit comments