mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Fix crash when serializing the return type of a generic call to Array.prototype.flat (#38904) (#39079)
* Add declaration emit error and checking for circularly referential unions produced by recursive conditionals * Allow indexed accesses to produce alias symbols on types * Add test that still triggers the declaration emit error * Fix spelling
This commit is contained in:
+28
-10
@@ -4397,8 +4397,8 @@ namespace ts {
|
||||
context.inferTypeParameters = (<ConditionalType>type).root.inferTypeParameters;
|
||||
const extendsTypeNode = typeToTypeNodeHelper((<ConditionalType>type).extendsType, context);
|
||||
context.inferTypeParameters = saveInferTypeParameters;
|
||||
const trueTypeNode = typeToTypeNodeHelper(getTrueTypeFromConditionalType(<ConditionalType>type), context);
|
||||
const falseTypeNode = typeToTypeNodeHelper(getFalseTypeFromConditionalType(<ConditionalType>type), context);
|
||||
const trueTypeNode = typeToTypeNodeOrCircularityElision(getTrueTypeFromConditionalType(<ConditionalType>type));
|
||||
const falseTypeNode = typeToTypeNodeOrCircularityElision(getFalseTypeFromConditionalType(<ConditionalType>type));
|
||||
context.approximateLength += 15;
|
||||
return createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
|
||||
}
|
||||
@@ -4408,6 +4408,21 @@ namespace ts {
|
||||
|
||||
return Debug.fail("Should be unreachable.");
|
||||
|
||||
|
||||
function typeToTypeNodeOrCircularityElision(type: Type) {
|
||||
if (type.flags & TypeFlags.Union) {
|
||||
if (context.visitedTypes && context.visitedTypes.has("" + getTypeId(type))) {
|
||||
if (!(context.flags & NodeBuilderFlags.AllowAnonymousIdentifier)) {
|
||||
context.encounteredError = true;
|
||||
context.tracker?.reportCyclicStructureError?.();
|
||||
}
|
||||
return createElidedInformationPlaceholder(context);
|
||||
}
|
||||
return visitAndTransformType(type, type => typeToTypeNodeHelper(type, context));
|
||||
}
|
||||
return typeToTypeNodeHelper(type, context);
|
||||
}
|
||||
|
||||
function createMappedTypeNodeFromType(type: MappedType) {
|
||||
Debug.assert(!!(type.flags & TypeFlags.Object));
|
||||
const readonlyToken = type.declaration.readonlyToken ? <ReadonlyToken | PlusToken | MinusToken>createToken(type.declaration.readonlyToken.kind) : undefined;
|
||||
@@ -12794,10 +12809,12 @@ namespace ts {
|
||||
return links.resolvedType;
|
||||
}
|
||||
|
||||
function createIndexedAccessType(objectType: Type, indexType: Type) {
|
||||
function createIndexedAccessType(objectType: Type, indexType: Type, aliasSymbol: Symbol | undefined, aliasTypeArguments: readonly Type[] | undefined) {
|
||||
const type = <IndexedAccessType>createType(TypeFlags.IndexedAccess);
|
||||
type.objectType = objectType;
|
||||
type.indexType = indexType;
|
||||
type.aliasSymbol = aliasSymbol;
|
||||
type.aliasTypeArguments = aliasTypeArguments;
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -13129,11 +13146,11 @@ namespace ts {
|
||||
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
|
||||
}
|
||||
|
||||
function getIndexedAccessType(objectType: Type, indexType: Type, accessNode?: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression): Type {
|
||||
return getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, AccessFlags.None) || (accessNode ? errorType : unknownType);
|
||||
function getIndexedAccessType(objectType: Type, indexType: Type, accessNode?: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): Type {
|
||||
return getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, AccessFlags.None, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType);
|
||||
}
|
||||
|
||||
function getIndexedAccessTypeOrUndefined(objectType: Type, indexType: Type, accessNode?: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression, accessFlags = AccessFlags.None): Type | undefined {
|
||||
function getIndexedAccessTypeOrUndefined(objectType: Type, indexType: Type, accessNode?: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression, accessFlags = AccessFlags.None, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): Type | undefined {
|
||||
if (objectType === wildcardType || indexType === wildcardType) {
|
||||
return wildcardType;
|
||||
}
|
||||
@@ -13155,7 +13172,7 @@ namespace ts {
|
||||
const id = objectType.id + "," + indexType.id;
|
||||
let type = indexedAccessTypes.get(id);
|
||||
if (!type) {
|
||||
indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType));
|
||||
indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType, aliasSymbol, aliasTypeArguments));
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@@ -13183,7 +13200,7 @@ namespace ts {
|
||||
if (wasMissingProp) {
|
||||
return undefined;
|
||||
}
|
||||
return accessFlags & AccessFlags.Writing ? getIntersectionType(propTypes) : getUnionType(propTypes);
|
||||
return accessFlags & AccessFlags.Writing ? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, UnionReduction.Literal, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, /* supressNoImplicitAnyError */ false, accessNode, accessFlags | AccessFlags.CacheSymbol);
|
||||
}
|
||||
@@ -13193,7 +13210,8 @@ namespace ts {
|
||||
if (!links.resolvedType) {
|
||||
const objectType = getTypeFromTypeNode(node.objectType);
|
||||
const indexType = getTypeFromTypeNode(node.indexType);
|
||||
const resolved = getIndexedAccessType(objectType, indexType, node);
|
||||
const potentialAlias = getAliasSymbolForTypeNode(node);
|
||||
const resolved = getIndexedAccessType(objectType, indexType, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias));
|
||||
links.resolvedType = resolved.flags & TypeFlags.IndexedAccess &&
|
||||
(<IndexedAccessType>resolved).objectType === objectType &&
|
||||
(<IndexedAccessType>resolved).indexType === indexType ?
|
||||
@@ -14341,7 +14359,7 @@ namespace ts {
|
||||
return getIndexType(instantiateType((<IndexType>type).type, mapper));
|
||||
}
|
||||
if (flags & TypeFlags.IndexedAccess) {
|
||||
return getIndexedAccessType(instantiateType((<IndexedAccessType>type).objectType, mapper), instantiateType((<IndexedAccessType>type).indexType, mapper));
|
||||
return getIndexedAccessType(instantiateType((<IndexedAccessType>type).objectType, mapper), instantiateType((<IndexedAccessType>type).indexType, mapper), /*accessNode*/ undefined, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));
|
||||
}
|
||||
if (flags & TypeFlags.Conditional) {
|
||||
return getConditionalTypeInstantiation(<ConditionalType>type, combineTypeMappers((<ConditionalType>type).mapper, mapper));
|
||||
|
||||
@@ -3509,6 +3509,10 @@
|
||||
"category": "Error",
|
||||
"code": 5083
|
||||
},
|
||||
"The inferred type of '{0}' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary.": {
|
||||
"category": "Error",
|
||||
"code": 5088
|
||||
},
|
||||
|
||||
"Generates a sourcemap for each corresponding '.d.ts' file.": {
|
||||
"category": "Message",
|
||||
|
||||
@@ -72,6 +72,7 @@ namespace ts {
|
||||
trackSymbol,
|
||||
reportInaccessibleThisError,
|
||||
reportInaccessibleUniqueSymbolError,
|
||||
reportCyclicStructureError,
|
||||
reportPrivateInBaseOfClassExpression,
|
||||
reportLikelyUnsafeImportRequiredError,
|
||||
moduleResolverHost: host,
|
||||
@@ -175,6 +176,13 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function reportCyclicStructureError() {
|
||||
if (errorNameNode) {
|
||||
context.addDiagnostic(createDiagnosticForNode(errorNameNode, Diagnostics.The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialized_A_type_annotation_is_necessary,
|
||||
declarationNameToString(errorNameNode)));
|
||||
}
|
||||
}
|
||||
|
||||
function reportInaccessibleThisError() {
|
||||
if (errorNameNode) {
|
||||
context.addDiagnostic(createDiagnosticForNode(errorNameNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary,
|
||||
|
||||
@@ -6479,6 +6479,7 @@ namespace ts {
|
||||
reportInaccessibleThisError?(): void;
|
||||
reportPrivateInBaseOfClassExpression?(propertyName: string): void;
|
||||
reportInaccessibleUniqueSymbolError?(): void;
|
||||
reportCyclicStructureError?(): void;
|
||||
reportLikelyUnsafeImportRequiredError?(specifier: string): void;
|
||||
moduleResolverHost?: ModuleSpecifierResolutionHost & { getCommonSourceDirectory(): string };
|
||||
trackReferencedAmbientModule?(decl: ModuleDeclaration, symbol: Symbol): void;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
tests/cases/compiler/arrayFakeFlatNoCrashInferenceDeclarations.ts(13,10): error TS5088: The inferred type of 'foo' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary.
|
||||
|
||||
|
||||
==== tests/cases/compiler/arrayFakeFlatNoCrashInferenceDeclarations.ts (1 errors) ====
|
||||
type BadFlatArray<Arr, Depth extends number> = {obj: {
|
||||
"done": Arr,
|
||||
"recur": Arr extends ReadonlyArray<infer InnerArr>
|
||||
? BadFlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][Depth]>
|
||||
: Arr
|
||||
}[Depth extends -1 ? "done" : "recur"]}["obj"];
|
||||
|
||||
declare function flat<A, D extends number = 1>(
|
||||
arr: A,
|
||||
depth?: D
|
||||
): BadFlatArray<A, D>[]
|
||||
|
||||
function foo<T>(arr: T[], depth: number) {
|
||||
~~~
|
||||
!!! error TS5088: The inferred type of 'foo' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary.
|
||||
return flat(arr, depth);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//// [arrayFakeFlatNoCrashInferenceDeclarations.ts]
|
||||
type BadFlatArray<Arr, Depth extends number> = {obj: {
|
||||
"done": Arr,
|
||||
"recur": Arr extends ReadonlyArray<infer InnerArr>
|
||||
? BadFlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][Depth]>
|
||||
: Arr
|
||||
}[Depth extends -1 ? "done" : "recur"]}["obj"];
|
||||
|
||||
declare function flat<A, D extends number = 1>(
|
||||
arr: A,
|
||||
depth?: D
|
||||
): BadFlatArray<A, D>[]
|
||||
|
||||
function foo<T>(arr: T[], depth: number) {
|
||||
return flat(arr, depth);
|
||||
}
|
||||
|
||||
//// [arrayFakeFlatNoCrashInferenceDeclarations.js]
|
||||
"use strict";
|
||||
function foo(arr, depth) {
|
||||
return flat(arr, depth);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
=== tests/cases/compiler/arrayFakeFlatNoCrashInferenceDeclarations.ts ===
|
||||
type BadFlatArray<Arr, Depth extends number> = {obj: {
|
||||
>BadFlatArray : Symbol(BadFlatArray, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 0, 0))
|
||||
>Arr : Symbol(Arr, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 0, 18))
|
||||
>Depth : Symbol(Depth, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 0, 22))
|
||||
>obj : Symbol(obj, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 0, 48))
|
||||
|
||||
"done": Arr,
|
||||
>"done" : Symbol("done", Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 0, 54))
|
||||
>Arr : Symbol(Arr, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 0, 18))
|
||||
|
||||
"recur": Arr extends ReadonlyArray<infer InnerArr>
|
||||
>"recur" : Symbol("recur", Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 1, 16))
|
||||
>Arr : Symbol(Arr, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 0, 18))
|
||||
>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --))
|
||||
>InnerArr : Symbol(InnerArr, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 2, 44))
|
||||
|
||||
? BadFlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][Depth]>
|
||||
>BadFlatArray : Symbol(BadFlatArray, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 0, 0))
|
||||
>InnerArr : Symbol(InnerArr, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 2, 44))
|
||||
>Depth : Symbol(Depth, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 0, 22))
|
||||
|
||||
: Arr
|
||||
>Arr : Symbol(Arr, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 0, 18))
|
||||
|
||||
}[Depth extends -1 ? "done" : "recur"]}["obj"];
|
||||
>Depth : Symbol(Depth, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 0, 22))
|
||||
|
||||
declare function flat<A, D extends number = 1>(
|
||||
>flat : Symbol(flat, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 5, 47))
|
||||
>A : Symbol(A, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 7, 22))
|
||||
>D : Symbol(D, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 7, 24))
|
||||
|
||||
arr: A,
|
||||
>arr : Symbol(arr, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 7, 47))
|
||||
>A : Symbol(A, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 7, 22))
|
||||
|
||||
depth?: D
|
||||
>depth : Symbol(depth, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 8, 11))
|
||||
>D : Symbol(D, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 7, 24))
|
||||
|
||||
): BadFlatArray<A, D>[]
|
||||
>BadFlatArray : Symbol(BadFlatArray, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 0, 0))
|
||||
>A : Symbol(A, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 7, 22))
|
||||
>D : Symbol(D, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 7, 24))
|
||||
|
||||
function foo<T>(arr: T[], depth: number) {
|
||||
>foo : Symbol(foo, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 10, 23))
|
||||
>T : Symbol(T, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 12, 13))
|
||||
>arr : Symbol(arr, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 12, 16))
|
||||
>T : Symbol(T, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 12, 13))
|
||||
>depth : Symbol(depth, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 12, 25))
|
||||
|
||||
return flat(arr, depth);
|
||||
>flat : Symbol(flat, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 5, 47))
|
||||
>arr : Symbol(arr, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 12, 16))
|
||||
>depth : Symbol(depth, Decl(arrayFakeFlatNoCrashInferenceDeclarations.ts, 12, 25))
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,10 @@
|
||||
//// [arrayFlatNoCrashInference.ts]
|
||||
function foo<T>(arr: T[], depth: number) {
|
||||
return arr.flat(depth);
|
||||
}
|
||||
|
||||
//// [arrayFlatNoCrashInference.js]
|
||||
"use strict";
|
||||
function foo(arr, depth) {
|
||||
return arr.flat(depth);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/compiler/arrayFlatNoCrashInference.ts ===
|
||||
function foo<T>(arr: T[], depth: number) {
|
||||
>foo : Symbol(foo, Decl(arrayFlatNoCrashInference.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(arrayFlatNoCrashInference.ts, 0, 13))
|
||||
>arr : Symbol(arr, Decl(arrayFlatNoCrashInference.ts, 0, 16))
|
||||
>T : Symbol(T, Decl(arrayFlatNoCrashInference.ts, 0, 13))
|
||||
>depth : Symbol(depth, Decl(arrayFlatNoCrashInference.ts, 0, 25))
|
||||
|
||||
return arr.flat(depth);
|
||||
>arr.flat : Symbol(Array.flat, Decl(lib.es2019.array.d.ts, --, --))
|
||||
>arr : Symbol(arr, Decl(arrayFlatNoCrashInference.ts, 0, 16))
|
||||
>flat : Symbol(Array.flat, Decl(lib.es2019.array.d.ts, --, --))
|
||||
>depth : Symbol(depth, Decl(arrayFlatNoCrashInference.ts, 0, 25))
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/arrayFlatNoCrashInference.ts ===
|
||||
function foo<T>(arr: T[], depth: number) {
|
||||
>foo : <T>(arr: T[], depth: number) => FlatArray<T, 0 | 1 | -1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20>[]
|
||||
>arr : T[]
|
||||
>depth : number
|
||||
|
||||
return arr.flat(depth);
|
||||
>arr.flat(depth) : FlatArray<T, 0 | 1 | -1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20>[]
|
||||
>arr.flat : <A, D extends number = 1>(this: A, depth?: D | undefined) => FlatArray<A, D>[]
|
||||
>arr : T[]
|
||||
>flat : <A, D extends number = 1>(this: A, depth?: D | undefined) => FlatArray<A, D>[]
|
||||
>depth : number
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//// [arrayFlatNoCrashInferenceDeclarations.ts]
|
||||
function foo<T>(arr: T[], depth: number) {
|
||||
return arr.flat(depth);
|
||||
}
|
||||
|
||||
//// [arrayFlatNoCrashInferenceDeclarations.js]
|
||||
"use strict";
|
||||
function foo(arr, depth) {
|
||||
return arr.flat(depth);
|
||||
}
|
||||
|
||||
|
||||
//// [arrayFlatNoCrashInferenceDeclarations.d.ts]
|
||||
declare function foo<T>(arr: T[], depth: number): FlatArray<T, 0 | 1 | -1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20>[];
|
||||
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/compiler/arrayFlatNoCrashInferenceDeclarations.ts ===
|
||||
function foo<T>(arr: T[], depth: number) {
|
||||
>foo : Symbol(foo, Decl(arrayFlatNoCrashInferenceDeclarations.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(arrayFlatNoCrashInferenceDeclarations.ts, 0, 13))
|
||||
>arr : Symbol(arr, Decl(arrayFlatNoCrashInferenceDeclarations.ts, 0, 16))
|
||||
>T : Symbol(T, Decl(arrayFlatNoCrashInferenceDeclarations.ts, 0, 13))
|
||||
>depth : Symbol(depth, Decl(arrayFlatNoCrashInferenceDeclarations.ts, 0, 25))
|
||||
|
||||
return arr.flat(depth);
|
||||
>arr.flat : Symbol(Array.flat, Decl(lib.es2019.array.d.ts, --, --))
|
||||
>arr : Symbol(arr, Decl(arrayFlatNoCrashInferenceDeclarations.ts, 0, 16))
|
||||
>flat : Symbol(Array.flat, Decl(lib.es2019.array.d.ts, --, --))
|
||||
>depth : Symbol(depth, Decl(arrayFlatNoCrashInferenceDeclarations.ts, 0, 25))
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/arrayFlatNoCrashInferenceDeclarations.ts ===
|
||||
function foo<T>(arr: T[], depth: number) {
|
||||
>foo : <T>(arr: T[], depth: number) => FlatArray<T, 0 | 1 | -1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20>[]
|
||||
>arr : T[]
|
||||
>depth : number
|
||||
|
||||
return arr.flat(depth);
|
||||
>arr.flat(depth) : FlatArray<T, 0 | 1 | -1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20>[]
|
||||
>arr.flat : <A, D extends number = 1>(this: A, depth?: D | undefined) => FlatArray<A, D>[]
|
||||
>arr : T[]
|
||||
>flat : <A, D extends number = 1>(this: A, depth?: D | undefined) => FlatArray<A, D>[]
|
||||
>depth : number
|
||||
}
|
||||
@@ -9,8 +9,8 @@ tests/cases/compiler/bigintWithLib.ts(16,33): error TS2769: No overload matches
|
||||
Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorResult<bigint, any>'.
|
||||
Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorYieldResult<bigint>'.
|
||||
Type 'number' is not assignable to type 'bigint'.
|
||||
Overload 3 of 3, '(buffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigInt64Array', gave the following error.
|
||||
Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
|
||||
Overload 3 of 3, '(buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigInt64Array', gave the following error.
|
||||
Argument of type 'number[]' is not assignable to parameter of type 'ArrayBufferLike'.
|
||||
Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag]
|
||||
tests/cases/compiler/bigintWithLib.ts(21,13): error TS2540: Cannot assign to 'length' because it is a read-only property.
|
||||
tests/cases/compiler/bigintWithLib.ts(28,35): error TS2769: No overload matches this call.
|
||||
@@ -18,8 +18,8 @@ tests/cases/compiler/bigintWithLib.ts(28,35): error TS2769: No overload matches
|
||||
Argument of type 'number[]' is not assignable to parameter of type 'number'.
|
||||
Overload 2 of 3, '(array: Iterable<bigint>): BigUint64Array', gave the following error.
|
||||
Argument of type 'number[]' is not assignable to parameter of type 'Iterable<bigint>'.
|
||||
Overload 3 of 3, '(buffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigUint64Array', gave the following error.
|
||||
Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
|
||||
Overload 3 of 3, '(buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigUint64Array', gave the following error.
|
||||
Argument of type 'number[]' is not assignable to parameter of type 'ArrayBufferLike'.
|
||||
Type 'number[]' is not assignable to type 'SharedArrayBuffer'.
|
||||
tests/cases/compiler/bigintWithLib.ts(33,13): error TS2540: Cannot assign to 'length' because it is a read-only property.
|
||||
tests/cases/compiler/bigintWithLib.ts(40,25): error TS2345: Argument of type '-1' is not assignable to parameter of type 'bigint'.
|
||||
@@ -56,8 +56,8 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '12
|
||||
!!! error TS2769: Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorResult<bigint, any>'.
|
||||
!!! error TS2769: Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorYieldResult<bigint>'.
|
||||
!!! error TS2769: Type 'number' is not assignable to type 'bigint'.
|
||||
!!! error TS2769: Overload 3 of 3, '(buffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigInt64Array', gave the following error.
|
||||
!!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
|
||||
!!! error TS2769: Overload 3 of 3, '(buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigInt64Array', gave the following error.
|
||||
!!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBufferLike'.
|
||||
!!! error TS2769: Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag]
|
||||
bigIntArray = new BigInt64Array(new ArrayBuffer(80));
|
||||
bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8);
|
||||
@@ -79,8 +79,8 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '12
|
||||
!!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2769: Overload 2 of 3, '(array: Iterable<bigint>): BigUint64Array', gave the following error.
|
||||
!!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'Iterable<bigint>'.
|
||||
!!! error TS2769: Overload 3 of 3, '(buffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigUint64Array', gave the following error.
|
||||
!!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
|
||||
!!! error TS2769: Overload 3 of 3, '(buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigUint64Array', gave the following error.
|
||||
!!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBufferLike'.
|
||||
!!! error TS2769: Type 'number[]' is not assignable to type 'SharedArrayBuffer'.
|
||||
bigUintArray = new BigUint64Array(new ArrayBuffer(80));
|
||||
bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8);
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
@@ -13,26 +13,26 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(29,5): error TS23
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(30,9): error TS2322: Type 'T["x"]' is not assignable to type 'string'.
|
||||
Type 'string | undefined' is not assignable to type 'string'.
|
||||
Type 'undefined' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(103,5): error TS2322: Type 'Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(104,5): error TS2322: Type 'Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(106,5): error TS2322: Type 'Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>' is not assignable to type 'Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>'.
|
||||
Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(108,5): error TS2322: Type 'Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>' is not assignable to type 'Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>'.
|
||||
Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(114,5): error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(103,5): error TS2322: Type 'Pick<T, FunctionPropertyNames<T>>' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'Pick<T, FunctionPropertyNames<T>>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(104,5): error TS2322: Type 'Pick<T, NonFunctionPropertyNames<T>>' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'Pick<T, NonFunctionPropertyNames<T>>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(106,5): error TS2322: Type 'Pick<T, NonFunctionPropertyNames<T>>' is not assignable to type 'Pick<T, FunctionPropertyNames<T>>'.
|
||||
Type 'FunctionPropertyNames<T>' is not assignable to type 'NonFunctionPropertyNames<T>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(108,5): error TS2322: Type 'Pick<T, FunctionPropertyNames<T>>' is not assignable to type 'Pick<T, NonFunctionPropertyNames<T>>'.
|
||||
Type 'NonFunctionPropertyNames<T>' is not assignable to type 'FunctionPropertyNames<T>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(114,5): error TS2322: Type 'keyof T' is not assignable to type 'FunctionPropertyNames<T>'.
|
||||
Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
Type 'string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(115,5): error TS2322: Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(115,5): error TS2322: Type 'NonFunctionPropertyNames<T>' is not assignable to type 'FunctionPropertyNames<T>'.
|
||||
Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
Type 'keyof T' is not assignable to type 'never'.
|
||||
Type 'string | number | symbol' is not assignable to type 'never'.
|
||||
Type 'string' is not assignable to type 'never'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(116,5): error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(116,5): error TS2322: Type 'keyof T' is not assignable to type 'NonFunctionPropertyNames<T>'.
|
||||
Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
Type 'string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(117,5): error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(117,5): error TS2322: Type 'FunctionPropertyNames<T>' is not assignable to type 'NonFunctionPropertyNames<T>'.
|
||||
Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
Type 'keyof T' is not assignable to type 'never'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(134,10): error TS2540: Cannot assign to 'id' because it is a read-only property.
|
||||
@@ -185,22 +185,22 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS
|
||||
function f7<T>(x: T, y: FunctionProperties<T>, z: NonFunctionProperties<T>) {
|
||||
x = y; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>'.
|
||||
!!! error TS2322: Type 'Pick<T, FunctionPropertyNames<T>>' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Pick<T, FunctionPropertyNames<T>>'.
|
||||
x = z; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>'.
|
||||
!!! error TS2322: Type 'Pick<T, NonFunctionPropertyNames<T>>' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Pick<T, NonFunctionPropertyNames<T>>'.
|
||||
y = x;
|
||||
y = z; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>' is not assignable to type 'Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'Pick<T, NonFunctionPropertyNames<T>>' is not assignable to type 'Pick<T, FunctionPropertyNames<T>>'.
|
||||
!!! error TS2322: Type 'FunctionPropertyNames<T>' is not assignable to type 'NonFunctionPropertyNames<T>'.
|
||||
z = x;
|
||||
z = y; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>' is not assignable to type 'Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'Pick<T, FunctionPropertyNames<T>>' is not assignable to type 'Pick<T, NonFunctionPropertyNames<T>>'.
|
||||
!!! error TS2322: Type 'NonFunctionPropertyNames<T>' is not assignable to type 'FunctionPropertyNames<T>'.
|
||||
}
|
||||
|
||||
function f8<T>(x: keyof T, y: FunctionPropertyNames<T>, z: NonFunctionPropertyNames<T>) {
|
||||
@@ -208,24 +208,24 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS
|
||||
x = z;
|
||||
y = x; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'FunctionPropertyNames<T>'.
|
||||
!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
y = z; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'NonFunctionPropertyNames<T>' is not assignable to type 'FunctionPropertyNames<T>'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'never'.
|
||||
!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'never'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'never'.
|
||||
z = x; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'NonFunctionPropertyNames<T>'.
|
||||
!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
z = y; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'FunctionPropertyNames<T>' is not assignable to type 'NonFunctionPropertyNames<T>'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'never'.
|
||||
}
|
||||
|
||||
@@ -227,95 +227,95 @@ interface Part {
|
||||
}
|
||||
|
||||
type FunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? K : never }[keyof T];
|
||||
>FunctionPropertyNames : { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]
|
||||
>FunctionPropertyNames : FunctionPropertyNames<T>
|
||||
|
||||
type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>;
|
||||
>FunctionProperties : Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>
|
||||
>FunctionProperties : Pick<T, FunctionPropertyNames<T>>
|
||||
|
||||
type NonFunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? never : K }[keyof T];
|
||||
>NonFunctionPropertyNames : { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]
|
||||
>NonFunctionPropertyNames : NonFunctionPropertyNames<T>
|
||||
|
||||
type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>;
|
||||
>NonFunctionProperties : Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>
|
||||
>NonFunctionProperties : Pick<T, NonFunctionPropertyNames<T>>
|
||||
|
||||
type T30 = FunctionProperties<Part>;
|
||||
>T30 : Pick<Part, "updatePart">
|
||||
|
||||
type T31 = NonFunctionProperties<Part>;
|
||||
>T31 : Pick<Part, "id" | "name" | "subparts">
|
||||
>T31 : Pick<Part, NonFunctionPropertyNames<Part>>
|
||||
|
||||
function f7<T>(x: T, y: FunctionProperties<T>, z: NonFunctionProperties<T>) {
|
||||
>f7 : <T>(x: T, y: FunctionProperties<T>, z: NonFunctionProperties<T>) => void
|
||||
>x : T
|
||||
>y : Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>
|
||||
>z : Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>
|
||||
>y : Pick<T, FunctionPropertyNames<T>>
|
||||
>z : Pick<T, NonFunctionPropertyNames<T>>
|
||||
|
||||
x = y; // Error
|
||||
>x = y : Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>
|
||||
>x = y : Pick<T, FunctionPropertyNames<T>>
|
||||
>x : T
|
||||
>y : Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>
|
||||
>y : Pick<T, FunctionPropertyNames<T>>
|
||||
|
||||
x = z; // Error
|
||||
>x = z : Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>
|
||||
>x = z : Pick<T, NonFunctionPropertyNames<T>>
|
||||
>x : T
|
||||
>z : Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>
|
||||
>z : Pick<T, NonFunctionPropertyNames<T>>
|
||||
|
||||
y = x;
|
||||
>y = x : T
|
||||
>y : Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>
|
||||
>y : Pick<T, FunctionPropertyNames<T>>
|
||||
>x : T
|
||||
|
||||
y = z; // Error
|
||||
>y = z : Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>
|
||||
>y : Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>
|
||||
>z : Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>
|
||||
>y = z : Pick<T, NonFunctionPropertyNames<T>>
|
||||
>y : Pick<T, FunctionPropertyNames<T>>
|
||||
>z : Pick<T, NonFunctionPropertyNames<T>>
|
||||
|
||||
z = x;
|
||||
>z = x : T
|
||||
>z : Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>
|
||||
>z : Pick<T, NonFunctionPropertyNames<T>>
|
||||
>x : T
|
||||
|
||||
z = y; // Error
|
||||
>z = y : Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>
|
||||
>z : Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>
|
||||
>y : Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>
|
||||
>z = y : Pick<T, FunctionPropertyNames<T>>
|
||||
>z : Pick<T, NonFunctionPropertyNames<T>>
|
||||
>y : Pick<T, FunctionPropertyNames<T>>
|
||||
}
|
||||
|
||||
function f8<T>(x: keyof T, y: FunctionPropertyNames<T>, z: NonFunctionPropertyNames<T>) {
|
||||
>f8 : <T>(x: keyof T, y: FunctionPropertyNames<T>, z: NonFunctionPropertyNames<T>) => void
|
||||
>x : keyof T
|
||||
>y : { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]
|
||||
>z : { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]
|
||||
>y : FunctionPropertyNames<T>
|
||||
>z : NonFunctionPropertyNames<T>
|
||||
|
||||
x = y;
|
||||
>x = y : { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]
|
||||
>x = y : FunctionPropertyNames<T>
|
||||
>x : keyof T
|
||||
>y : { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]
|
||||
>y : FunctionPropertyNames<T>
|
||||
|
||||
x = z;
|
||||
>x = z : { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]
|
||||
>x = z : NonFunctionPropertyNames<T>
|
||||
>x : keyof T
|
||||
>z : { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]
|
||||
>z : NonFunctionPropertyNames<T>
|
||||
|
||||
y = x; // Error
|
||||
>y = x : keyof T
|
||||
>y : { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]
|
||||
>y : FunctionPropertyNames<T>
|
||||
>x : keyof T
|
||||
|
||||
y = z; // Error
|
||||
>y = z : { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]
|
||||
>y : { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]
|
||||
>z : { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]
|
||||
>y = z : NonFunctionPropertyNames<T>
|
||||
>y : FunctionPropertyNames<T>
|
||||
>z : NonFunctionPropertyNames<T>
|
||||
|
||||
z = x; // Error
|
||||
>z = x : keyof T
|
||||
>z : { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]
|
||||
>z : NonFunctionPropertyNames<T>
|
||||
>x : keyof T
|
||||
|
||||
z = y; // Error
|
||||
>z = y : { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]
|
||||
>z : { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]
|
||||
>y : { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]
|
||||
>z = y : FunctionPropertyNames<T>
|
||||
>z : NonFunctionPropertyNames<T>
|
||||
>y : FunctionPropertyNames<T>
|
||||
}
|
||||
|
||||
type DeepReadonly<T> =
|
||||
@@ -933,7 +933,7 @@ function f50() {
|
||||
// Repro from #21862
|
||||
|
||||
type OldDiff<T extends keyof any, U extends keyof any> = (
|
||||
>OldDiff : ({ [P in T]: P; } & { [P in U]: never; } & { [x: string]: never; })[T]
|
||||
>OldDiff : OldDiff<T, U>
|
||||
|
||||
& { [P in T]: P; }
|
||||
& { [P in U]: never; }
|
||||
@@ -953,7 +953,7 @@ interface B1 extends A {
|
||||
>b : "b"
|
||||
|
||||
c: OldDiff<keyof this, keyof A>;
|
||||
>c : ({ [P in keyof this]: P; } & { a: never; } & { [x: string]: never; })[keyof this]
|
||||
>c : OldDiff<keyof this, "a">
|
||||
}
|
||||
interface B2 extends A {
|
||||
b: 'b';
|
||||
@@ -963,27 +963,27 @@ interface B2 extends A {
|
||||
>c : NewDiff<keyof this, "a">
|
||||
}
|
||||
type c1 = B1['c']; // 'c' | 'b'
|
||||
>c1 : "b" | "c"
|
||||
>c1 : OldDiff<"a" | "b" | "c", "a">
|
||||
|
||||
type c2 = B2['c']; // 'c' | 'b'
|
||||
>c2 : "b" | "c"
|
||||
>c2 : OldDiff<"a" | "b" | "c", "a">
|
||||
|
||||
// Repro from #21929
|
||||
|
||||
type NonFooKeys1<T extends object> = OldDiff<keyof T, 'foo'>;
|
||||
>NonFooKeys1 : ({ [P in keyof T]: P; } & { foo: never; } & { [x: string]: never; })[keyof T]
|
||||
>NonFooKeys1 : OldDiff<keyof T, "foo">
|
||||
|
||||
type NonFooKeys2<T extends object> = Exclude<keyof T, 'foo'>;
|
||||
>NonFooKeys2 : Exclude<keyof T, "foo">
|
||||
|
||||
type Test1 = NonFooKeys1<{foo: 1, bar: 2, baz: 3}>; // "bar" | "baz"
|
||||
>Test1 : "bar" | "baz"
|
||||
>Test1 : OldDiff<"foo" | "bar" | "baz", "foo">
|
||||
>foo : 1
|
||||
>bar : 2
|
||||
>baz : 3
|
||||
|
||||
type Test2 = NonFooKeys2<{foo: 1, bar: 2, baz: 3}>; // "bar" | "baz"
|
||||
>Test2 : "bar" | "baz"
|
||||
>Test2 : OldDiff<"foo" | "bar" | "baz", "foo">
|
||||
>foo : 1
|
||||
>bar : 2
|
||||
>baz : 3
|
||||
|
||||
@@ -489,18 +489,18 @@ declare type IResponse<T> = {
|
||||
|
||||
sendValue(name: keyof GetAllPropertiesOfType<T, string>): void;
|
||||
>sendValue : (name: keyof GetAllPropertiesOfType<T, string>) => void
|
||||
>name : { [PropertyName in Extract<keyof T, string>]: Required<T>[PropertyName] extends string ? PropertyName : never; }[Extract<keyof T, string>]
|
||||
>name : GetPropertyNamesOfType<Required<T>, string>
|
||||
|
||||
};
|
||||
|
||||
declare type GetPropertyNamesOfType<T, RestrictToType> = {
|
||||
>GetPropertyNamesOfType : { [PropertyName in Extract<keyof T, string>]: T[PropertyName] extends RestrictToType ? PropertyName : never; }[Extract<keyof T, string>]
|
||||
>GetPropertyNamesOfType : GetPropertyNamesOfType<T, RestrictToType>
|
||||
|
||||
[PropertyName in Extract<keyof T, string>]: T[PropertyName] extends RestrictToType ? PropertyName : never
|
||||
}[Extract<keyof T, string>];
|
||||
|
||||
declare type GetAllPropertiesOfType<T, RestrictToType> = Pick<
|
||||
>GetAllPropertiesOfType : Pick<T, { [PropertyName in Extract<keyof T, string>]: Required<T>[PropertyName] extends RestrictToType ? PropertyName : never; }[Extract<keyof T, string>]>
|
||||
>GetAllPropertiesOfType : Pick<T, GetPropertyNamesOfType<Required<T>, RestrictToType>>
|
||||
|
||||
T,
|
||||
GetPropertyNamesOfType<Required<T>, RestrictToType>
|
||||
|
||||
+23
-23
@@ -92,39 +92,39 @@ void p3.result.three;
|
||||
//// [declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.d.ts]
|
||||
export declare type Key<U> = keyof U;
|
||||
export declare type Value<K extends Key<U>, U> = U[K];
|
||||
export declare const updateIfChanged: <T>(t: T) => (<K extends keyof T>(key: K) => (<K_1 extends keyof T[K]>(key: K_1) => (<K_2 extends keyof T[K][K_1]>(key: K_2) => (<K_3 extends keyof T[K][K_1][K_2]>(key: K_3) => (<K_4 extends keyof T[K][K_1][K_2][K_3]>(key: K_4) => (<K_5 extends keyof T[K][K_1][K_2][K_3][K_4]>(key: K_5) => (<K_6 extends keyof T[K][K_1][K_2][K_3][K_4][K_5]>(key: K_6) => (<K_7 extends keyof T[K][K_1][K_2][K_3][K_4][K_5][K_6]>(key: K_7) => (<K_8 extends keyof T[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7]>(key: K_8) => (<K_9 extends keyof T[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8]>(key: K_9) => (<K_10 extends keyof T[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9]>(key: K_10) => any & {
|
||||
map: (updater: (u: T[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9][K_10]) => T[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9][K_10]) => T;
|
||||
set: (newU: T[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9][K_10]) => T;
|
||||
export declare const updateIfChanged: <T>(t: T) => (<K extends keyof T>(key: K) => (<K_1 extends keyof Value<K, T>>(key: K_1) => (<K_2 extends keyof Value<K_1, Value<K, T>>>(key: K_2) => (<K_3 extends keyof Value<K_2, Value<K_1, Value<K, T>>>>(key: K_3) => (<K_4 extends keyof Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>(key: K_4) => (<K_5 extends keyof Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>(key: K_5) => (<K_6 extends keyof Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>(key: K_6) => (<K_7 extends keyof Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>(key: K_7) => (<K_8 extends keyof Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>(key: K_8) => (<K_9 extends keyof Value<K_8, Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>>(key: K_9) => (<K_10 extends keyof Value<K_9, Value<K_8, Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>>>(key: K_10) => any & {
|
||||
map: (updater: (u: Value<K_10, Value<K_9, Value<K_8, Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>>>) => Value<K_10, Value<K_9, Value<K_8, Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>>>) => T;
|
||||
set: (newU: Value<K_10, Value<K_9, Value<K_8, Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>>>) => T;
|
||||
}) & {
|
||||
map: (updater: (u: T[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9]) => T[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9]) => T;
|
||||
set: (newU: T[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8][K_9]) => T;
|
||||
map: (updater: (u: Value<K_9, Value<K_8, Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>>) => Value<K_9, Value<K_8, Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>>) => T;
|
||||
set: (newU: Value<K_9, Value<K_8, Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>>) => T;
|
||||
}) & {
|
||||
map: (updater: (u: T[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8]) => T[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8]) => T;
|
||||
set: (newU: T[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7][K_8]) => T;
|
||||
map: (updater: (u: Value<K_8, Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>) => Value<K_8, Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>) => T;
|
||||
set: (newU: Value<K_8, Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>) => T;
|
||||
}) & {
|
||||
map: (updater: (u: T[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7]) => T[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7]) => T;
|
||||
set: (newU: T[K][K_1][K_2][K_3][K_4][K_5][K_6][K_7]) => T;
|
||||
map: (updater: (u: Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>) => Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>) => T;
|
||||
set: (newU: Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>) => T;
|
||||
}) & {
|
||||
map: (updater: (u: T[K][K_1][K_2][K_3][K_4][K_5][K_6]) => T[K][K_1][K_2][K_3][K_4][K_5][K_6]) => T;
|
||||
set: (newU: T[K][K_1][K_2][K_3][K_4][K_5][K_6]) => T;
|
||||
map: (updater: (u: Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>) => Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>) => T;
|
||||
set: (newU: Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>) => T;
|
||||
}) & {
|
||||
map: (updater: (u: T[K][K_1][K_2][K_3][K_4][K_5]) => T[K][K_1][K_2][K_3][K_4][K_5]) => T;
|
||||
set: (newU: T[K][K_1][K_2][K_3][K_4][K_5]) => T;
|
||||
map: (updater: (u: Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>) => Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>) => T;
|
||||
set: (newU: Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>) => T;
|
||||
}) & {
|
||||
map: (updater: (u: T[K][K_1][K_2][K_3][K_4]) => T[K][K_1][K_2][K_3][K_4]) => T;
|
||||
set: (newU: T[K][K_1][K_2][K_3][K_4]) => T;
|
||||
map: (updater: (u: Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>) => Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>) => T;
|
||||
set: (newU: Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>) => T;
|
||||
}) & {
|
||||
map: (updater: (u: T[K][K_1][K_2][K_3]) => T[K][K_1][K_2][K_3]) => T;
|
||||
set: (newU: T[K][K_1][K_2][K_3]) => T;
|
||||
map: (updater: (u: Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>) => Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>) => T;
|
||||
set: (newU: Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>) => T;
|
||||
}) & {
|
||||
map: (updater: (u: T[K][K_1][K_2]) => T[K][K_1][K_2]) => T;
|
||||
set: (newU: T[K][K_1][K_2]) => T;
|
||||
map: (updater: (u: Value<K_2, Value<K_1, Value<K, T>>>) => Value<K_2, Value<K_1, Value<K, T>>>) => T;
|
||||
set: (newU: Value<K_2, Value<K_1, Value<K, T>>>) => T;
|
||||
}) & {
|
||||
map: (updater: (u: T[K][K_1]) => T[K][K_1]) => T;
|
||||
set: (newU: T[K][K_1]) => T;
|
||||
map: (updater: (u: Value<K_1, Value<K, T>>) => Value<K_1, Value<K, T>>) => T;
|
||||
set: (newU: Value<K_1, Value<K, T>>) => T;
|
||||
}) & {
|
||||
map: (updater: (u: T[K]) => T[K]) => T;
|
||||
set: (newU: T[K]) => T;
|
||||
map: (updater: (u: Value<K, T>) => Value<K, T>) => T;
|
||||
set: (newU: Value<K, T>) => T;
|
||||
}) & {
|
||||
map: (updater: (u: T) => T) => T;
|
||||
set: (newU: T) => T;
|
||||
|
||||
+17
-17
@@ -7,16 +7,16 @@ export type Key<U> = keyof U;
|
||||
>Key : keyof U
|
||||
|
||||
export type Value<K extends Key<U>, U> = U[K];
|
||||
>Value : U[K]
|
||||
>Value : Value<K, U>
|
||||
|
||||
export const updateIfChanged = <T>(t: T) => {
|
||||
>updateIfChanged : <T>(t: T) => (<K extends keyof T>(key: K) => (<K extends keyof T[K]>(key: K) => (<K extends keyof T[K][K]>(key: K) => (<K extends keyof T[K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K][K][K][K][K][K]>(key: K) => any & { map: (updater: (u: T[K][K][K][K][K][K][K][K][K][K][K]) => T[K][K][K][K][K][K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K][K][K][K][K][K]) => T[K][K][K][K][K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K][K][K][K][K]) => T[K][K][K][K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K][K][K][K]) => T[K][K][K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K][K][K]) => T[K][K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K][K]) => T[K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K]) => T[K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K]) => T[K][K][K][K]) => T; set: (newU: T[K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K]) => T[K][K][K]) => T; set: (newU: T[K][K][K]) => T; }) & { map: (updater: (u: T[K][K]) => T[K][K]) => T; set: (newU: T[K][K]) => T; }) & { map: (updater: (u: T[K]) => T[K]) => T; set: (newU: T[K]) => T; }) & { map: (updater: (u: T) => T) => T; set: (newU: T) => T; }
|
||||
><T>(t: T) => { const reduce = <U>(u: U, update: (u: U) => T) => { const set = (newU: U) => Object.is(u, newU) ? t : update(newU); return 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 }); }; return reduce<T>(t, (t: T) => t);} : <T>(t: T) => (<K extends keyof T>(key: K) => (<K extends keyof T[K]>(key: K) => (<K extends keyof T[K][K]>(key: K) => (<K extends keyof T[K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K][K][K][K][K][K]>(key: K) => any & { map: (updater: (u: T[K][K][K][K][K][K][K][K][K][K][K]) => T[K][K][K][K][K][K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K][K][K][K][K][K]) => T[K][K][K][K][K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K][K][K][K][K]) => T[K][K][K][K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K][K][K][K]) => T[K][K][K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K][K][K]) => T[K][K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K][K]) => T[K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K]) => T[K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K]) => T[K][K][K][K]) => T; set: (newU: T[K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K]) => T[K][K][K]) => T; set: (newU: T[K][K][K]) => T; }) & { map: (updater: (u: T[K][K]) => T[K][K]) => T; set: (newU: T[K][K]) => T; }) & { map: (updater: (u: T[K]) => T[K]) => T; set: (newU: T[K]) => T; }) & { map: (updater: (u: T) => T) => T; set: (newU: T) => T; }
|
||||
>updateIfChanged : <T>(t: T) => (<K extends keyof T>(key: K) => (<K extends keyof Value<K, T>>(key: K) => (<K extends keyof Value<K, Value<K, T>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, T>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, T>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>>(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, T>>>>>>>>>>>(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, T>>>>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>>>) => 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, T>>>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, T>>>>) => Value<K, Value<K, Value<K, Value<K, T>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, T>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, T>>>) => Value<K, Value<K, Value<K, T>>>) => T; set: (newU: Value<K, Value<K, Value<K, T>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, T>>) => Value<K, Value<K, T>>) => T; set: (newU: Value<K, Value<K, T>>) => T; }) & { map: (updater: (u: Value<K, T>) => Value<K, T>) => T; set: (newU: Value<K, T>) => T; }) & { map: (updater: (u: T) => T) => T; set: (newU: T) => T; }
|
||||
><T>(t: T) => { const reduce = <U>(u: U, update: (u: U) => T) => { const set = (newU: U) => Object.is(u, newU) ? t : update(newU); return 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 }); }; return reduce<T>(t, (t: T) => t);} : <T>(t: T) => (<K extends keyof T>(key: K) => (<K extends keyof Value<K, T>>(key: K) => (<K extends keyof Value<K, Value<K, T>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, T>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, T>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>>(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, T>>>>>>>>>>>(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, T>>>>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>>>) => 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, T>>>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, T>>>>) => Value<K, Value<K, Value<K, Value<K, T>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, T>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, T>>>) => Value<K, Value<K, Value<K, T>>>) => T; set: (newU: Value<K, Value<K, Value<K, T>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, T>>) => Value<K, Value<K, T>>) => T; set: (newU: Value<K, Value<K, T>>) => T; }) & { map: (updater: (u: Value<K, T>) => Value<K, T>) => T; set: (newU: Value<K, T>) => T; }) & { map: (updater: (u: T) => T) => T; set: (newU: T) => T; }
|
||||
>t : T
|
||||
|
||||
const reduce = <U>(u: U, update: (u: U) => T) => {
|
||||
>reduce : <U>(u: U, update: (u: U) => T) => (<K extends keyof U>(key: K) => (<K extends keyof U[K]>(key: K) => (<K extends keyof U[K][K]>(key: K) => (<K extends keyof U[K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K][K][K]>(key: K) => any & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K]) => U[K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K]) => U[K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K]) => U[K][K][K][K]) => T; set: (newU: U[K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K]) => U[K][K][K]) => T; set: (newU: U[K][K][K]) => T; }) & { map: (updater: (u: U[K][K]) => U[K][K]) => T; set: (newU: U[K][K]) => T; }) & { map: (updater: (u: U[K]) => U[K]) => T; set: (newU: U[K]) => T; }) & { map: (updater: (u: U) => U) => T; set: (newU: U) => T; }
|
||||
><U>(u: U, update: (u: U) => T) => { const set = (newU: U) => Object.is(u, newU) ? t : update(newU); return 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 }); } : <U>(u: U, update: (u: U) => T) => (<K extends keyof U>(key: K) => (<K extends keyof U[K]>(key: K) => (<K extends keyof U[K][K]>(key: K) => (<K extends keyof U[K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K][K][K]>(key: K) => any & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K]) => U[K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K]) => U[K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K]) => U[K][K][K][K]) => T; set: (newU: U[K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K]) => U[K][K][K]) => T; set: (newU: U[K][K][K]) => T; }) & { map: (updater: (u: U[K][K]) => U[K][K]) => T; set: (newU: U[K][K]) => T; }) & { map: (updater: (u: U[K]) => U[K]) => T; set: (newU: U[K]) => T; }) & { map: (updater: (u: U) => U) => T; set: (newU: U) => T; }
|
||||
>reduce : <U>(u: U, update: (u: U) => T) => (<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; }
|
||||
><U>(u: U, update: (u: U) => T) => { const set = (newU: U) => Object.is(u, newU) ? t : update(newU); return 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 }); } : <U>(u: U, update: (u: U) => T) => (<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; }
|
||||
>u : U
|
||||
>update : (u: U) => T
|
||||
>u : U
|
||||
@@ -38,30 +38,30 @@ 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 U[K]>(key: K) => (<K extends keyof U[K][K]>(key: K) => (<K extends keyof U[K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K][K][K]>(key: K) => any & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K][K][K]) => U) => T; set: (newU: U[K][K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K][K]) => U) => T; set: (newU: U[K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K]) => U) => T; set: (newU: U[K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K]) => U) => T; set: (newU: U[K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K]) => U) => T; set: (newU: U[K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K]) => U) => T; set: (newU: U[K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K]) => U) => T; set: (newU: U[K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K]) => U) => T; set: (newU: U[K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K]) => U) => T; set: (newU: U[K][K][K]) => T; }) & { map: (updater: (u: U[K][K]) => U) => T; set: (newU: U[K][K]) => T; }) & { map: (updater: (u: U[K]) => U) => T; set: (newU: U[K]) => 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>>>>>>>>>>>) => 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 : { <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 U[K]>(key: K) => (<K extends keyof U[K][K]>(key: K) => (<K extends keyof U[K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K][K][K]>(key: K) => any & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K][K][K]) => U) => T; set: (newU: U[K][K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K][K]) => U) => T; set: (newU: U[K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K]) => U) => T; set: (newU: U[K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K]) => U) => T; set: (newU: U[K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K]) => U) => T; set: (newU: U[K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K]) => U) => T; set: (newU: U[K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K]) => U) => T; set: (newU: U[K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K]) => U) => T; set: (newU: U[K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K]) => U) => T; set: (newU: U[K][K][K]) => T; }) & { map: (updater: (u: U[K][K]) => U) => T; set: (newU: U[K][K]) => T; }) & { map: (updater: (u: U[K]) => U) => T; set: (newU: U[K]) => 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>>>>>>>>>>>) => 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; }
|
||||
>key : K
|
||||
|
||||
reduce<Value<K, U>>(u[key as keyof U] as Value<K, U>, (v: Value<K, U>) => {
|
||||
>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[K]>(key: K) => (<K extends keyof U[K][K]>(key: K) => (<K extends keyof U[K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K][K][K][K]>(key: K) => any & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K]) => U[K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K]) => U[K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K]) => U[K][K][K][K]) => T; set: (newU: U[K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K]) => U[K][K][K]) => T; set: (newU: U[K][K][K]) => T; }) & { map: (updater: (u: U[K][K]) => U[K][K]) => T; set: (newU: U[K][K]) => T; }) & { map: (updater: (u: U[K]) => U[K]) => T; set: (newU: U[K]) => T; }
|
||||
>reduce : <U>(u: U, update: (u: U) => T) => (<K extends keyof U>(key: K) => (<K extends keyof U[K]>(key: K) => (<K extends keyof U[K][K]>(key: K) => (<K extends keyof U[K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K][K][K]>(key: K) => any & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K]) => U[K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K]) => U[K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K]) => U[K][K][K][K]) => T; set: (newU: U[K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K]) => U[K][K][K]) => T; set: (newU: U[K][K][K]) => T; }) & { map: (updater: (u: U[K][K]) => U[K][K]) => T; set: (newU: U[K][K]) => T; }) & { map: (updater: (u: U[K]) => U[K]) => T; set: (newU: U[K]) => T; }) & { map: (updater: (u: U) => U) => T; set: (newU: U) => T; }
|
||||
>u[key as keyof U] as Value<K, U> : U[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 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) => (<K extends keyof Value<K, 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, 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, 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, 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, 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; }
|
||||
>reduce : <U>(u: U, update: (u: U) => T) => (<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; }
|
||||
>u[key as keyof U] as Value<K, U> : Value<K, U>
|
||||
>u[key as keyof U] : U[keyof U]
|
||||
>u : U
|
||||
>key as keyof U : keyof U
|
||||
>key : K
|
||||
>(v: Value<K, U>) => { return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })); } : (v: Value<K, U>) => T
|
||||
>v : U[K]
|
||||
>v : Value<K, U>
|
||||
|
||||
return update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v }));
|
||||
>update(Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v })) : T
|
||||
>update : (u: U) => T
|
||||
>Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v }) : U & { [x: string]: U[K]; }
|
||||
>Object.assign(Array.isArray(u) ? [] : {}, u, { [key]: v }) : U & { [x: string]: Value<K, U>; }
|
||||
>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; }
|
||||
@@ -74,10 +74,10 @@ export const updateIfChanged = <T>(t: T) => {
|
||||
>[] : undefined[]
|
||||
>{} : {}
|
||||
>u : U
|
||||
>{ [key]: v } : { [x: string]: U[K]; }
|
||||
>[key] : U[K]
|
||||
>{ [key]: v } : { [x: string]: Value<K, U>; }
|
||||
>[key] : Value<K, U>
|
||||
>key : K
|
||||
>v : U[K]
|
||||
>v : Value<K, U>
|
||||
|
||||
}),
|
||||
{ map: (updater: (u: U) => U) => set(updater(u)), set });
|
||||
@@ -95,8 +95,8 @@ export const updateIfChanged = <T>(t: T) => {
|
||||
|
||||
};
|
||||
return reduce<T>(t, (t: T) => t);
|
||||
>reduce<T>(t, (t: T) => t) : (<K extends keyof T>(key: K) => (<K extends keyof T[K]>(key: K) => (<K extends keyof T[K][K]>(key: K) => (<K extends keyof T[K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof T[K][K][K][K][K][K][K][K][K][K]>(key: K) => any & { map: (updater: (u: T[K][K][K][K][K][K][K][K][K][K][K]) => T[K][K][K][K][K][K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K][K][K][K][K][K]) => T[K][K][K][K][K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K][K][K][K][K]) => T[K][K][K][K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K][K][K][K]) => T[K][K][K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K][K][K]) => T[K][K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K][K]) => T[K][K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K][K]) => T[K][K][K][K][K]) => T; set: (newU: T[K][K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K][K]) => T[K][K][K][K]) => T; set: (newU: T[K][K][K][K]) => T; }) & { map: (updater: (u: T[K][K][K]) => T[K][K][K]) => T; set: (newU: T[K][K][K]) => T; }) & { map: (updater: (u: T[K][K]) => T[K][K]) => T; set: (newU: T[K][K]) => T; }) & { map: (updater: (u: T[K]) => T[K]) => T; set: (newU: T[K]) => T; }) & { map: (updater: (u: T) => T) => T; set: (newU: T) => T; }
|
||||
>reduce : <U>(u: U, update: (u: U) => T) => (<K extends keyof U>(key: K) => (<K extends keyof U[K]>(key: K) => (<K extends keyof U[K][K]>(key: K) => (<K extends keyof U[K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K][K]>(key: K) => (<K extends keyof U[K][K][K][K][K][K][K][K][K][K]>(key: K) => any & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K][K]) => U[K][K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K][K]) => U[K][K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K][K]) => U[K][K][K][K][K]) => T; set: (newU: U[K][K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K][K]) => U[K][K][K][K]) => T; set: (newU: U[K][K][K][K]) => T; }) & { map: (updater: (u: U[K][K][K]) => U[K][K][K]) => T; set: (newU: U[K][K][K]) => T; }) & { map: (updater: (u: U[K][K]) => U[K][K]) => T; set: (newU: U[K][K]) => T; }) & { map: (updater: (u: U[K]) => U[K]) => T; set: (newU: U[K]) => T; }) & { map: (updater: (u: U) => U) => T; set: (newU: U) => T; }
|
||||
>reduce<T>(t, (t: T) => t) : (<K extends keyof T>(key: K) => (<K extends keyof Value<K, T>>(key: K) => (<K extends keyof Value<K, Value<K, T>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, T>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, T>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>(key: K) => (<K extends keyof Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>>(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, T>>>>>>>>>>>(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, T>>>>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>>>) => 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, T>>>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>) => Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, Value<K, T>>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, Value<K, T>>>>) => Value<K, Value<K, Value<K, Value<K, T>>>>) => T; set: (newU: Value<K, Value<K, Value<K, Value<K, T>>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, Value<K, T>>>) => Value<K, Value<K, Value<K, T>>>) => T; set: (newU: Value<K, Value<K, Value<K, T>>>) => T; }) & { map: (updater: (u: Value<K, Value<K, T>>) => Value<K, Value<K, T>>) => T; set: (newU: Value<K, Value<K, T>>) => T; }) & { map: (updater: (u: Value<K, T>) => Value<K, T>) => T; set: (newU: Value<K, T>) => T; }) & { map: (updater: (u: T) => T) => T; set: (newU: T) => T; }
|
||||
>reduce : <U>(u: U, update: (u: U) => T) => (<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; }
|
||||
>t : T
|
||||
>(t: T) => t : (t: T) => T
|
||||
>t : T
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Repro from #17456
|
||||
|
||||
type StringContains<S extends string, L extends string> = (
|
||||
>StringContains : ({ [K in S]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>StringContains : StringContains<S, L>
|
||||
|
||||
{ [K in S]: 'true' } &
|
||||
{ [key: string]: 'false' }
|
||||
@@ -11,10 +11,10 @@ type StringContains<S extends string, L extends string> = (
|
||||
)[L]
|
||||
|
||||
type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>
|
||||
>ObjectHasKey : ({ [K in Extract<keyof O, string>]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>ObjectHasKey : StringContains<Extract<keyof O, string>, L>
|
||||
|
||||
type First<T> = ObjectHasKey<T, '0'>; // Should be deferred
|
||||
>First : ({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["0"]
|
||||
>First : StringContains<Extract<keyof T, string>, "0">
|
||||
|
||||
type T1 = ObjectHasKey<{ a: string }, 'a'>; // 'true'
|
||||
>T1 : "true"
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
// Repro from #17456
|
||||
|
||||
type StringContains<S extends string, L extends string> = ({ [K in S]: 'true' } & { [key: string]: 'false'})[L];
|
||||
>StringContains : ({ [K in S]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>StringContains : StringContains<S, L>
|
||||
>key : string
|
||||
|
||||
type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>;
|
||||
>ObjectHasKey : ({ [K in Extract<keyof O, string>]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>ObjectHasKey : StringContains<Extract<keyof O, string>, L>
|
||||
|
||||
type A<T> = ObjectHasKey<T, '0'>;
|
||||
>A : ({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["0"]
|
||||
>A : StringContains<Extract<keyof T, string>, "0">
|
||||
|
||||
type B = ObjectHasKey<[string, number], '1'>; // "true"
|
||||
>B : "true"
|
||||
@@ -22,21 +22,21 @@ type D = A<[string]>; // "true"
|
||||
|
||||
// Error, "false" not handled
|
||||
type E<T> = { true: 'true' }[ObjectHasKey<T, '1'>];
|
||||
>E : { true: 'true'; }[({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["1"]]
|
||||
>E : E<T>
|
||||
>true : "true"
|
||||
|
||||
type Juxtapose<T> = ({ true: 'otherwise' } & { [k: string]: 'true' })[ObjectHasKey<T, '1'>];
|
||||
>Juxtapose : ({ true: 'otherwise'; } & { [k: string]: "true"; })[({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["1"]]
|
||||
>Juxtapose : Juxtapose<T>
|
||||
>true : "otherwise"
|
||||
>k : string
|
||||
|
||||
// Error, "otherwise" is missing
|
||||
type DeepError<T> = { true: 'true' }[Juxtapose<T>];
|
||||
>DeepError : { true: 'true'; }[({ true: "otherwise"; } & { [k: string]: "true"; })[({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["1"]]]
|
||||
>DeepError : DeepError<T>
|
||||
>true : "true"
|
||||
|
||||
type DeepOK<T> = { true: 'true', otherwise: 'false' }[Juxtapose<T>];
|
||||
>DeepOK : { true: 'true'; otherwise: 'false'; }[({ true: "otherwise"; } & { [k: string]: "true"; })[({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["1"]]]
|
||||
>DeepOK : DeepOK<T>
|
||||
>true : "true"
|
||||
>otherwise : "false"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/compiler/genericNumberIndex.ts ===
|
||||
type X<I extends number> = ['a'][I];
|
||||
>X : ["a"][I]
|
||||
>X : X<I>
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ type X<T extends A> = [T["a"], (T | B)["a"]];
|
||||
>X : X<T>
|
||||
|
||||
type Y<T extends A | B> = T["a"];
|
||||
>Y : T["a"]
|
||||
>Y : Y<T>
|
||||
|
||||
type Z<T extends A & B> = T["a"];
|
||||
>Z : T["a"]
|
||||
>Z : Z<T>
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
=== tests/cases/compiler/indexedAccessRetainsIndexSignature.ts ===
|
||||
type Diff<T extends keyof any, U extends keyof any> =
|
||||
>Diff : ({ [P in T]: P; } & { [P in U]: never; } & { [x: string]: never; })[T]
|
||||
>Diff : Diff<T, U>
|
||||
|
||||
({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T]
|
||||
>x : string
|
||||
|
||||
type Omit<U, K extends keyof U> = Pick<U, Diff<keyof U, K>>
|
||||
>Omit : Pick<U, ({ [P in keyof U]: P; } & { [P in K]: never; } & { [x: string]: never; })[keyof U]>
|
||||
>Omit : Pick<U, Diff<keyof U, K>>
|
||||
|
||||
type Omit1<U, K extends keyof U> = Pick<U, Diff<keyof U, K>>;
|
||||
>Omit1 : Pick<U, ({ [P in keyof U]: P; } & { [P in K]: never; } & { [x: string]: never; })[keyof U]>
|
||||
>Omit1 : Pick<U, Diff<keyof U, K>>
|
||||
|
||||
// is in fact an equivalent of
|
||||
|
||||
|
||||
@@ -97,13 +97,13 @@ const result6 = obj[key]
|
||||
|
||||
// Expanded examples from https://github.com/Microsoft/TypeScript/issues/21988
|
||||
type RequiredPropNames<T> = {
|
||||
>RequiredPropNames : { [P in keyof T]-?: undefined extends T[P] ? never : P; }[keyof T]
|
||||
>RequiredPropNames : RequiredPropNames<T>
|
||||
|
||||
[P in keyof T]-?: undefined extends T[P] ? never : P
|
||||
}[keyof T];
|
||||
|
||||
type OptionalPropNames<T> = {
|
||||
>OptionalPropNames : { [P in keyof T]-?: undefined extends T[P] ? P : never; }[keyof T]
|
||||
>OptionalPropNames : OptionalPropNames<T>
|
||||
|
||||
[P in keyof T]-?: undefined extends T[P] ? P : never
|
||||
}[keyof T];
|
||||
@@ -145,7 +145,7 @@ type P0 = {};
|
||||
>P0 : P0
|
||||
|
||||
type P3Names = RequiredPropNames<P3>; // expect 'a' | 'b'
|
||||
>P3Names : "a" | "b"
|
||||
>P3Names : RequiredPropNames<P3>
|
||||
|
||||
type P2Names = RequiredPropNames<P2>; // expect 'a'
|
||||
>P2Names : "a"
|
||||
@@ -214,7 +214,7 @@ type O0 = {};
|
||||
>O0 : O0
|
||||
|
||||
type O3Names = OptionalPropNames<O3>; // expect 'a' | 'b'
|
||||
>O3Names : "a" | "b"
|
||||
>O3Names : RequiredPropNames<P3>
|
||||
|
||||
type O2Names = OptionalPropNames<O2>; // expect 'a'
|
||||
>O2Names : "a"
|
||||
@@ -267,7 +267,7 @@ declare const o0Test: ExpectType<{}, O0Props>;
|
||||
// Repro from #23005
|
||||
|
||||
type Example<T extends Record<'a', string>> = T['a'];
|
||||
>Example : T["a"]
|
||||
>Example : Example<T>
|
||||
|
||||
type Res1 = Example<{ a: "x" } | { a: "y" }>; // "x" | "y"
|
||||
>Res1 : "x" | "y"
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -3,7 +3,7 @@ import React = require("react");
|
||||
>React : typeof React
|
||||
|
||||
type FunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? K : never }[keyof T];
|
||||
>FunctionPropertyNames : { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]
|
||||
>FunctionPropertyNames : FunctionPropertyNames<T>
|
||||
|
||||
class TestObject {
|
||||
>TestObject : TestObject
|
||||
@@ -25,7 +25,7 @@ interface TestProps<T> {
|
||||
>model : T
|
||||
|
||||
foo: FunctionPropertyNames<T>;
|
||||
>foo : { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]
|
||||
>foo : FunctionPropertyNames<T>
|
||||
}
|
||||
function Test<T>(props: TestProps<T>) { return <></>; }
|
||||
>Test : <T>(props: TestProps<T>) => JSX.Element
|
||||
|
||||
@@ -134,7 +134,7 @@ type Q11 = Shape["width" | "height"]; // number
|
||||
>Q11 : number
|
||||
|
||||
type Q12 = Shape["name" | "visible"]; // string | boolean
|
||||
>Q12 : string | boolean
|
||||
>Q12 : Q12
|
||||
|
||||
type Q20 = Shape[NAME]; // string
|
||||
>Q20 : string
|
||||
@@ -231,8 +231,8 @@ function f10(shape: Shape) {
|
||||
>"height" : "height"
|
||||
|
||||
let nameOrVisible = getProperty(shape, cond ? "name" : "visible"); // string | boolean
|
||||
>nameOrVisible : string | boolean
|
||||
>getProperty(shape, cond ? "name" : "visible") : string | boolean
|
||||
>nameOrVisible : Q12
|
||||
>getProperty(shape, cond ? "name" : "visible") : Q12
|
||||
>getProperty : <T, K extends keyof T>(obj: T, key: K) => T[K]
|
||||
>shape : Shape
|
||||
>cond ? "name" : "visible" : "name" | "visible"
|
||||
@@ -397,8 +397,8 @@ function f20(component: Component<Shape>) {
|
||||
>"height" : "height"
|
||||
|
||||
let nameOrVisible = component.getProperty(cond ? "name" : "visible"); // string | boolean
|
||||
>nameOrVisible : string | boolean
|
||||
>component.getProperty(cond ? "name" : "visible") : string | boolean
|
||||
>nameOrVisible : Q12
|
||||
>component.getProperty(cond ? "name" : "visible") : Q12
|
||||
>component.getProperty : <K extends "name" | "width" | "height" | "visible">(key: K) => Shape[K]
|
||||
>component : Component<Shape>
|
||||
>getProperty : <K extends "name" | "width" | "height" | "visible">(key: K) => Shape[K]
|
||||
@@ -474,8 +474,8 @@ function f30(shapes: Shape[]) {
|
||||
>"width" : "width"
|
||||
|
||||
let nameOrVisibles = pluck(shapes, cond ? "name" : "visible"); // (string | boolean)[]
|
||||
>nameOrVisibles : (string | boolean)[]
|
||||
>pluck(shapes, cond ? "name" : "visible") : (string | boolean)[]
|
||||
>nameOrVisibles : Q12[]
|
||||
>pluck(shapes, cond ? "name" : "visible") : Q12[]
|
||||
>pluck : <T, K extends keyof T>(array: T[], key: K) => T[K][]
|
||||
>shapes : Shape[]
|
||||
>cond ? "name" : "visible" : "name" | "visible"
|
||||
@@ -959,8 +959,8 @@ function f74(func: <T, U, K extends keyof (T | U)>(x: T, y: U, k: K) => (T | U)[
|
||||
>'a' : "a"
|
||||
|
||||
let b = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b'); // string | boolean
|
||||
>b : string | boolean
|
||||
>func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b') : string | boolean
|
||||
>b : Q12
|
||||
>func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b') : Q12
|
||||
>func : <T, U, K extends keyof T & keyof U>(x: T, y: U, k: K) => (T | U)[K]
|
||||
>{ a: 1, b: "hello" } : { a: number; b: string; }
|
||||
>a : number
|
||||
|
||||
@@ -344,11 +344,11 @@ export interface Entity {
|
||||
}
|
||||
|
||||
export type IdOf<E extends Entity> = E['id'];
|
||||
>IdOf : E["id"]
|
||||
>IdOf : IdOf<E>
|
||||
|
||||
export interface EntityState<E extends Entity> {
|
||||
ids: IdOf<E>[];
|
||||
>ids : E["id"][]
|
||||
>ids : IdOf<E>[]
|
||||
|
||||
entities: { [key: string]: E, [key: number]: E };
|
||||
>entities : { [key: string]: E; [key: number]: E; }
|
||||
@@ -362,48 +362,48 @@ export function getAllEntities<E extends Entity>(state: EntityState<E>): E[] {
|
||||
>state : EntityState<E>
|
||||
|
||||
const { ids, entities } = state;
|
||||
>ids : E["id"][]
|
||||
>ids : IdOf<E>[]
|
||||
>entities : { [key: string]: E; [key: number]: E; }
|
||||
>state : EntityState<E>
|
||||
|
||||
return ids.map(id => entities[id]);
|
||||
>ids.map(id => entities[id]) : { [key: string]: E; [key: number]: E; }[E["id"]][]
|
||||
>ids.map : <U>(callbackfn: (value: E["id"], index: number, array: E["id"][]) => U, thisArg?: any) => U[]
|
||||
>ids : E["id"][]
|
||||
>map : <U>(callbackfn: (value: E["id"], index: number, array: E["id"][]) => U, thisArg?: any) => U[]
|
||||
>id => entities[id] : (id: E["id"]) => { [key: string]: E; [key: number]: E; }[E["id"]]
|
||||
>id : E["id"]
|
||||
>entities[id] : { [key: string]: E; [key: number]: E; }[E["id"]]
|
||||
>ids.map(id => entities[id]) : { [key: string]: E; [key: number]: E; }[IdOf<E>][]
|
||||
>ids.map : <U>(callbackfn: (value: IdOf<E>, index: number, array: IdOf<E>[]) => U, thisArg?: any) => U[]
|
||||
>ids : IdOf<E>[]
|
||||
>map : <U>(callbackfn: (value: IdOf<E>, index: number, array: IdOf<E>[]) => U, thisArg?: any) => U[]
|
||||
>id => entities[id] : (id: IdOf<E>) => { [key: string]: E; [key: number]: E; }[IdOf<E>]
|
||||
>id : IdOf<E>
|
||||
>entities[id] : { [key: string]: E; [key: number]: E; }[IdOf<E>]
|
||||
>entities : { [key: string]: E; [key: number]: E; }
|
||||
>id : E["id"]
|
||||
>id : IdOf<E>
|
||||
}
|
||||
|
||||
export function getEntity<E extends Entity>(id: IdOf<E>, state: EntityState<E>): E | undefined {
|
||||
>getEntity : <E extends Entity>(id: IdOf<E>, state: EntityState<E>) => E | undefined
|
||||
>id : E["id"]
|
||||
>id : IdOf<E>
|
||||
>state : EntityState<E>
|
||||
|
||||
const { ids, entities } = state;
|
||||
>ids : E["id"][]
|
||||
>ids : IdOf<E>[]
|
||||
>entities : { [key: string]: E; [key: number]: E; }
|
||||
>state : EntityState<E>
|
||||
|
||||
if (!ids.includes(id)) {
|
||||
>!ids.includes(id) : boolean
|
||||
>ids.includes(id) : boolean
|
||||
>ids.includes : (searchElement: E["id"], fromIndex?: number | undefined) => boolean
|
||||
>ids : E["id"][]
|
||||
>includes : (searchElement: E["id"], fromIndex?: number | undefined) => boolean
|
||||
>id : E["id"]
|
||||
>ids.includes : (searchElement: IdOf<E>, fromIndex?: number | undefined) => boolean
|
||||
>ids : IdOf<E>[]
|
||||
>includes : (searchElement: IdOf<E>, fromIndex?: number | undefined) => boolean
|
||||
>id : IdOf<E>
|
||||
|
||||
return undefined;
|
||||
>undefined : undefined
|
||||
}
|
||||
|
||||
return entities[id];
|
||||
>entities[id] : { [key: string]: E; [key: number]: E; }[E["id"]]
|
||||
>entities[id] : { [key: string]: E; [key: number]: E; }[IdOf<E>]
|
||||
>entities : { [key: string]: E; [key: number]: E; }
|
||||
>id : E["id"]
|
||||
>id : IdOf<E>
|
||||
}
|
||||
|
||||
// Repro from #30603
|
||||
|
||||
@@ -82,7 +82,7 @@ type KeyofObj = keyof typeof obj;
|
||||
|
||||
// "str" | "num"
|
||||
type Values<T> = T[keyof T];
|
||||
>Values : T[keyof T]
|
||||
>Values : Values<T>
|
||||
|
||||
type ValuesOfObj = Values<typeof obj>;
|
||||
>ValuesOfObj : string | number
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Repro from #14837
|
||||
|
||||
type Foo<T extends "true", B> = { "true": Foo<T, Foo<T, B>> }[T];
|
||||
>Foo : { true: Foo<T, Foo<T, B>>; }[T]
|
||||
>"true" : { true: { true: { true: { true: { true: { true: { true: { true: { true: { true: { true: any[T]; }[T]; }[T]; }[T]; }[T]; }[T]; }[T]; }[T]; }[T]; }[T]; }[T]; }[T]
|
||||
>Foo : Foo<T, B>
|
||||
>"true" : Foo<T, Foo<T, B>>
|
||||
|
||||
let f1: Foo<"true", {}>;
|
||||
>f1 : any
|
||||
|
||||
@@ -17,7 +17,7 @@ type T1<K extends keyof AB> = { [key in AB[K]]: true };
|
||||
>true : true
|
||||
|
||||
type T2<K extends 'a'|'b'> = T1<K>[K]; // Error
|
||||
>T2 : T1<K>[K]
|
||||
>T2 : T2<K>
|
||||
|
||||
type R = AB[keyof AB]; // "a"
|
||||
>R : "a"
|
||||
@@ -27,17 +27,17 @@ type T3 = { [key in R]: true };
|
||||
>true : true
|
||||
|
||||
type T4<K extends 'a'|'b'> = T3[K] // Error
|
||||
>T4 : T3[K]
|
||||
>T4 : T4<K>
|
||||
|
||||
type T5<S extends 'a'|'b'|'extra'> = {[key in AB[S]]: true}[S]; // Error
|
||||
>T5 : { [key in AB[S]]: true; }[S]
|
||||
>T5 : T5<S>
|
||||
>true : true
|
||||
|
||||
type T6<S extends 'a'|'b', L extends 'a'|'b'> = {[key in AB[S]]: true}[L]; // Error
|
||||
>T6 : { [key in AB[S]]: true; }[L]
|
||||
>T6 : T6<S, L>
|
||||
>true : true
|
||||
|
||||
type T7<S extends 'a'|'b', L extends 'a'> = {[key in AB[S]]: true}[L];
|
||||
>T7 : { [key in AB[S]]: true; }[L]
|
||||
>T7 : T7<S, L>
|
||||
>true : true
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/mappedTypeIndexedAccess.ts(18,5): error TS2322: Type '{ key: "foo"; value: number; }' is not assignable to type '{ key: "foo"; value: string; } | { key: "bar"; value: number; }'.
|
||||
tests/cases/compiler/mappedTypeIndexedAccess.ts(18,5): error TS2322: Type '{ key: "foo"; value: number; }' is not assignable to type 'Pair<FooBar>'.
|
||||
Types of property 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/mappedTypeIndexedAccess.ts(24,5): error TS2322: Type '{ key: "foo"; value: number; }' is not assignable to type '{ key: "foo"; value: string; } | { key: "bar"; value: number; }'.
|
||||
tests/cases/compiler/mappedTypeIndexedAccess.ts(24,5): error TS2322: Type '{ key: "foo"; value: number; }' is not assignable to type 'Pair<FooBar>'.
|
||||
Types of property 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
|
||||
@@ -26,7 +26,7 @@ tests/cases/compiler/mappedTypeIndexedAccess.ts(24,5): error TS2322: Type '{ key
|
||||
// Error expected here
|
||||
let pair1: Pair<FooBar> = {
|
||||
~~~~~
|
||||
!!! error TS2322: Type '{ key: "foo"; value: number; }' is not assignable to type '{ key: "foo"; value: string; } | { key: "bar"; value: number; }'.
|
||||
!!! error TS2322: Type '{ key: "foo"; value: number; }' is not assignable to type 'Pair<FooBar>'.
|
||||
!!! error TS2322: Types of property 'value' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
key: "foo",
|
||||
@@ -36,7 +36,7 @@ tests/cases/compiler/mappedTypeIndexedAccess.ts(24,5): error TS2322: Type '{ key
|
||||
// Error expected here
|
||||
let pair2: Pairs<FooBar>[keyof FooBar] = {
|
||||
~~~~~
|
||||
!!! error TS2322: Type '{ key: "foo"; value: number; }' is not assignable to type '{ key: "foo"; value: string; } | { key: "bar"; value: number; }'.
|
||||
!!! error TS2322: Type '{ key: "foo"; value: number; }' is not assignable to type 'Pair<FooBar>'.
|
||||
!!! error TS2322: Types of property 'value' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
key: "foo",
|
||||
|
||||
@@ -15,7 +15,7 @@ type Pairs<T> = {
|
||||
};
|
||||
|
||||
type Pair<T> = Pairs<T>[keyof T];
|
||||
>Pair : Pairs<T>[keyof T]
|
||||
>Pair : Pair<T>
|
||||
|
||||
type FooBar = {
|
||||
>FooBar : FooBar
|
||||
@@ -30,7 +30,7 @@ type FooBar = {
|
||||
|
||||
// Error expected here
|
||||
let pair1: Pair<FooBar> = {
|
||||
>pair1 : { key: "foo"; value: string; } | { key: "bar"; value: number; }
|
||||
>pair1 : Pair<FooBar>
|
||||
>{ key: "foo", value: 3} : { key: "foo"; value: number; }
|
||||
|
||||
key: "foo",
|
||||
@@ -45,7 +45,7 @@ let pair1: Pair<FooBar> = {
|
||||
|
||||
// Error expected here
|
||||
let pair2: Pairs<FooBar>[keyof FooBar] = {
|
||||
>pair2 : { key: "foo"; value: string; } | { key: "bar"; value: number; }
|
||||
>pair2 : Pair<FooBar>
|
||||
>{ key: "foo", value: 3} : { key: "foo"; value: number; }
|
||||
|
||||
key: "foo",
|
||||
|
||||
@@ -12,11 +12,11 @@ export type IsOptional<T> = undefined | null extends T ? true : undefined extend
|
||||
>false : false
|
||||
|
||||
export type RequiredKeys<V> = { [K in keyof V]-?: Exclude<V[K], undefined> extends Validator<infer T> ? IsOptional<T> extends true ? never : K : never }[keyof V];
|
||||
>RequiredKeys : { [K in keyof V]-?: Exclude<V[K], undefined> extends Validator<infer T> ? IsOptional<T> extends true ? never : K : never; }[keyof V]
|
||||
>RequiredKeys : RequiredKeys<V>
|
||||
>true : true
|
||||
|
||||
export type OptionalKeys<V> = Exclude<keyof V, RequiredKeys<V>>;
|
||||
>OptionalKeys : Exclude<keyof V, { [K in keyof V]-?: Exclude<V[K], undefined> extends Validator<infer T> ? IsOptional<T> extends true ? never : K : never; }[keyof V]>
|
||||
>OptionalKeys : Exclude<keyof V, RequiredKeys<V>>
|
||||
|
||||
export type InferPropsInner<V> = { [K in keyof V]-?: InferType<V[K]>; };
|
||||
>InferPropsInner : InferPropsInner<V>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -100,7 +100,7 @@ type b = Remap2<string[]>; // string[]
|
||||
// Repro from #29992
|
||||
|
||||
type NonOptionalKeys<T> = { [P in keyof T]: undefined extends T[P] ? never : P }[keyof T];
|
||||
>NonOptionalKeys : { [P in keyof T]: undefined extends T[P] ? never : P; }[keyof T]
|
||||
>NonOptionalKeys : NonOptionalKeys<T>
|
||||
|
||||
type Child<T> = { [P in NonOptionalKeys<T>]: T[P] }
|
||||
>Child : Child<T>
|
||||
|
||||
@@ -116,7 +116,7 @@ type T24 = T20[0 | 1 | 2 | 3];
|
||||
>T24 : string | number | boolean
|
||||
|
||||
type T25 = T20[1 | 2 | 3];
|
||||
>T25 : string | boolean
|
||||
>T25 : T25
|
||||
|
||||
type T26 = T20[2 | 3];
|
||||
>T26 : boolean
|
||||
@@ -187,7 +187,7 @@ f0([1, 2, 3]);
|
||||
>3 : 3
|
||||
|
||||
f0([1, "hello", true]);
|
||||
>f0([1, "hello", true]) : [number, string | boolean]
|
||||
>f0([1, "hello", true]) : [number, T25]
|
||||
>f0 : <T, U>(x: [T, ...U[]]) => [T, U]
|
||||
>[1, "hello", true] : [number, string, true]
|
||||
>1 : 1
|
||||
|
||||
@@ -44,7 +44,7 @@ var t2 = t1; // error
|
||||
>t1 : [number]
|
||||
|
||||
type A<T extends any[]> = T['length'];
|
||||
>A : T["length"]
|
||||
>A : A<T>
|
||||
|
||||
var b: A<[boolean]>;
|
||||
>b : 1
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ class Type<A, O = A, I = unknown> {
|
||||
interface Any extends Type<any, any, any> {}
|
||||
|
||||
type TypeOf<C extends Any> = C["_A"];
|
||||
>TypeOf : C["_A"]
|
||||
>TypeOf : TypeOf<C>
|
||||
|
||||
type ToB<S extends {[_ in string | number | symbol]: Any}> = { [k in keyof S]: TypeOf<S[k]> };
|
||||
>ToB : ToB<S>
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ class Type<A, O = A, I = unknown> {
|
||||
interface Any extends Type<any, any, any> {}
|
||||
|
||||
type TypeOf<C extends Any> = C["_A"];
|
||||
>TypeOf : C["_A"]
|
||||
>TypeOf : TypeOf<C>
|
||||
|
||||
type ToB<S extends {[_ in string | number | symbol]: Any}> = { [k in keyof S]: TypeOf<S[k]> };
|
||||
>ToB : ToB<S>
|
||||
|
||||
@@ -8,15 +8,15 @@ type B = { b: number };
|
||||
>b : number
|
||||
|
||||
type X<T> = ({ [K in keyof T]: T[K] } & Record<string, void>)[keyof T];
|
||||
>X : ({ [K in keyof T]: T[K]; } & Record<string, void>)[keyof T]
|
||||
>X : X<T>
|
||||
|
||||
type P1<T> = { data: X<T> };
|
||||
>P1 : P1<T>
|
||||
>data : ({ [K in keyof T]: T[K]; } & Record<string, void>)[keyof T]
|
||||
>data : X<T>
|
||||
|
||||
type P2<T> = { data: X<T> };
|
||||
>P2 : P2<T>
|
||||
>data : ({ [K in keyof T]: T[K]; } & Record<string, void>)[keyof T]
|
||||
>data : X<T>
|
||||
|
||||
interface I<T> {
|
||||
fn<K extends keyof T>(p1: P1<Pick<T, K>>, p2: P2<Pick<T, K>>): void;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// @strict: true
|
||||
// @lib: es2020
|
||||
// @declaration: true
|
||||
type BadFlatArray<Arr, Depth extends number> = {obj: {
|
||||
"done": Arr,
|
||||
"recur": Arr extends ReadonlyArray<infer InnerArr>
|
||||
? BadFlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][Depth]>
|
||||
: Arr
|
||||
}[Depth extends -1 ? "done" : "recur"]}["obj"];
|
||||
|
||||
declare function flat<A, D extends number = 1>(
|
||||
arr: A,
|
||||
depth?: D
|
||||
): BadFlatArray<A, D>[]
|
||||
|
||||
function foo<T>(arr: T[], depth: number) {
|
||||
return flat(arr, depth);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// @strict: true
|
||||
// @lib: es2020
|
||||
function foo<T>(arr: T[], depth: number) {
|
||||
return arr.flat(depth);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// @strict: true
|
||||
// @lib: es2020
|
||||
// @declaration: true
|
||||
function foo<T>(arr: T[], depth: number) {
|
||||
return arr.flat(depth);
|
||||
}
|
||||
Reference in New Issue
Block a user