Skip to content

Commit fc2ec79

Browse files
committed
fix: fix the return types
1 parent 6333e84 commit fc2ec79

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

src/createSfx.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ export function createSfx(
128128
platform: string = 'win32',
129129
extension: string = '.exe'
130130
) {
131-
return when.promise(function (
132-
resolve: (arg0: string) => void,
133-
reject: (arg0: string) => void,
134-
progress: (arg0: any) => any
131+
return when.promise<string>(function (
132+
resolve: (sfx: string) => void,
133+
reject: (err: string) => void,
134+
progress: (data: any) => any
135135
) {
136136
let directory =
137137
destination != '' && fs.existsSync(destination)

src/index.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function retry(
2020
.progress(function (data: any) {
2121
return progress(onprogress(data));
2222
}) // When all is done resolve the Promise.
23-
.then(function (args: any) {
23+
.then(function (args: string[]) {
2424
return resolve(args);
2525
}) // Catch the error and pass it to the reject function of the Promise.
2626
.catch(function () {
@@ -29,7 +29,7 @@ function retry(
2929
.progress(function (data: any) {
3030
return progress(onprogress(data));
3131
})
32-
.then(function (args: any) {
32+
.then(function (args: string[]) {
3333
return resolve(args);
3434
})
3535
.catch(function (err: any) {
@@ -61,8 +61,8 @@ export const createArchive =
6161
options: any,
6262
override = false
6363
) {
64-
return when.promise(function (
65-
resolve: (value: any) => void,
64+
return when.promise<string[]>(function (
65+
resolve: (args: string[]) => void,
6666
reject: (reason: any) => void,
6767
progress: (arg0: any) => any
6868
) {
@@ -125,7 +125,7 @@ export const deleteArchive =
125125
options: { files?: string[] | undefined } | undefined,
126126
override = false
127127
) {
128-
return new Promise(function (resolve, reject) {
128+
return new Promise<string[]>(function (resolve, reject) {
129129
// Convert array of files into a string if needed.
130130
files = Files(files);
131131
// Create a string that can be parsed by `run`.
@@ -173,8 +173,8 @@ export const extractArchive =
173173
options = {},
174174
override = false
175175
) {
176-
return when.promise(function (
177-
resolve: (value: any) => void,
176+
return when.promise<string[]>(function (
177+
resolve: (args: string[]) => void,
178178
reject: (reason: any) => void,
179179
progress: (arg0: any) => any
180180
) {
@@ -236,8 +236,8 @@ export const fullArchive =
236236
options = {},
237237
override = false
238238
) {
239-
return when.promise(function (
240-
resolve: (value: any) => void,
239+
return when.promise<string[]>(function (
240+
resolve: (args: string[]) => void,
241241
reject: (reason: any) => void,
242242
progress: (arg0: any) => any
243243
) {
@@ -296,8 +296,8 @@ export const listArchive =
296296
options: { files?: string[] | undefined } | undefined,
297297
override = false
298298
) {
299-
return when.promise(function (
300-
resolve: (value: any) => void,
299+
return when.promise<Record<string, any>>(function (
300+
resolve: (spec: Record<string, any>) => void,
301301
reject: (reason: any) => void,
302302
progress: (arg0: any) => any
303303
) {
@@ -424,8 +424,8 @@ export const onlyArchive =
424424
options = {},
425425
override = false
426426
) {
427-
return when.promise(function (
428-
resolve: (value: any) => void,
427+
return when.promise<string[]>(function (
428+
resolve: (args: string[]) => void,
429429
reject: (reason: any) => void,
430430
progress: (arg0: any) => any
431431
) {
@@ -491,8 +491,8 @@ export const renameArchive =
491491
options: {},
492492
override = false
493493
) {
494-
return when.promise(function (
495-
resolve: (value: any) => void,
494+
return when.promise<string[]>(function (
495+
resolve: (args: string[]) => void,
496496
reject: (reason: any) => void,
497497
progress: (arg0: any) => any
498498
) {
@@ -550,8 +550,8 @@ export const testArchive =
550550
(SevenZip.testArchive =
551551
SevenZip.test =
552552
function (filepath: string, options: {}, override = false) {
553-
return when.promise(function (
554-
resolve: (value: any) => void,
553+
return when.promise<string[]>(function (
554+
resolve: (args: string[]) => void,
555555
reject: (reason: any) => void,
556556
progress: (arg0: any) => any
557557
) {
@@ -613,8 +613,8 @@ export const updateArchive =
613613
options: {},
614614
override = false
615615
) {
616-
return when.promise(function (
617-
resolve: (value: any) => void,
616+
return when.promise<string[]>(function (
617+
resolve: (args: string[]) => void,
618618
reject: (reason: any) => void,
619619
progress: (arg0: any) => any
620620
) {

src/utility.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export function Run(
8585
switches: { files?: string[] } = {},
8686
override: boolean = false
8787
) {
88-
return when.promise(function (
88+
return when.promise<string[]>(function (
8989
fulfill: (arg0: string[]) => void,
9090
reject: (arg0: Error) => void,
9191
progress: (arg0: any) => void

0 commit comments

Comments
 (0)