1- export type PluginBuilder < I , A1 = undefined , A2 = undefined , A3 = undefined , A4 = undefined > = ( arg1 ?: A1 , arg2 ?: A2 , arg3 ?: A3 , arg4 ?: A4 ) => Plugin < I >
1+ export type PluginBuilder < I , Args extends any [ ] > = ( ... args : Args ) => Plugin < I >
22import Nock = require( 'nock' )
33
44export interface Context {
55 test : ( typeof it | typeof it . skip )
6- plugins : { [ k : string ] : PluginBuilder < any , any , any , any , any > }
6+ plugins : { [ k : string ] : PluginBuilder < any , any > }
77 expectation ?: string
88 chain : Plugin < any > [ ]
99 error ?: Error & { code ?: string }
@@ -20,10 +20,7 @@ export interface Plugin<I> {
2020
2121export interface PluginDef {
2222 output : object
23- a1 : any
24- a2 : any
25- a3 : any
26- a4 : any
23+ args : any [ ]
2724}
2825
2926export interface Plugins { [ k : string ] : PluginDef }
@@ -48,8 +45,8 @@ export type Base<I extends Context, T extends Plugins> = {
4845 add < K extends string , O > ( key : K , cb : ( ( context : I ) => Promise < O > | O ) | Promise < O > | O ) : Base < I & { [ P in K ] : O } , T >
4946 do < O > ( cb : ( context : I & O ) => any ) : Base < O & I , T >
5047 finally ( cb : ( context : I ) => any ) : Base < I , T >
51- register < K extends string , O , A1 , A2 , A3 , A4 > ( key : K , plugin : ( arg1 ?: A1 , arg2 ?: A2 , arg3 ?: A3 , arg4 ?: A4 ) => Plugin < O & I > ) : Base < I , T & { [ P in K ] : { output : O , a1 : A1 , a2 : A2 , a3 : A3 , a4 : A4 } } >
52- } & { [ P in keyof T ] : ( arg1 ? : T [ P ] [ 'a1' ] , arg2 ?: T [ P ] [ 'a2' ] , arg3 ?: T [ P ] [ 'a3' ] , arg4 ?: T [ P ] [ 'a4 '] ) => Base < T [ P ] [ 'output' ] & I , T > }
48+ register < K extends string , O , A extends any [ ] > ( key : K , plugin : ( ... args : A ) => Plugin < O & I > ) : Base < I , T & { [ P in K ] : { output : O , args : A } } >
49+ } & { [ P in keyof T ] : ( ... args : T [ P ] [ 'args ' ] ) => Base < T [ P ] [ 'output' ] & I , T > }
5350
5451export interface EnvOptions {
5552 clear ?: boolean
0 commit comments