mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-04-17 01:49:41 -05:00
When reusing input type nodes, only instantiate the type for comparison if it is a this type (#42584)
This commit is contained in:
@@ -6005,10 +6005,14 @@ namespace ts {
|
||||
function serializeReturnTypeForSignature(context: NodeBuilderContext, type: Type, signature: Signature, includePrivateSymbol?: (s: Symbol) => void, bundled?: boolean) {
|
||||
if (type !== errorType && context.enclosingDeclaration) {
|
||||
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
|
||||
if (!!findAncestor(annotation, n => n === context.enclosingDeclaration) && annotation && instantiateType(getTypeFromTypeNode(annotation), signature.mapper) === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
|
||||
const result = serializeExistingTypeNode(context, annotation, includePrivateSymbol, bundled);
|
||||
if (result) {
|
||||
return result;
|
||||
if (!!findAncestor(annotation, n => n === context.enclosingDeclaration) && annotation) {
|
||||
const annotated = getTypeFromTypeNode(annotation);
|
||||
const thisInstantiated = annotated.flags & TypeFlags.TypeParameter && (annotated as TypeParameter).isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
||||
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
|
||||
const result = serializeExistingTypeNode(context, annotation, includePrivateSymbol, bundled);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
//// [declarationEmitOverloadedPrivateInference.ts]
|
||||
function noArgs(): string {
|
||||
return null as any;
|
||||
}
|
||||
|
||||
function oneArg(input: string): string {
|
||||
return null as any;
|
||||
}
|
||||
|
||||
export class Wrapper {
|
||||
private proxy<T, U>(fn: (options: T) => U): (options: T) => U;
|
||||
private proxy<T, U>(fn: (options?: T) => U, noArgs: true): (options?: T) => U;
|
||||
|
||||
private proxy<T, U>(fn: (options: T) => U) {
|
||||
return null as any;
|
||||
}
|
||||
|
||||
public Proxies = {
|
||||
Failure: this.proxy(noArgs, true),
|
||||
Success: this.proxy(oneArg),
|
||||
};
|
||||
}
|
||||
|
||||
//// [declarationEmitOverloadedPrivateInference.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.Wrapper = void 0;
|
||||
function noArgs() {
|
||||
return null;
|
||||
}
|
||||
function oneArg(input) {
|
||||
return null;
|
||||
}
|
||||
var Wrapper = /** @class */ (function () {
|
||||
function Wrapper() {
|
||||
this.Proxies = {
|
||||
Failure: this.proxy(noArgs, true),
|
||||
Success: this.proxy(oneArg)
|
||||
};
|
||||
}
|
||||
Wrapper.prototype.proxy = function (fn) {
|
||||
return null;
|
||||
};
|
||||
return Wrapper;
|
||||
}());
|
||||
exports.Wrapper = Wrapper;
|
||||
|
||||
|
||||
//// [declarationEmitOverloadedPrivateInference.d.ts]
|
||||
export declare class Wrapper {
|
||||
private proxy;
|
||||
Proxies: {
|
||||
Failure: (options?: unknown) => string;
|
||||
Success: (options: string) => string;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
=== tests/cases/compiler/declarationEmitOverloadedPrivateInference.ts ===
|
||||
function noArgs(): string {
|
||||
>noArgs : Symbol(noArgs, Decl(declarationEmitOverloadedPrivateInference.ts, 0, 0))
|
||||
|
||||
return null as any;
|
||||
}
|
||||
|
||||
function oneArg(input: string): string {
|
||||
>oneArg : Symbol(oneArg, Decl(declarationEmitOverloadedPrivateInference.ts, 2, 1))
|
||||
>input : Symbol(input, Decl(declarationEmitOverloadedPrivateInference.ts, 4, 16))
|
||||
|
||||
return null as any;
|
||||
}
|
||||
|
||||
export class Wrapper {
|
||||
>Wrapper : Symbol(Wrapper, Decl(declarationEmitOverloadedPrivateInference.ts, 6, 1))
|
||||
|
||||
private proxy<T, U>(fn: (options: T) => U): (options: T) => U;
|
||||
>proxy : Symbol(Wrapper.proxy, Decl(declarationEmitOverloadedPrivateInference.ts, 8, 22), Decl(declarationEmitOverloadedPrivateInference.ts, 9, 66), Decl(declarationEmitOverloadedPrivateInference.ts, 10, 82))
|
||||
>T : Symbol(T, Decl(declarationEmitOverloadedPrivateInference.ts, 9, 18))
|
||||
>U : Symbol(U, Decl(declarationEmitOverloadedPrivateInference.ts, 9, 20))
|
||||
>fn : Symbol(fn, Decl(declarationEmitOverloadedPrivateInference.ts, 9, 24))
|
||||
>options : Symbol(options, Decl(declarationEmitOverloadedPrivateInference.ts, 9, 29))
|
||||
>T : Symbol(T, Decl(declarationEmitOverloadedPrivateInference.ts, 9, 18))
|
||||
>U : Symbol(U, Decl(declarationEmitOverloadedPrivateInference.ts, 9, 20))
|
||||
>options : Symbol(options, Decl(declarationEmitOverloadedPrivateInference.ts, 9, 49))
|
||||
>T : Symbol(T, Decl(declarationEmitOverloadedPrivateInference.ts, 9, 18))
|
||||
>U : Symbol(U, Decl(declarationEmitOverloadedPrivateInference.ts, 9, 20))
|
||||
|
||||
private proxy<T, U>(fn: (options?: T) => U, noArgs: true): (options?: T) => U;
|
||||
>proxy : Symbol(Wrapper.proxy, Decl(declarationEmitOverloadedPrivateInference.ts, 8, 22), Decl(declarationEmitOverloadedPrivateInference.ts, 9, 66), Decl(declarationEmitOverloadedPrivateInference.ts, 10, 82))
|
||||
>T : Symbol(T, Decl(declarationEmitOverloadedPrivateInference.ts, 10, 18))
|
||||
>U : Symbol(U, Decl(declarationEmitOverloadedPrivateInference.ts, 10, 20))
|
||||
>fn : Symbol(fn, Decl(declarationEmitOverloadedPrivateInference.ts, 10, 24))
|
||||
>options : Symbol(options, Decl(declarationEmitOverloadedPrivateInference.ts, 10, 29))
|
||||
>T : Symbol(T, Decl(declarationEmitOverloadedPrivateInference.ts, 10, 18))
|
||||
>U : Symbol(U, Decl(declarationEmitOverloadedPrivateInference.ts, 10, 20))
|
||||
>noArgs : Symbol(noArgs, Decl(declarationEmitOverloadedPrivateInference.ts, 10, 47))
|
||||
>options : Symbol(options, Decl(declarationEmitOverloadedPrivateInference.ts, 10, 64))
|
||||
>T : Symbol(T, Decl(declarationEmitOverloadedPrivateInference.ts, 10, 18))
|
||||
>U : Symbol(U, Decl(declarationEmitOverloadedPrivateInference.ts, 10, 20))
|
||||
|
||||
private proxy<T, U>(fn: (options: T) => U) {
|
||||
>proxy : Symbol(Wrapper.proxy, Decl(declarationEmitOverloadedPrivateInference.ts, 8, 22), Decl(declarationEmitOverloadedPrivateInference.ts, 9, 66), Decl(declarationEmitOverloadedPrivateInference.ts, 10, 82))
|
||||
>T : Symbol(T, Decl(declarationEmitOverloadedPrivateInference.ts, 12, 18))
|
||||
>U : Symbol(U, Decl(declarationEmitOverloadedPrivateInference.ts, 12, 20))
|
||||
>fn : Symbol(fn, Decl(declarationEmitOverloadedPrivateInference.ts, 12, 24))
|
||||
>options : Symbol(options, Decl(declarationEmitOverloadedPrivateInference.ts, 12, 29))
|
||||
>T : Symbol(T, Decl(declarationEmitOverloadedPrivateInference.ts, 12, 18))
|
||||
>U : Symbol(U, Decl(declarationEmitOverloadedPrivateInference.ts, 12, 20))
|
||||
|
||||
return null as any;
|
||||
}
|
||||
|
||||
public Proxies = {
|
||||
>Proxies : Symbol(Wrapper.Proxies, Decl(declarationEmitOverloadedPrivateInference.ts, 14, 5))
|
||||
|
||||
Failure: this.proxy(noArgs, true),
|
||||
>Failure : Symbol(Failure, Decl(declarationEmitOverloadedPrivateInference.ts, 16, 22))
|
||||
>this.proxy : Symbol(Wrapper.proxy, Decl(declarationEmitOverloadedPrivateInference.ts, 8, 22), Decl(declarationEmitOverloadedPrivateInference.ts, 9, 66), Decl(declarationEmitOverloadedPrivateInference.ts, 10, 82))
|
||||
>this : Symbol(Wrapper, Decl(declarationEmitOverloadedPrivateInference.ts, 6, 1))
|
||||
>proxy : Symbol(Wrapper.proxy, Decl(declarationEmitOverloadedPrivateInference.ts, 8, 22), Decl(declarationEmitOverloadedPrivateInference.ts, 9, 66), Decl(declarationEmitOverloadedPrivateInference.ts, 10, 82))
|
||||
>noArgs : Symbol(noArgs, Decl(declarationEmitOverloadedPrivateInference.ts, 0, 0))
|
||||
|
||||
Success: this.proxy(oneArg),
|
||||
>Success : Symbol(Success, Decl(declarationEmitOverloadedPrivateInference.ts, 17, 42))
|
||||
>this.proxy : Symbol(Wrapper.proxy, Decl(declarationEmitOverloadedPrivateInference.ts, 8, 22), Decl(declarationEmitOverloadedPrivateInference.ts, 9, 66), Decl(declarationEmitOverloadedPrivateInference.ts, 10, 82))
|
||||
>this : Symbol(Wrapper, Decl(declarationEmitOverloadedPrivateInference.ts, 6, 1))
|
||||
>proxy : Symbol(Wrapper.proxy, Decl(declarationEmitOverloadedPrivateInference.ts, 8, 22), Decl(declarationEmitOverloadedPrivateInference.ts, 9, 66), Decl(declarationEmitOverloadedPrivateInference.ts, 10, 82))
|
||||
>oneArg : Symbol(oneArg, Decl(declarationEmitOverloadedPrivateInference.ts, 2, 1))
|
||||
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
=== tests/cases/compiler/declarationEmitOverloadedPrivateInference.ts ===
|
||||
function noArgs(): string {
|
||||
>noArgs : () => string
|
||||
|
||||
return null as any;
|
||||
>null as any : any
|
||||
>null : null
|
||||
}
|
||||
|
||||
function oneArg(input: string): string {
|
||||
>oneArg : (input: string) => string
|
||||
>input : string
|
||||
|
||||
return null as any;
|
||||
>null as any : any
|
||||
>null : null
|
||||
}
|
||||
|
||||
export class Wrapper {
|
||||
>Wrapper : Wrapper
|
||||
|
||||
private proxy<T, U>(fn: (options: T) => U): (options: T) => U;
|
||||
>proxy : { <T, U>(fn: (options: T) => U): (options: T) => U; <T, U>(fn: (options?: T) => U, noArgs: true): (options?: T) => U; }
|
||||
>fn : (options: T) => U
|
||||
>options : T
|
||||
>options : T
|
||||
|
||||
private proxy<T, U>(fn: (options?: T) => U, noArgs: true): (options?: T) => U;
|
||||
>proxy : { <T, U>(fn: (options: T) => U): (options: T) => U; <T, U>(fn: (options?: T) => U, noArgs: true): (options?: T) => U; }
|
||||
>fn : (options?: T) => U
|
||||
>options : T
|
||||
>noArgs : true
|
||||
>true : true
|
||||
>options : T
|
||||
|
||||
private proxy<T, U>(fn: (options: T) => U) {
|
||||
>proxy : { <T, U>(fn: (options: T) => U): (options: T) => U; <T, U>(fn: (options?: T) => U, noArgs: true): (options?: T) => U; }
|
||||
>fn : (options: T) => U
|
||||
>options : T
|
||||
|
||||
return null as any;
|
||||
>null as any : any
|
||||
>null : null
|
||||
}
|
||||
|
||||
public Proxies = {
|
||||
>Proxies : { Failure: (options?: unknown) => string; Success: (options: string) => string; }
|
||||
>{ Failure: this.proxy(noArgs, true), Success: this.proxy(oneArg), } : { Failure: (options?: unknown) => string; Success: (options: string) => string; }
|
||||
|
||||
Failure: this.proxy(noArgs, true),
|
||||
>Failure : (options?: unknown) => string
|
||||
>this.proxy(noArgs, true) : (options?: unknown) => string
|
||||
>this.proxy : { <T, U>(fn: (options: T) => U): (options: T) => U; <T, U>(fn: (options?: T) => U, noArgs: true): (options?: T) => U; }
|
||||
>this : this
|
||||
>proxy : { <T, U>(fn: (options: T) => U): (options: T) => U; <T, U>(fn: (options?: T) => U, noArgs: true): (options?: T) => U; }
|
||||
>noArgs : () => string
|
||||
>true : true
|
||||
|
||||
Success: this.proxy(oneArg),
|
||||
>Success : (options: string) => string
|
||||
>this.proxy(oneArg) : (options: string) => string
|
||||
>this.proxy : { <T, U>(fn: (options: T) => U): (options: T) => U; <T, U>(fn: (options?: T) => U, noArgs: true): (options?: T) => U; }
|
||||
>this : this
|
||||
>proxy : { <T, U>(fn: (options: T) => U): (options: T) => U; <T, U>(fn: (options?: T) => U, noArgs: true): (options?: T) => U; }
|
||||
>oneArg : (input: string) => string
|
||||
|
||||
};
|
||||
}
|
||||
@@ -38,13 +38,13 @@ export const updateIfChanged = <T>(t: T) => {
|
||||
>newU : U
|
||||
|
||||
return Object.assign(
|
||||
>Object.assign( <K extends Key<U>>(key: K) => reduce<Value<K, U>>(u[key as keyof U] as Value<K, U>, (v: Value<K, U>) => { return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })); }), { map: (updater: (u: U) => U) => set(updater(u)), set }) : (<K extends keyof U>(key: K) => (<K extends keyof Value<K, U>>(key: K) => (<K extends keyof Value<K, Value<K, U>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, U>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, U>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>>(key: K) => any & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, U>>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, U>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, U>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, U>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, U>>) => U) => T; set: (newU: Value<K, Value<K, U>>) => T; }) & { map: (updater: (u: Value<K, U>) => U) => T; set: (newU: Value<K, U>) => T; }) & { map: (updater: (u: U) => U) => T; set: (newU: U) => T; }
|
||||
>Object.assign( <K extends Key<U>>(key: K) => reduce<Value<K, U>>(u[key as keyof U] as Value<K, U>, (v: Value<K, U>) => { return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })); }), { map: (updater: (u: U) => U) => set(updater(u)), set }) : (<K extends keyof U>(key: K) => (<K extends keyof Value<K, U>>(key: K) => (<K extends keyof Value<K, Value<K, U>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, U>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, U>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>>(key: K) => any & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, U>>>>) => Value<K, Value<K, Value<K, Value<K, U>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, U>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, U>>>) => Value<K, Value<K, Value<K, U>>>) => T; set: (newU: Value<K, Value<K, Value<K, U>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, U>>) => Value<K, Value<K, U>>) => T; set: (newU: Value<K, Value<K, U>>) => T; }) & { map: (updater: (u: Value<K, U>) => Value<K, U>) => T; set: (newU: Value<K, U>) => T; }) & { map: (updater: (u: U) => U) => T; set: (newU: U) => T; }
|
||||
>Object.assign : { <T, U>(target: T, source: U): T & U; <T, U, V>(target: T, source1: U, source2: V): T & U & V; <T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; }
|
||||
>Object : ObjectConstructor
|
||||
>assign : { <T, U>(target: T, source: U): T & U; <T, U, V>(target: T, source1: U, source2: V): T & U & V; <T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; }
|
||||
|
||||
<K extends Key<U>>(key: K) =>
|
||||
><K extends Key<U>>(key: K) => reduce<Value<K, U>>(u[key as keyof U] as Value<K, U>, (v: Value<K, U>) => { return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })); }) : <K extends keyof U>(key: K) => (<K extends keyof Value<K, U>>(key: K) => (<K extends keyof Value<K, Value<K, U>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, U>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, U>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>>(key: K) => any & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, U>>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, U>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, U>>>) => U) => T; set: (newU: Value<K, Value<K, Value<K, U>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, U>>) => U) => T; set: (newU: Value<K, Value<K, U>>) => T; }) & { map: (updater: (u: Value<K, U>) => U) => T; set: (newU: Value<K, U>) => T; }
|
||||
><K extends Key<U>>(key: K) => reduce<Value<K, U>>(u[key as keyof U] as Value<K, U>, (v: Value<K, U>) => { return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })); }) : <K extends keyof U>(key: K) => (<K extends keyof Value<K, U>>(key: K) => (<K extends keyof Value<K, Value<K, U>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, U>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, U>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>>(key: K) => any & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, U>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, U>>>>) => Value<K, Value<K, Value<K, Value<K, U>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, U>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, U>>>) => Value<K, Value<K, Value<K, U>>>) => T; set: (newU: Value<K, Value<K, Value<K, U>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, U>>) => Value<K, Value<K, U>>) => T; set: (newU: Value<K, Value<K, U>>) => T; }) & { map: (updater: (u: Value<K, U>) => Value<K, U>) => T; set: (newU: Value<K, U>) => T; }
|
||||
>key : K
|
||||
|
||||
reduce<Value<K, U>>(u[key as keyof U] as Value<K, U>, (v: Value<K, U>) => {
|
||||
|
||||
@@ -135,10 +135,10 @@ export interface B {
|
||||
export interface C<T_1, U_1> {
|
||||
new (): string;
|
||||
new (x: T_1): U_1;
|
||||
new <Q_6>(x: Q_6): T_1 & Q_6;
|
||||
new <Q_4>(x: Q_4): T_1 & Q_4;
|
||||
(): number;
|
||||
(x: T_1): U_1;
|
||||
<Q_4>(x: Q_4): T_1 & Q_4;
|
||||
<Q_3>(x: Q_3): T_1 & Q_3;
|
||||
field: T_1 & U_1;
|
||||
optionalField?: T_1;
|
||||
readonly readonlyField: T_1 & U_1;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// @declaration: true
|
||||
function noArgs(): string {
|
||||
return null as any;
|
||||
}
|
||||
|
||||
function oneArg(input: string): string {
|
||||
return null as any;
|
||||
}
|
||||
|
||||
export class Wrapper {
|
||||
private proxy<T, U>(fn: (options: T) => U): (options: T) => U;
|
||||
private proxy<T, U>(fn: (options?: T) => U, noArgs: true): (options?: T) => U;
|
||||
|
||||
private proxy<T, U>(fn: (options: T) => U) {
|
||||
return null as any;
|
||||
}
|
||||
|
||||
public Proxies = {
|
||||
Failure: this.proxy(noArgs, true),
|
||||
Success: this.proxy(oneArg),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user