@@ -2,10 +2,9 @@ import { createDebugLogger } from 'rejoinder';
2
2
3
3
import { globalDebuggerNamespace } from 'universe+run:constant.ts' ;
4
4
5
- import type { Merge } from 'type-fest' ;
6
-
7
5
import type {
8
6
DefaultRunOptions ,
7
+ RunnerFactoryReturnType ,
9
8
RunOptions ,
10
9
RunReturnType
11
10
} from 'universe+run:types.ts' ;
@@ -186,42 +185,18 @@ export function runnerFactory<FactoryOptionsType extends RunOptions = DefaultRun
186
185
file : string ,
187
186
args ?: string [ ] ,
188
187
options ?: FactoryOptionsType
189
- ) {
188
+ ) : RunnerFactoryReturnType < FactoryOptionsType > {
190
189
// ? Hide these names from intellisense
191
190
const factoryArgs = args ;
192
191
const factoryOptions = options ;
193
192
194
- /**
195
- * Runs (executes) with respect to the factory parameters used to generate
196
- * this function.
197
- *
198
- * Additional arguments specified via `args` will be appended to the
199
- * corresponding factory parameter. On the other hand, additional options
200
- * specified via `options` will _overwrite_ corresponding factory options (via
201
- * `Object.assign`).
202
- *
203
- * Note that, by default (unless modified at the factory level), this
204
- * function:
205
- *
206
- * 1. Rejects on a non-zero exit code. Set `reject: false` to override this.
207
- *
208
- * 2. Coerces output to a string. Set `coerceOutputToString: false` (or
209
- * `lines: true`) to override this.
210
- */
211
- async function factoryRunner (
212
- args ?: string [ ] ,
213
- options ?: undefined
214
- ) : Promise < RunReturnType < FactoryOptionsType > > ;
215
- async function factoryRunner < LocalOptionsType extends RunOptions > (
193
+ return async function factoryRunner (
216
194
args ?: string [ ] ,
217
- options ?: LocalOptionsType
218
- ) : Promise < RunReturnType < Merge < FactoryOptionsType , LocalOptionsType > > > ;
219
- async function factoryRunner ( args ?: string [ ] , options ?: RunOptions ) : Promise < unknown > {
195
+ options ?: RunOptions
196
+ ) : Promise < RunReturnType < RunOptions > > {
220
197
return run ( file , [ ...( factoryArgs || [ ] ) , ...( args || [ ] ) ] , {
221
198
...factoryOptions ,
222
199
...options
223
200
} ) ;
224
- }
225
-
226
- return factoryRunner ;
201
+ } as RunnerFactoryReturnType < FactoryOptionsType > ;
227
202
}
0 commit comments