Skip to content

Commit 6e4c9c8

Browse files
committedJul 15, 2023
typing openModal
1 parent 5bdf4e0 commit 6e4c9c8

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed
 

‎dist/vue-modal.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ declare type ModalStyle = {
4040

4141
export declare const ModalTarget: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{}>>, {}, {}>;
4242

43-
export declare function openModal(component: Component, props?: {}, options?: OpenModalOptions): Promise<unknown>;
43+
export declare function openModal<T = unknown>(component: Component, props?: {}, options?: OpenModalOptions): Promise<T>;
4444

4545
declare type OpenModalOptions = {
4646
force?: boolean;

‎lib/actions.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {addModal, state as stateData} from './data'
55
import {$emit, $off, $on} from './event'
66

77
/*, options?: Options*/
8-
export async function openModal(component: Component, props?: {}, options?: OpenModalOptions) {
8+
export async function openModal<T = unknown>(component: Component, props?: {}, options?: OpenModalOptions) {
99
if (options?.force && stateData.modals.length) {
1010
await closeAllModals(false)
1111
}
@@ -14,7 +14,7 @@ export async function openModal(component: Component, props?: {}, options?: Open
1414
addModal(component, props/*, options*/)
1515
$emit(Events.Open)
1616

17-
return new Promise((resolve, reject) => {
17+
return new Promise<T>((resolve, reject) => {
1818
function onClosed(data: any) {
1919
if (data.index === index) {
2020
$off(Events.Closed, onClosed)

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kolirt/vue-modal",
3-
"version": "0.0.9",
3+
"version": "0.0.10",
44
"description": "Simple Vue3 modal package",
55
"author": "kolirt",
66
"license": "MIT",

0 commit comments

Comments
 (0)
Please sign in to comment.