1
1
export declare namespace Base {
2
- interface Options { }
2
+ interface Options { }
3
3
}
4
4
5
5
declare type ApiExtension = {
@@ -23,33 +23,34 @@ declare type UnionToIntersection<Union> = (
23
23
declare type AnyFunction = ( ...args : any ) => any ;
24
24
declare type ReturnTypeOf < T extends AnyFunction | AnyFunction [ ] > =
25
25
T extends AnyFunction
26
- ? ReturnType < T >
27
- : T extends AnyFunction [ ]
28
- ? UnionToIntersection < Exclude < ReturnType < T [ number ] > , void > >
29
- : never ;
26
+ ? ReturnType < T >
27
+ : T extends AnyFunction [ ]
28
+ ? UnionToIntersection < Exclude < ReturnType < T [ number ] > , void > >
29
+ : never ;
30
30
31
31
type ClassWithPlugins = Constructor < any > & {
32
32
plugins : Plugin [ ] ;
33
33
} ;
34
34
35
35
type RemainingRequirements < PredefinedOptions > =
36
36
keyof PredefinedOptions extends never
37
- ? Base . Options
38
- : Omit < Base . Options , keyof PredefinedOptions >
37
+ ? Base . Options
38
+ : Omit < Base . Options , keyof PredefinedOptions >
39
39
40
40
type NonOptionalKeys < Obj > = {
41
- [ K in keyof Obj ] : { } extends Pick < Obj , K > ? never : K ;
41
+ [ K in keyof Obj ] : { } extends Pick < Obj , K > ? undefined : K ;
42
42
} [ keyof Obj ] ;
43
43
44
- type RequiredIfRemaining < PredefinedOptions , NowProvided > =
45
- NonOptionalKeys < RemainingRequirements < PredefinedOptions > > extends never
46
- ? [ ( Partial < Base . Options > & NowProvided ) ?]
47
- : [ Partial < Base . Options > & RemainingRequirements < PredefinedOptions > & NowProvided ] ;
44
+ type RequiredIfRemaining < PredefinedOptions , NowProvided > =
45
+ NonOptionalKeys < RemainingRequirements < PredefinedOptions > > extends undefined
46
+ ? [ ( Partial < Base . Options > & NowProvided ) ?]
47
+ : [ Partial < Base . Options > & RemainingRequirements < PredefinedOptions > & NowProvided ] ;
48
48
49
49
type ConstructorRequiringVersion < Class extends ClassWithPlugins , PredefinedOptions > = {
50
50
defaultOptions : PredefinedOptions ;
51
51
} & {
52
52
new < NowProvided > ( ...options : RequiredIfRemaining < PredefinedOptions , NowProvided > ) : Class & {
53
+ debugKeys : NonOptionalKeys < RemainingRequirements < PredefinedOptions > > ;
53
54
options : NowProvided & PredefinedOptions ;
54
55
} ;
55
56
} ;
@@ -79,9 +80,9 @@ export declare class Base<TOptions extends Base.Options = Base.Options> {
79
80
static plugin <
80
81
Class extends ClassWithPlugins ,
81
82
Plugins extends [ Plugin , ...Plugin [ ] ] ,
82
- > (
83
- this : Class ,
84
- ...plugins : Plugins ,
83
+ > (
84
+ this : Class ,
85
+ ...plugins : Plugins ,
85
86
) : Class & {
86
87
plugins : [ ...Class [ 'plugins' ] , ...Plugins ] ;
87
88
} & Constructor < UnionToIntersection < ReturnTypeOf < Plugins > > > ;
@@ -135,4 +136,4 @@ export declare class Base<TOptions extends Base.Options = Base.Options> {
135
136
136
137
constructor ( options : TOptions ) ;
137
138
}
138
- export { } ;
139
+ export { } ;
0 commit comments