1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
=== tests/cases/compiler/declarationEmitShadowingInferNotRenamed.ts ===
// Any instance type
type Client = string
>Client : string
// Modified instance
type UpdatedClient<C> = C & {foo: number}
>UpdatedClient : UpdatedClient<C>
>foo : number
export const createClient = <
>createClient : <D extends Record<string, new (...args: any[]) => Client> | (new (...args: any[]) => Client)>(clientDef: D) => D extends new (...args: any[]) => infer C ? UpdatedClient<C> : { [K in keyof D]: D[K] extends new (...args: any[]) => infer C ? UpdatedClient<C> : never; }
>< D extends | (new (...args: any[]) => Client) // accept class | Record<string, new (...args: any[]) => Client> // or map of classes>( clientDef: D): D extends new (...args: any[]) => infer C ? UpdatedClient<C> // return instance : { [K in keyof D]: D[K] extends new (...args: any[]) => infer C // or map of instances respectively ? UpdatedClient<C> : never } => { return null as any} : <D extends Record<string, new (...args: any[]) => Client> | (new (...args: any[]) => Client)>(clientDef: D) => D extends new (...args: any[]) => infer C ? UpdatedClient<C> : { [K in keyof D]: D[K] extends new (...args: any[]) => infer C ? UpdatedClient<C> : never; }
D extends
| (new (...args: any[]) => Client) // accept class
>args : any[]
| Record<string, new (...args: any[]) => Client> // or map of classes
>args : any[]
>(
clientDef: D
>clientDef : D
): D extends new (...args: any[]) => infer C
>args : any[]
? UpdatedClient<C> // return instance
: {
[K in keyof D]: D[K] extends new (...args: any[]) => infer C // or map of instances respectively
>args : any[]
? UpdatedClient<C>
: never
} => {
return null as any
>null as any : any
>null : null
}
|