1
1
export declare namespace Base {
2
- interface Options { }
2
+ interface Options { }
3
3
}
4
4
5
5
declare type ApiExtension = {
@@ -23,33 +23,43 @@ 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
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 undefined
44
+ type RequiredIfRemaining < PredefinedOptions , NowProvided > = NonOptionalKeys <
45
+ RemainingRequirements < PredefinedOptions >
46
+ > extends undefined
46
47
? [ ( Partial < Base . Options > & NowProvided ) ?]
47
- : [ Partial < Base . Options > & RemainingRequirements < PredefinedOptions > & NowProvided ] ;
48
+ : [
49
+ Partial < Base . Options > &
50
+ RemainingRequirements < PredefinedOptions > &
51
+ NowProvided
52
+ ] ;
48
53
49
- type ConstructorRequiringVersion < Class extends ClassWithPlugins , PredefinedOptions > = {
54
+ type ConstructorRequiringVersion <
55
+ Class extends ClassWithPlugins ,
56
+ PredefinedOptions
57
+ > = {
50
58
defaultOptions : PredefinedOptions ;
51
59
} & {
52
- new < NowProvided > ( ...options : RequiredIfRemaining < PredefinedOptions , NowProvided > ) : Class & {
60
+ new < NowProvided > (
61
+ ...options : RequiredIfRemaining < PredefinedOptions , NowProvided >
62
+ ) : Class & {
53
63
options : NowProvided & PredefinedOptions ;
54
64
} ;
55
65
} ;
@@ -78,12 +88,12 @@ export declare class Base<TOptions extends Base.Options = Base.Options> {
78
88
*/
79
89
static plugin <
80
90
Class extends ClassWithPlugins ,
81
- Plugins extends [ Plugin , ...Plugin [ ] ] ,
82
- > (
83
- this : Class ,
84
- ...plugins : Plugins ,
91
+ Plugins extends [ Plugin , ...Plugin [ ] ]
92
+ > (
93
+ this : Class ,
94
+ ...plugins : Plugins
85
95
) : Class & {
86
- plugins : [ ...Class [ ' plugins' ] , ...Plugins ] ;
96
+ plugins : [ ...Class [ " plugins" ] , ...Plugins ] ;
87
97
} & Constructor < UnionToIntersection < ReturnTypeOf < Plugins > > > ;
88
98
89
99
/**
@@ -104,7 +114,8 @@ export declare class Base<TOptions extends Base.Options = Base.Options> {
104
114
*/
105
115
static defaults <
106
116
PredefinedOptionsOne ,
107
- ClassOne extends Constructor < Base < Base . Options & PredefinedOptionsOne > > & ClassWithPlugins
117
+ ClassOne extends Constructor < Base < Base . Options & PredefinedOptionsOne > > &
118
+ ClassWithPlugins
108
119
> (
109
120
this : ClassOne ,
110
121
defaults : PredefinedOptionsOne
@@ -122,8 +133,12 @@ export declare class Base<TOptions extends Base.Options = Base.Options> {
122
133
) : ConstructorRequiringVersion <
123
134
ClassOne & ClassTwo & ClassThree ,
124
135
PredefinedOptionsOne & PredefinedOptionsTwo & PredefinedOptionsThree
125
- > & ClassOne & ClassTwo & ClassThree ;
126
- } & ClassOne & ClassTwo ;
136
+ > &
137
+ ClassOne &
138
+ ClassTwo &
139
+ ClassThree ;
140
+ } & ClassOne &
141
+ ClassTwo ;
127
142
} & ClassOne ;
128
143
129
144
static defaultOptions : { } ;
@@ -135,4 +150,4 @@ export declare class Base<TOptions extends Base.Options = Base.Options> {
135
150
136
151
constructor ( options : TOptions ) ;
137
152
}
138
- export { } ;
153
+ export { } ;
0 commit comments