diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 48f5e18d1a0f8..53e64b4b4a810 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4568,9 +4568,9 @@ namespace ts { createRestTypeNode(createArrayTypeNode(tupleConstituentNodes[i])) : createOptionalTypeNode(tupleConstituentNodes[i]); } - if ((type.target as TupleType).associatedNames) { + if ((type.target as TupleType).labeledElementDeclarations) { for (let i = 0; i < tupleConstituentNodes.length; i++) { - tupleConstituentNodes[i] = createNamedTupleMember(createIdentifier(unescapeLeadingUnderscores((type.target as TupleType).associatedNames![i])), tupleConstituentNodes[i]); + tupleConstituentNodes[i] = createNamedTupleMember(createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel((type.target as TupleType).labeledElementDeclarations![i]))), tupleConstituentNodes[i]); } } const tupleTypeNode = setEmitFlags(createTupleTypeNode(tupleConstituentNodes), EmitFlags.SingleLine); @@ -12082,15 +12082,8 @@ namespace ts { const lastElement = lastOrUndefined(node.elements); const restElement = lastElement && unwrapNamedTupleMember(lastElement).kind === SyntaxKind.RestType ? lastElement : undefined; const minLength = findLastIndex(node.elements, n => unwrapNamedTupleMember(n).kind !== SyntaxKind.OptionalType && n !== restElement) + 1; - let missingName = false; - const names = map(node.elements, e => { - if (e.kind !== SyntaxKind.NamedTupleMember) { - missingName = true; - return escapeLeadingUnderscores("arg"); - } - return (e as NamedTupleMember).name.escapedText; - }); - return getTupleTypeOfArity(node.elements.length, minLength, !!restElement, readonly, /*associatedNames*/ missingName ? undefined : names); + const missingName = some(node.elements, e => e.kind !== SyntaxKind.NamedTupleMember); + return getTupleTypeOfArity(node.elements.length, minLength, !!restElement, readonly, /*associatedNames*/ missingName ? undefined : node.elements as readonly NamedTupleMember[]); } // Return true if the given type reference node is directly aliased or if it needs to be deferred @@ -12187,7 +12180,7 @@ namespace ts { // // Note that the generic type created by this function has no symbol associated with it. The same // is true for each of the synthesized type parameters. - function createTupleTypeOfArity(arity: number, minLength: number, hasRestElement: boolean, readonly: boolean, associatedNames: __String[] | undefined): TupleType { + function createTupleTypeOfArity(arity: number, minLength: number, hasRestElement: boolean, readonly: boolean, namedMemberDeclarations: readonly (NamedTupleMember | ParameterDeclaration)[] | undefined): TupleType { let typeParameters: TypeParameter[] | undefined; const properties: Symbol[] = []; const maxLength = hasRestElement ? arity - 1 : arity; @@ -12198,6 +12191,7 @@ namespace ts { if (i < maxLength) { const property = createSymbol(SymbolFlags.Property | (i >= minLength ? SymbolFlags.Optional : 0), "" + i as __String, readonly ? CheckFlags.Readonly : 0); + property.tupleLabelDeclaration = namedMemberDeclarations?.[i]; property.type = typeParameter; properties.push(property); } @@ -12227,25 +12221,25 @@ namespace ts { type.minLength = minLength; type.hasRestElement = hasRestElement; type.readonly = readonly; - type.associatedNames = associatedNames; + type.labeledElementDeclarations = namedMemberDeclarations; return type; } - function getTupleTypeOfArity(arity: number, minLength: number, hasRestElement: boolean, readonly: boolean, associatedNames?: __String[]): GenericType { - const key = arity + (hasRestElement ? "+" : ",") + minLength + (readonly ? "R" : "") + (associatedNames && associatedNames.length ? "," + associatedNames.join(",") : ""); + function getTupleTypeOfArity(arity: number, minLength: number, hasRestElement: boolean, readonly: boolean, namedMemberDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[]): GenericType { + const key = arity + (hasRestElement ? "+" : ",") + minLength + (readonly ? "R" : "") + (namedMemberDeclarations && namedMemberDeclarations.length ? "," + map(namedMemberDeclarations, getNodeId).join(",") : ""); let type = tupleTypes.get(key); if (!type) { - tupleTypes.set(key, type = createTupleTypeOfArity(arity, minLength, hasRestElement, readonly, associatedNames)); + tupleTypes.set(key, type = createTupleTypeOfArity(arity, minLength, hasRestElement, readonly, namedMemberDeclarations)); } return type; } - function createTupleType(elementTypes: readonly Type[], minLength = elementTypes.length, hasRestElement = false, readonly = false, associatedNames?: __String[]) { + function createTupleType(elementTypes: readonly Type[], minLength = elementTypes.length, hasRestElement = false, readonly = false, namedMemberDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[]) { const arity = elementTypes.length; if (arity === 1 && hasRestElement) { return createArrayType(elementTypes[0], readonly); } - const tupleType = getTupleTypeOfArity(arity, minLength, arity > 0 && hasRestElement, readonly, associatedNames); + const tupleType = getTupleTypeOfArity(arity, minLength, arity > 0 && hasRestElement, readonly, namedMemberDeclarations); return elementTypes.length ? createTypeReference(tupleType, elementTypes) : tupleType; } @@ -12260,7 +12254,7 @@ namespace ts { Math.max(0, tuple.minLength - index), tuple.hasRestElement, tuple.readonly, - tuple.associatedNames && tuple.associatedNames.slice(index), + tuple.labeledElementDeclarations && tuple.labeledElementDeclarations.slice(index), ); } @@ -14260,7 +14254,7 @@ namespace ts { minLength; const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, modifiers); return contains(elementTypes, errorType) ? errorType : - createTupleType(elementTypes, newMinLength, tupleType.target.hasRestElement, newReadonly, tupleType.target.associatedNames); + createTupleType(elementTypes, newMinLength, tupleType.target.hasRestElement, newReadonly, tupleType.target.labeledElementDeclarations); } function instantiateMappedTypeTemplate(type: MappedType, key: Type, isOptional: boolean, mapper: TypeMapper) { @@ -18517,7 +18511,7 @@ namespace ts { const elementTypes = map(getTypeArguments(source), t => inferReverseMappedType(t, target, constraint)); const minLength = getMappedTypeModifiers(target) & MappedTypeModifiers.IncludeOptional ? getTypeReferenceArity(source) - (source.target.hasRestElement ? 1 : 0) : source.target.minLength; - return createTupleType(elementTypes, minLength, source.target.hasRestElement, source.target.readonly, source.target.associatedNames); + return createTupleType(elementTypes, minLength, source.target.hasRestElement, source.target.readonly, source.target.labeledElementDeclarations); } // For all other object types we infer a new object type where the reverse mapping has been // applied to the type of each property. @@ -25114,7 +25108,7 @@ namespace ts { function getArrayifiedType(type: Type) { return type.flags & TypeFlags.Union ? mapType(type, getArrayifiedType) : type.flags & (TypeFlags.Any | TypeFlags.Instantiable) || isMutableArrayOrTuple(type) ? type : - isTupleType(type) ? createTupleType(getTypeArguments(type), type.target.minLength, type.target.hasRestElement, /*readonly*/ false, type.target.associatedNames) : + isTupleType(type) ? createTupleType(getTypeArguments(type), type.target.minLength, type.target.hasRestElement, /*readonly*/ false, type.target.labeledElementDeclarations) : createArrayType(getIndexedAccessType(type, numberType)); } @@ -26974,6 +26968,11 @@ namespace ts { return type; } + function getTupleElementLabel(d: ParameterDeclaration | NamedTupleMember) { + Debug.assert(isIdentifier(d.name)); // Parameter declarations could be binding patterns, but we only allow identifier names + return d.name.escapedText; + } + function getParameterNameAtPosition(signature: Signature, pos: number) { const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); if (pos < paramCount) { @@ -26982,13 +26981,33 @@ namespace ts { const restParameter = signature.parameters[paramCount] || unknownSymbol; const restType = getTypeOfSymbol(restParameter); if (isTupleType(restType)) { - const associatedNames = ((restType).target).associatedNames; + const associatedNames = ((restType).target).labeledElementDeclarations; const index = pos - paramCount; - return associatedNames && associatedNames[index] || restParameter.escapedName + "_" + index as __String; + return associatedNames && getTupleElementLabel(associatedNames[index]) || restParameter.escapedName + "_" + index as __String; } return restParameter.escapedName; } + function isValidDeclarationForTupleLabel(d: Declaration): d is NamedTupleMember | (ParameterDeclaration & { name: Identifier }) { + return d.kind === SyntaxKind.NamedTupleMember || (isParameter(d) && isIdentifier(d.name)); + } + + function getNameableDeclarationAtPosition(signature: Signature, pos: number) { + const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); + if (pos < paramCount) { + const decl = signature.parameters[pos].valueDeclaration; + return decl && isValidDeclarationForTupleLabel(decl) ? decl : undefined; + } + const restParameter = signature.parameters[paramCount] || unknownSymbol; + const restType = getTypeOfSymbol(restParameter); + if (isTupleType(restType)) { + const associatedNames = ((restType).target).labeledElementDeclarations; + const index = pos - paramCount; + return associatedNames && associatedNames[index]; + } + return restParameter.valueDeclaration && isValidDeclarationForTupleLabel(restParameter.valueDeclaration) ? restParameter.valueDeclaration : undefined; + } + function getTypeAtPosition(signature: Signature, pos: number): Type { return tryGetTypeAtPosition(signature, pos) || anyType; } @@ -27019,14 +27038,26 @@ namespace ts { return restType; } const types = []; - const names = []; + let names: (NamedTupleMember | ParameterDeclaration)[] | undefined = []; for (let i = pos; i < nonRestCount; i++) { types.push(getTypeAtPosition(source, i)); - names.push(getParameterNameAtPosition(source, i)); + const name = getNameableDeclarationAtPosition(source, i); + if (name && names) { + names.push(name); + } + else { + names = undefined; + } } if (restType) { types.push(getIndexedAccessType(restType, numberType)); - names.push(getParameterNameAtPosition(source, nonRestCount)); + const name = getNameableDeclarationAtPosition(source, nonRestCount); + if (name && names) { + names.push(name); + } + else { + names = undefined; + } } const minArgumentCount = getMinArgumentCount(source); const minLength = minArgumentCount < pos ? 0 : minArgumentCount - pos; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index b355c97192c53..386a1a54eff91 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1278,7 +1278,7 @@ namespace ts { elements: NodeArray; } - export interface NamedTupleMember extends TypeNode, JSDocContainer { + export interface NamedTupleMember extends TypeNode, JSDocContainer, Declaration { kind: SyntaxKind.NamedTupleMember; dotDotDotToken?: Token; name: Identifier; @@ -4170,6 +4170,7 @@ namespace ts { cjsExportMerged?: Symbol; // Version of the symbol with all non export= exports merged with the export= target typeOnlyDeclaration?: TypeOnlyCompatibleAliasDeclaration | false; // First resolved alias declaration that makes the symbol only usable in type constructs isConstructorDeclaredProperty?: boolean; // Property declared through 'this.x = ...' assignment in constructor + tupleLabelDeclaration?: NamedTupleMember | ParameterDeclaration; // Declaration associated with the tuple's label } /* @internal */ @@ -4642,7 +4643,7 @@ namespace ts { minLength: number; hasRestElement: boolean; readonly: boolean; - associatedNames?: __String[]; + labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[]; } export interface TupleTypeReference extends TypeReference { diff --git a/src/services/services.ts b/src/services/services.ts index c0d386291a5a6..3527f11a7a8a2 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -325,7 +325,14 @@ namespace ts { getDocumentationComment(checker: TypeChecker | undefined): SymbolDisplayPart[] { if (!this.documentationComment) { this.documentationComment = emptyArray; // Set temporarily to avoid an infinite loop finding inherited docs - this.documentationComment = getDocumentationComment(this.declarations, checker); + + if (!this.declarations && (this as Symbol as TransientSymbol).target && ((this as Symbol as TransientSymbol).target as TransientSymbol).tupleLabelDeclaration) { + const labelDecl = ((this as Symbol as TransientSymbol).target as TransientSymbol).tupleLabelDeclaration!; + this.documentationComment = getDocumentationComment([labelDecl], checker); + } + else { + this.documentationComment = getDocumentationComment(this.declarations, checker); + } } return this.documentationComment; } diff --git a/src/services/symbolDisplay.ts b/src/services/symbolDisplay.ts index b8122428e4196..d58dcfcbd4350 100644 --- a/src/services/symbolDisplay.ts +++ b/src/services/symbolDisplay.ts @@ -481,6 +481,14 @@ namespace ts.SymbolDisplay { else { addRange(displayParts, typeToDisplayParts(typeChecker, type, enclosingDeclaration)); } + if ((symbol as TransientSymbol).target && ((symbol as TransientSymbol).target as TransientSymbol).tupleLabelDeclaration) { + const labelDecl = ((symbol as TransientSymbol).target as TransientSymbol).tupleLabelDeclaration!; + Debug.assertNode(labelDecl.name, isIdentifier); + displayParts.push(spacePart()); + displayParts.push(punctuationPart(SyntaxKind.OpenParenToken)); + displayParts.push(textPart(idText(labelDecl.name))); + displayParts.push(punctuationPart(SyntaxKind.CloseParenToken)); + } } else if (symbolFlags & SymbolFlags.Function || symbolFlags & SymbolFlags.Method || diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 121550709bfc0..bbf489749da8b 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -811,7 +811,7 @@ declare namespace ts { kind: SyntaxKind.TupleType; elements: NodeArray; } - export interface NamedTupleMember extends TypeNode, JSDocContainer { + export interface NamedTupleMember extends TypeNode, JSDocContainer, Declaration { kind: SyntaxKind.NamedTupleMember; dotDotDotToken?: Token; name: Identifier; @@ -2483,7 +2483,7 @@ declare namespace ts { minLength: number; hasRestElement: boolean; readonly: boolean; - associatedNames?: __String[]; + labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[]; } export interface TupleTypeReference extends TypeReference { target: TupleType; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index a839ec4f33ea1..a51c3c850e32b 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -811,7 +811,7 @@ declare namespace ts { kind: SyntaxKind.TupleType; elements: NodeArray; } - export interface NamedTupleMember extends TypeNode, JSDocContainer { + export interface NamedTupleMember extends TypeNode, JSDocContainer, Declaration { kind: SyntaxKind.NamedTupleMember; dotDotDotToken?: Token; name: Identifier; @@ -2483,7 +2483,7 @@ declare namespace ts { minLength: number; hasRestElement: boolean; readonly: boolean; - associatedNames?: __String[]; + labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[]; } export interface TupleTypeReference extends TypeReference { target: TupleType; diff --git a/tests/baselines/reference/genericRestParameters1.types b/tests/baselines/reference/genericRestParameters1.types index 95b490a564610..1503f11845964 100644 --- a/tests/baselines/reference/genericRestParameters1.types +++ b/tests/baselines/reference/genericRestParameters1.types @@ -671,7 +671,7 @@ type T01 = Parameters<(x: number, y: string, z: boolean) => void>; >z : boolean type T02 = Parameters<(...args: [number, string, boolean]) => void>; ->T02 : [args_0: number, args_1: string, args_2: boolean] +>T02 : [number, string, boolean] >args : [number, string, boolean] type T03 = ConstructorParameters void>; @@ -681,7 +681,7 @@ type T03 = ConstructorParameters void> >z : boolean type T04 = ConstructorParameters void>; ->T04 : [args_0: number, args_1: string, args_2: boolean] +>T04 : [number, string, boolean] >args : [number, string, boolean] type T05 = Parameters<(...args: T[]) => void>; diff --git a/tests/baselines/reference/genericRestParameters2.types b/tests/baselines/reference/genericRestParameters2.types index 12694bbda7d07..fd1b8664c7a22 100644 --- a/tests/baselines/reference/genericRestParameters2.types +++ b/tests/baselines/reference/genericRestParameters2.types @@ -423,7 +423,7 @@ type T01 = Parameters<(x: number, y: string, ...z: boolean[]) => void>; >z : boolean[] type T02 = Parameters<(...args: [number, string, ...boolean[]]) => void>; ->T02 : [args_0: number, args_1: string, args_2: ...boolean[]] +>T02 : [number, string, ...boolean[]] >args : [number, string, ...boolean[]] type T03 = ConstructorParameters void>; @@ -433,7 +433,7 @@ type T03 = ConstructorParameters >z : boolean[] type T04 = ConstructorParameters void>; ->T04 : [args_0: number, args_1: string, args_2: ...boolean[]] +>T04 : [number, string, ...boolean[]] >args : [number, string, ...boolean[]] type T05 = Parameters<(x: string, ...args: T) => void>; @@ -442,7 +442,7 @@ type T05 = Parameters<(x: string, ...args: T) => void>; >args : T type T06 = T05<[number, ...boolean[]]>; ->T06 : [x: string, args_0: number, args_1: ...boolean[]] +>T06 : [string, number, ...boolean[]] type P1 = T extends (head: infer A, ...tail: infer B) => any ? { head: A, tail: B } : any[]; >P1 : P1 diff --git a/tests/baselines/reference/ramdaToolsNoInfinite.types b/tests/baselines/reference/ramdaToolsNoInfinite.types index 112d10207b560..0ee4959efa149 100644 --- a/tests/baselines/reference/ramdaToolsNoInfinite.types +++ b/tests/baselines/reference/ramdaToolsNoInfinite.types @@ -133,7 +133,7 @@ declare namespace Tools { Reverse extends infer R ? Cast : never, T2>; type Append = ->Append : { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [head: (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[9], head: (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[8], head: (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[7], head: (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[6], head: (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], head: (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], head: (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], head: (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], head: (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], head: (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], args_0: E]; }[10 extends ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[8], head: ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[7], head: ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[6], head: ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], head: ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], head: ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], head: ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], head: ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], head: ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], args_0: E]; }[9 extends ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[7], head: ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[6], head: ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], head: ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], head: ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], head: ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], head: ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], head: ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], args_0: E]; }[8 extends ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[6], head: ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], head: ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], head: ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], head: ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], head: ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], head: ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], args_0: E]; }[7 extends ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], head: ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], head: ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], head: ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], head: ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], head: ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], args_0: E]; }[6 extends ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], head: ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], head: ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], head: ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], head: ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], args_0: E]; }[5 extends ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], head: ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], head: ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], head: ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], args_0: E]; }[4 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], head: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], head: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], args_0: E]; }[3 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], head: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], args_0: E]; }[2 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[9 extends T["length"] ? 1 : 0]; 1: [head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [head: ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[9 extends T["length"] ? 1 : 0]; 1: [head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], args_0: E]; }[1 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[10 extends T["length"] ? 1 : 0]; 1: [head: T[8], head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[9 extends T["length"] ? 1 : 0]; 1: [head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [E]; }[0 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends T["length"] ? 1 : 0]; 1: [head: T[9], head: T[8], head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[10 extends T["length"] ? 1 : 0]; 1: [head: T[8], head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[9 extends T["length"] ? 1 : 0]; 1: [head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0] +>Append : { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [(any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[9], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[8], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[7], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[6], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], (any[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[10 extends ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[8], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[7], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[6], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: any[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[9 extends ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[7], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[6], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: any[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[8 extends ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[6], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: any[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[7 extends ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[5], ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: { 0: any[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[6 extends ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[4], ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: { 0: { 0: any[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[5 extends ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[3], ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: { 0: { 0: { 0: any[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[4 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[2], ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: any[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[3 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[1], ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[2 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[9 extends T["length"] ? 1 : 0]; 1: [head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[9 extends T["length"] ? 1 : 0]; 1: [head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)[0], E]; }[1 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[10 extends T["length"] ? 1 : 0]; 1: [head: T[8], head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[9 extends T["length"] ? 1 : 0]; 1: [head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0]; 1: [E]; }[0 extends ({ 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: { 0: any[11 extends T["length"] ? 1 : 0]; 1: [head: T[9], head: T[8], head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[10 extends T["length"] ? 1 : 0]; 1: [head: T[8], head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[9 extends T["length"] ? 1 : 0]; 1: [head: T[7], head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[8 extends T["length"] ? 1 : 0]; 1: [head: T[6], head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[7 extends T["length"] ? 1 : 0]; 1: [head: T[5], head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[6 extends T["length"] ? 1 : 0]; 1: [head: T[4], head: T[3], head: T[2], head: T[1], head: T[0]]; }[5 extends T["length"] ? 1 : 0]; 1: [head: T[3], head: T[2], head: T[1], head: T[0]]; }[4 extends T["length"] ? 1 : 0]; 1: [head: T[2], head: T[1], head: T[0]]; }[3 extends T["length"] ? 1 : 0]; 1: [head: T[1], head: T[0]]; }[2 extends T["length"] ? 1 : 0]; 1: [head: T[0]]; }[1 extends T["length"] ? 1 : 0]; 1: []; }[0 extends T["length"] ? 1 : 0] extends infer R ? Cast : never)["length"] ? 1 : 0] Concat; diff --git a/tests/baselines/reference/restTuplesFromContextualTypes.types b/tests/baselines/reference/restTuplesFromContextualTypes.types index a5da0659c23d1..65a197916cd99 100644 --- a/tests/baselines/reference/restTuplesFromContextualTypes.types +++ b/tests/baselines/reference/restTuplesFromContextualTypes.types @@ -67,23 +67,23 @@ f1((a, b, c) => {}) f1((...x) => {}) >f1((...x) => {}) : void >f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void ->(...x) => {} : (args_0: number, args_1: boolean, args_2: string) => void ->x : [args_0: number, args_1: boolean, args_2: string] +>(...x) => {} : (x_0: number, x_1: boolean, x_2: string) => void +>x : [number, boolean, string] f1((a, ...x) => {}) >f1((a, ...x) => {}) : void >f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void ->(a, ...x) => {} : (a: number, args_1: boolean, args_2: string) => void +>(a, ...x) => {} : (a: number, x_0: boolean, x_1: string) => void >a : number ->x : [args_1: boolean, args_2: string] +>x : [boolean, string] f1((a, b, ...x) => {}) >f1((a, b, ...x) => {}) : void >f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void ->(a, b, ...x) => {} : (a: number, b: boolean, args_2: string) => void +>(a, b, ...x) => {} : (a: number, b: boolean, x_0: string) => void >a : number >b : boolean ->x : [args_2: string] +>x : [string] f1((a, b, c, ...x) => {}) >f1((a, b, c, ...x) => {}) : void @@ -162,15 +162,15 @@ f2((a, b, c) => {}) f2((...x) => {}) >f2((...x) => {}) : void >f2 : (cb: (args_0: number, args_1: boolean, ...args_2: string[]) => void) => void ->(...x) => {} : (args_0: number, args_1: boolean, ...args_2: string[]) => void ->x : [args_0: number, args_1: boolean, args_2: ...string[]] +>(...x) => {} : (x_0: number, x_1: boolean, ...x_2: string[]) => void +>x : [number, boolean, ...string[]] f2((a, ...x) => {}) >f2((a, ...x) => {}) : void >f2 : (cb: (args_0: number, args_1: boolean, ...args_2: string[]) => void) => void ->(a, ...x) => {} : (a: number, args_1: boolean, ...args_2: string[]) => void +>(a, ...x) => {} : (a: number, x_0: boolean, ...x_1: string[]) => void >a : number ->x : [args_1: boolean, args_2: ...string[]] +>x : [boolean, ...string[]] f2((a, b, ...x) => {}) >f2((a, b, ...x) => {}) : void @@ -263,15 +263,15 @@ f3((a, b, c) => {}) f3((...x) => {}) >f3((...x) => {}) : void >f3 : (cb: (x: number, args_0: boolean, ...args_1: string[]) => void) => void ->(...x) => {} : (x: number, args_0: boolean, ...args_1: string[]) => void ->x : [x: number, args_0: boolean, args_1: ...string[]] +>(...x) => {} : (x_0: number, x_1: boolean, ...x_2: string[]) => void +>x : [number, boolean, ...string[]] f3((a, ...x) => {}) >f3((a, ...x) => {}) : void >f3 : (cb: (x: number, args_0: boolean, ...args_1: string[]) => void) => void ->(a, ...x) => {} : (a: number, args_0: boolean, ...args_1: string[]) => void +>(a, ...x) => {} : (a: number, x_0: boolean, ...x_1: string[]) => void >a : number ->x : [args_0: boolean, args_1: ...string[]] +>x : [boolean, ...string[]] f3((a, b, ...x) => {}) >f3((a, b, ...x) => {}) : void diff --git a/tests/baselines/reference/strictBindCallApply1.errors.txt b/tests/baselines/reference/strictBindCallApply1.errors.txt index f7d9231a12a3f..ee1718db34c9e 100644 --- a/tests/baselines/reference/strictBindCallApply1.errors.txt +++ b/tests/baselines/reference/strictBindCallApply1.errors.txt @@ -36,8 +36,11 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(49,29): error TS2345: tests/cases/conformance/functions/strictBindCallApply1.ts(50,38): error TS2554: Expected 3 arguments, but got 4. tests/cases/conformance/functions/strictBindCallApply1.ts(51,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. tests/cases/conformance/functions/strictBindCallApply1.ts(54,26): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[a: number, b: string]'. + Property '1' is missing in type '[number]' but required in type '[a: number, b: string]'. tests/cases/conformance/functions/strictBindCallApply1.ts(55,31): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(56,26): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[a: number, b: string]'. + Types of property 'length' are incompatible. + Type '3' is not assignable to type '2'. tests/cases/conformance/functions/strictBindCallApply1.ts(57,23): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. tests/cases/conformance/functions/strictBindCallApply1.ts(62,11): error TS2769: No overload matches this call. Overload 1 of 6, '(this: new (arg0: 10, arg1: string) => C, thisArg: any, arg0: 10, arg1: string): new () => C', gave the following error. @@ -51,8 +54,11 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(65,3): error TS2554: E tests/cases/conformance/functions/strictBindCallApply1.ts(66,15): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(67,24): error TS2554: Expected 3 arguments, but got 4. tests/cases/conformance/functions/strictBindCallApply1.ts(70,12): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[a: number, b: string]'. + Property '1' is missing in type '[number]' but required in type '[a: number, b: string]'. tests/cases/conformance/functions/strictBindCallApply1.ts(71,17): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[a: number, b: string]'. + Types of property 'length' are incompatible. + Type '3' is not assignable to type '2'. ==== tests/cases/conformance/functions/strictBindCallApply1.ts (24 errors) ==== @@ -162,12 +168,15 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: let a11 = c.foo.apply(c, [10]); // Error ~~~~ !!! error TS2345: Argument of type '[number]' is not assignable to parameter of type '[a: number, b: string]'. +!!! error TS2345: Property '1' is missing in type '[number]' but required in type '[a: number, b: string]'. let a12 = c.foo.apply(c, [10, 20]); // Error ~~ !!! error TS2322: Type 'number' is not assignable to type 'string'. let a13 = c.foo.apply(c, [10, "hello", 30]); // Error ~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[a: number, b: string]'. +!!! error TS2345: Types of property 'length' are incompatible. +!!! error TS2345: Type '3' is not assignable to type '2'. let a14 = c.foo.apply(undefined, [10, "hello"]); // Error ~~~~~~~~~ !!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. @@ -201,10 +210,13 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: C.apply(c, [10]); // Error ~~~~ !!! error TS2345: Argument of type '[number]' is not assignable to parameter of type '[a: number, b: string]'. +!!! error TS2345: Property '1' is missing in type '[number]' but required in type '[a: number, b: string]'. C.apply(c, [10, 20]); // Error ~~ !!! error TS2322: Type 'number' is not assignable to type 'string'. C.apply(c, [10, "hello", 30]); // Error ~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[a: number, b: string]'. +!!! error TS2345: Types of property 'length' are incompatible. +!!! error TS2345: Type '3' is not assignable to type '2'. \ No newline at end of file diff --git a/tests/cases/fourslash/completionsElementAccessNumeric.ts b/tests/cases/fourslash/completionsElementAccessNumeric.ts new file mode 100644 index 0000000000000..dbb330a7ae91c --- /dev/null +++ b/tests/cases/fourslash/completionsElementAccessNumeric.ts @@ -0,0 +1,30 @@ +/// + +// @target: esnext + +////type Tup = [ +//// /** +//// * The first label +//// */ +//// lbl1: number, +//// /** +//// * The second label +//// */ +//// lbl2: number +////]; +////declare var x: Tup; +////x[|./**/|] + +const replacementSpan = test.ranges()[0]; +verify.completions( + { + marker: "", + includes: [ + {name: "0", insertText: "[0]", replacementSpan, documentation: "The first label", text: "(property) 0: number (lbl1)" }, + {name: "1", insertText: "[1]", replacementSpan, documentation: "The second label", text: "(property) 1: number (lbl2)" }, + ], + preferences: { + includeInsertTextCompletions: true, + }, + }, +);