File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 1
1
import type { Component } from 'vue'
2
2
import { reactive , markRaw , shallowReactive } from 'vue'
3
3
import { createSharedComposable } from '@vueuse/core'
4
- import type { ComponentProps } from 'vue-component-type-helpers'
4
+ import type { ComponentProps , ComponentEmit } from 'vue-component-type-helpers'
5
+
6
+ // Extracts the first argument of the close event
7
+ type CloseEventArgType < T > = T extends ( event : 'close' , args_0 : infer R ) => void ? R : never
5
8
6
9
export type OverlayOptions < OverlayAttrs = Record < string , any > > = {
7
10
defaultOpen ?: boolean
@@ -19,7 +22,7 @@ type ManagedOverlayOptionsPrivate<T extends Component> = {
19
22
export type Overlay = OverlayOptions < Component > & ManagedOverlayOptionsPrivate < Component >
20
23
21
24
interface OverlayInstance < T > {
22
- open : ( props ?: ComponentProps < T > ) => Promise < any >
25
+ open : ( props ?: ComponentProps < T > ) => Promise < CloseEventArgType < ComponentEmit < T > > >
23
26
close : ( value ?: any ) => void
24
27
patch : ( props : Partial < ComponentProps < T > > ) => void
25
28
}
You can’t perform that action at this time.
0 commit comments