@@ -11,7 +11,7 @@ Return a default type if input type is nil.
11
11
@template T - Input type.
12
12
@template U - Default type.
13
13
*/
14
- type WithDefault < T , U extends T > = T extends undefined | void | null ? U : T ; // eslint-disable-line @typescript-eslint/ban-types
14
+ type WithDefault < T , U > = T extends undefined | void | null ? U : T ; // eslint-disable-line @typescript-eslint/ban-types
15
15
16
16
// TODO: Replace this with https://github.com/sindresorhus/type-fest/blob/main/source/includes.d.ts
17
17
/**
@@ -237,9 +237,9 @@ export default function camelcaseKeys<
237
237
options ?: OptionsType
238
238
) : CamelCaseKeys <
239
239
T ,
240
- WithDefault < OptionsType [ 'deep' ] , false > ,
241
- WithDefault < OptionsType [ 'pascalCase' ] , false > ,
242
- WithDefault < OptionsType [ 'preserveConsecutiveUppercase' ] , false > ,
243
- WithDefault < OptionsType [ 'exclude' ] , EmptyTuple > ,
244
- WithDefault < OptionsType [ 'stopPaths' ] , EmptyTuple >
240
+ WithDefault < 'deep' extends keyof OptionsType ? OptionsType [ 'deep' ] : undefined , false > ,
241
+ WithDefault < 'pascalCase' extends keyof OptionsType ? OptionsType [ 'pascalCase' ] : undefined , false > ,
242
+ WithDefault < 'preserveConsecutiveUppercase' extends keyof OptionsType ? OptionsType [ 'preserveConsecutiveUppercase' ] : undefined , false > ,
243
+ WithDefault < 'exclude' extends keyof OptionsType ? OptionsType [ 'exclude' ] : undefined , EmptyTuple > ,
244
+ WithDefault < 'stopPaths' extends keyof OptionsType ? OptionsType [ 'stopPaths' ] : undefined , EmptyTuple >
245
245
> ;
0 commit comments