@@ -8,12 +8,12 @@ import { AsyncSeriesBailHook, AsyncSeriesHook, SyncHook } from "tapable";
8
8
9
9
declare interface BaseResolveRequest {
10
10
path : string | false ;
11
- descriptionFilePath ?: undefined | string ;
12
- descriptionFileRoot ?: undefined | string ;
11
+ descriptionFilePath ?: string ;
12
+ descriptionFileRoot ?: string ;
13
13
descriptionFileData ?: any ;
14
- relativePath ?: undefined | string ;
15
- ignoreSymlinks ?: undefined | boolean ;
16
- fullySpecified ?: undefined | boolean ;
14
+ relativePath ?: string ;
15
+ ignoreSymlinks ?: boolean ;
16
+ fullySpecified ?: boolean ;
17
17
}
18
18
declare class CachedInputFileSystem {
19
19
constructor ( fileSystem ?: any , duration ?: any ) ;
@@ -77,12 +77,10 @@ declare interface FileSystem {
77
77
arg2 : FileSystemCallback < ( string | Buffer ) [ ] | FileSystemDirent [ ] >
78
78
) : void ;
79
79
} ;
80
- readJson ?:
81
- | undefined
82
- | {
83
- ( arg0 : string , arg1 : FileSystemCallback < any > ) : void ;
84
- ( arg0 : string , arg1 : any , arg2 : FileSystemCallback < any > ) : void ;
85
- } ;
80
+ readJson ?: {
81
+ ( arg0 : string , arg1 : FileSystemCallback < any > ) : void ;
82
+ ( arg0 : string , arg1 : any , arg2 : FileSystemCallback < any > ) : void ;
83
+ } ;
86
84
readlink : {
87
85
( arg0 : string , arg1 : FileSystemCallback < string | Buffer > ) : void ;
88
86
( arg0 : string , arg1 : any , arg2 : FileSystemCallback < string | Buffer > ) : void ;
@@ -93,10 +91,7 @@ declare interface FileSystem {
93
91
} ;
94
92
}
95
93
declare interface FileSystemCallback < T > {
96
- (
97
- err : undefined | null | ( PossibleFileSystemError & Error ) ,
98
- result ?: undefined | T
99
- ) : any ;
94
+ ( err ?: null | ( PossibleFileSystemError & Error ) , result ?: T ) : any ;
100
95
}
101
96
declare interface FileSystemDirent {
102
97
name : string | Buffer ;
@@ -125,48 +120,48 @@ declare interface PnpApiImpl {
125
120
resolveToUnqualified : ( arg0 : string , arg1 : string , arg2 ?: any ) => string ;
126
121
}
127
122
declare interface PossibleFileSystemError {
128
- code ?: undefined | string ;
129
- errno ?: undefined | number ;
130
- path ?: undefined | string ;
131
- syscall ?: undefined | string ;
123
+ code ?: string ;
124
+ errno ?: number ;
125
+ path ?: string ;
126
+ syscall ?: string ;
132
127
}
133
128
134
129
/**
135
130
* Resolve context
136
131
*/
137
132
declare interface ResolveContext {
138
- contextDependencies ?: undefined | { add : ( T ?: any ) => void } ;
133
+ contextDependencies ?: { add : ( T ?: any ) => void } ;
139
134
140
135
/**
141
136
* files that was found on file system
142
137
*/
143
- fileDependencies ?: undefined | { add : ( T ?: any ) => void } ;
138
+ fileDependencies ?: { add : ( T ?: any ) => void } ;
144
139
145
140
/**
146
141
* dependencies that was not found on file system
147
142
*/
148
- missingDependencies ?: undefined | { add : ( T ?: any ) => void } ;
143
+ missingDependencies ?: { add : ( T ?: any ) => void } ;
149
144
150
145
/**
151
146
* set of hooks' calls. For instance, `resolve → parsedResolve → describedResolve`,
152
147
*/
153
- stack ?: undefined | Set < string > ;
148
+ stack ?: Set < string > ;
154
149
155
150
/**
156
151
* log function
157
152
*/
158
- log ?: undefined | ( ( arg0 : string ) => void ) ;
153
+ log ?: ( arg0 : string ) => void ;
159
154
}
160
155
declare interface ResolveOptions {
161
156
alias : {
162
157
alias : string | false | string [ ] ;
163
158
name : string ;
164
- onlyModule ?: undefined | boolean ;
159
+ onlyModule ?: boolean ;
165
160
} [ ] ;
166
161
fallback : {
167
162
alias : string | false | string [ ] ;
168
163
name : string ;
169
- onlyModule ?: undefined | boolean ;
164
+ onlyModule ?: boolean ;
170
165
} [ ] ;
171
166
aliasFields : Set < string | string [ ] > ;
172
167
cachePredicate : (
@@ -186,7 +181,7 @@ declare interface ResolveOptions {
186
181
fileSystem : FileSystem ;
187
182
unsafeCache : any ;
188
183
symlinks : boolean ;
189
- resolver ?: undefined | Resolver ;
184
+ resolver ?: Resolver ;
190
185
modules : ( string | string [ ] ) [ ] ;
191
186
mainFields : { name : string [ ] ; forceRelative : boolean } [ ] ;
192
187
mainFiles : Set < string > ;
@@ -256,8 +251,8 @@ declare abstract class Resolver {
256
251
resolveContext : ResolveContext ,
257
252
callback : (
258
253
arg0 : null | Error ,
259
- arg1 : undefined | string | false ,
260
- arg2 : undefined | ( BaseResolveRequest & Partial < ParsedIdentifier > )
254
+ arg1 ?: string | false ,
255
+ arg2 ?: BaseResolveRequest & Partial < ParsedIdentifier >
261
256
) => void
262
257
) : void ;
263
258
doResolve (
@@ -279,72 +274,70 @@ declare interface UserResolveOptions {
279
274
* A list of module alias configurations or an object which maps key to value
280
275
*/
281
276
alias ?:
282
- | undefined
283
277
| { [ index : string ] : string | false | string [ ] }
284
278
| {
285
279
alias : string | false | string [ ] ;
286
280
name : string ;
287
- onlyModule ?: undefined | boolean ;
281
+ onlyModule ?: boolean ;
288
282
} [ ] ;
289
283
290
284
/**
291
285
* A list of module alias configurations or an object which maps key to value, applied only after modules option
292
286
*/
293
287
fallback ?:
294
- | undefined
295
288
| { [ index : string ] : string | false | string [ ] }
296
289
| {
297
290
alias : string | false | string [ ] ;
298
291
name : string ;
299
- onlyModule ?: undefined | boolean ;
292
+ onlyModule ?: boolean ;
300
293
} [ ] ;
301
294
302
295
/**
303
296
* A list of alias fields in description files
304
297
*/
305
- aliasFields ?: undefined | ( string | string [ ] ) [ ] ;
298
+ aliasFields ?: ( string | string [ ] ) [ ] ;
306
299
307
300
/**
308
301
* A function which decides whether a request should be cached or not. An object is passed with at least `path` and `request` properties.
309
302
*/
310
- cachePredicate ?:
311
- | undefined
312
- | ( ( arg0 : BaseResolveRequest & Partial < ParsedIdentifier > ) => boolean ) ;
303
+ cachePredicate ?: (
304
+ arg0 : BaseResolveRequest & Partial < ParsedIdentifier >
305
+ ) => boolean ;
313
306
314
307
/**
315
308
* Whether or not the unsafeCache should include request context as part of the cache key.
316
309
*/
317
- cacheWithContext ?: undefined | boolean ;
310
+ cacheWithContext ?: boolean ;
318
311
319
312
/**
320
313
* A list of description files to read from
321
314
*/
322
- descriptionFiles ?: undefined | string [ ] ;
315
+ descriptionFiles ?: string [ ] ;
323
316
324
317
/**
325
318
* A list of exports field condition names.
326
319
*/
327
- conditionNames ?: undefined | string [ ] ;
320
+ conditionNames ?: string [ ] ;
328
321
329
322
/**
330
323
* Enforce that a extension from extensions must be used
331
324
*/
332
- enforceExtension ?: undefined | boolean ;
325
+ enforceExtension ?: boolean ;
333
326
334
327
/**
335
328
* A list of exports fields in description files
336
329
*/
337
- exportsFields ?: undefined | ( string | string [ ] ) [ ] ;
330
+ exportsFields ?: ( string | string [ ] ) [ ] ;
338
331
339
332
/**
340
333
* A list of imports fields in description files
341
334
*/
342
- importsFields ?: undefined | ( string | string [ ] ) [ ] ;
335
+ importsFields ?: ( string | string [ ] ) [ ] ;
343
336
344
337
/**
345
338
* A list of extensions which should be tried for files
346
339
*/
347
- extensions ?: undefined | string [ ] ;
340
+ extensions ?: string [ ] ;
348
341
349
342
/**
350
343
* The file system which should be used
@@ -359,73 +352,69 @@ declare interface UserResolveOptions {
359
352
/**
360
353
* Resolve symlinks to their symlinked location
361
354
*/
362
- symlinks ?: undefined | boolean ;
355
+ symlinks ?: boolean ;
363
356
364
357
/**
365
358
* A prepared Resolver to which the plugins are attached
366
359
*/
367
- resolver ?: undefined | Resolver ;
360
+ resolver ?: Resolver ;
368
361
369
362
/**
370
363
* A list of directories to resolve modules from, can be absolute path or folder name
371
364
*/
372
- modules ?: undefined | string | string [ ] ;
365
+ modules ?: string | string [ ] ;
373
366
374
367
/**
375
368
* A list of main fields in description files
376
369
*/
377
- mainFields ?:
378
- | undefined
379
- | (
380
- | string
381
- | string [ ]
382
- | { name : string | string [ ] ; forceRelative : boolean }
383
- ) [ ] ;
370
+ mainFields ?: (
371
+ | string
372
+ | string [ ]
373
+ | { name : string | string [ ] ; forceRelative : boolean }
374
+ ) [ ] ;
384
375
385
376
/**
386
377
* A list of main files in directories
387
378
*/
388
- mainFiles ?: undefined | string [ ] ;
379
+ mainFiles ?: string [ ] ;
389
380
390
381
/**
391
382
* A list of additional resolve plugins which should be applied
392
383
*/
393
- plugins ?:
394
- | undefined
395
- | (
396
- | { apply : ( arg0 : Resolver ) => void }
397
- | ( ( this : Resolver , arg1 : Resolver ) => void )
398
- ) [ ] ;
384
+ plugins ?: (
385
+ | { apply : ( arg0 : Resolver ) => void }
386
+ | ( ( this : Resolver , arg1 : Resolver ) => void )
387
+ ) [ ] ;
399
388
400
389
/**
401
390
* A PnP API that should be used - null is "never", undefined is "auto"
402
391
*/
403
- pnpApi ?: undefined | null | PnpApiImpl ;
392
+ pnpApi ?: null | PnpApiImpl ;
404
393
405
394
/**
406
395
* A list of root paths
407
396
*/
408
- roots ?: undefined | string [ ] ;
397
+ roots ?: string [ ] ;
409
398
410
399
/**
411
400
* The request is already fully specified and no extensions or directories are resolved for it
412
401
*/
413
- fullySpecified ?: undefined | boolean ;
402
+ fullySpecified ?: boolean ;
414
403
415
404
/**
416
405
* Resolve to a context instead of a file
417
406
*/
418
- resolveToContext ?: undefined | boolean ;
407
+ resolveToContext ?: boolean ;
419
408
420
409
/**
421
410
* A list of resolve restrictions
422
411
*/
423
- restrictions ?: undefined | ( string | RegExp ) [ ] ;
412
+ restrictions ?: ( string | RegExp ) [ ] ;
424
413
425
414
/**
426
415
* Use only the sync constiants of the file system calls
427
416
*/
428
- useSyncFileSystemCalls ?: undefined | boolean ;
417
+ useSyncFileSystemCalls ?: boolean ;
429
418
}
430
419
declare function exports (
431
420
context ?: any ,
0 commit comments