Skip to content

Commit

Permalink
fix: fix typings portable issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tianyingchun committed Jun 13, 2024
1 parent 3f82c39 commit ad10fb9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/spicy-mails-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hyperse/exec-program": patch
---

fix typings portable issue
4 changes: 2 additions & 2 deletions src/exec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { execa } from 'execa';
import { ExecOptions } from './types.js';
import { ExecOptions, ExecResultPromise } from './types.js';

/**
* Execute a file with arguments and options
Expand Down Expand Up @@ -31,6 +31,6 @@ export function exec<T extends ExecOptions>(
file: string,
args?: readonly string[],
options?: T
) {
): ExecResultPromise<{} & T> {
return execa(file, args, options);
}
4 changes: 2 additions & 2 deletions src/runTsScript.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { execa } from 'execa';
import { ExecOptions } from './types.js';
import { ExecOptions, ExecResultPromise } from './types.js';

/**
* Process execute typescript script file using `@hyperse/ts-node-paths`
Expand All @@ -11,7 +11,7 @@ export const runTsScript = <T extends ExecOptions>(
program: string,
args?: readonly string[],
options?: T
) => {
): ExecResultPromise<{} & T> => {
const moduleArgs = [
'--import',
'@hyperse/ts-node-paths/register',
Expand Down
3 changes: 2 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Options } from 'execa';
import type { Options, ResultPromise } from 'execa';

export type ExecOptions = Options;
export type ExecResultPromise<T extends Options = Options> = ResultPromise<T>;

0 comments on commit ad10fb9

Please sign in to comment.