mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge pull request #33050 from microsoft/recursiveTypeReferences
Recursive type references
This commit is contained in:
+201
-133
@@ -382,6 +382,7 @@ namespace ts {
|
||||
getReturnTypeOfSignature,
|
||||
getNullableType,
|
||||
getNonNullableType,
|
||||
getTypeArguments,
|
||||
typeToTypeNode: nodeBuilder.typeToTypeNode,
|
||||
indexInfoToIndexSignatureDeclaration: nodeBuilder.indexInfoToIndexSignatureDeclaration,
|
||||
signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration,
|
||||
@@ -507,6 +508,7 @@ namespace ts {
|
||||
getIndexTypeOfStructuredType,
|
||||
getConstraintOfTypeParameter,
|
||||
getFirstIdentifier,
|
||||
getTypeArguments,
|
||||
),
|
||||
getAmbientModules,
|
||||
getJsxIntrinsicTagNamesAt,
|
||||
@@ -3729,11 +3731,17 @@ namespace ts {
|
||||
return createThis();
|
||||
}
|
||||
|
||||
if (!inTypeAlias && type.aliasSymbol && (context.flags & NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
|
||||
const typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
|
||||
if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & SymbolFlags.Class)) return createTypeReferenceNode(createIdentifier(""), typeArgumentNodes);
|
||||
return symbolToTypeNode(type.aliasSymbol, context, SymbolFlags.Type, typeArgumentNodes);
|
||||
}
|
||||
|
||||
const objectFlags = getObjectFlags(type);
|
||||
|
||||
if (objectFlags & ObjectFlags.Reference) {
|
||||
Debug.assert(!!(type.flags & TypeFlags.Object));
|
||||
return typeReferenceToTypeNode(<TypeReference>type);
|
||||
return (<TypeReference>type).node ? visitAndTransformType(type, typeReferenceToTypeNode) : typeReferenceToTypeNode(<TypeReference>type);
|
||||
}
|
||||
if (type.flags & TypeFlags.TypeParameter || objectFlags & ObjectFlags.ClassOrInterface) {
|
||||
if (type.flags & TypeFlags.TypeParameter && contains(context.inferTypeParameters, type)) {
|
||||
@@ -3751,11 +3759,6 @@ namespace ts {
|
||||
? symbolToTypeNode(type.symbol, context, SymbolFlags.Type)
|
||||
: createTypeReferenceNode(createIdentifier("?"), /*typeArguments*/ undefined);
|
||||
}
|
||||
if (!inTypeAlias && type.aliasSymbol && (context.flags & NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
|
||||
const typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
|
||||
if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & SymbolFlags.Class)) return createTypeReferenceNode(createIdentifier(""), typeArgumentNodes);
|
||||
return symbolToTypeNode(type.aliasSymbol, context, SymbolFlags.Type, typeArgumentNodes);
|
||||
}
|
||||
if (type.flags & (TypeFlags.Union | TypeFlags.Intersection)) {
|
||||
const types = type.flags & TypeFlags.Union ? formatUnionTypes((<UnionType>type).types) : (<IntersectionType>type).types;
|
||||
if (length(types) === 1) {
|
||||
@@ -3830,10 +3833,7 @@ namespace ts {
|
||||
function createAnonymousTypeNode(type: ObjectType): TypeNode {
|
||||
const typeId = "" + type.id;
|
||||
const symbol = type.symbol;
|
||||
let id: string;
|
||||
if (symbol) {
|
||||
const isConstructorObject = getObjectFlags(type) & ObjectFlags.Anonymous && type.symbol && type.symbol.flags & SymbolFlags.Class;
|
||||
id = (isConstructorObject ? "+" : "") + getSymbolId(symbol);
|
||||
if (isJSConstructor(symbol.valueDeclaration)) {
|
||||
// Instance and static types share the same symbol; only add 'typeof' for the static side.
|
||||
const isInstanceType = type === getDeclaredTypeOfClassOrInterface(symbol) ? SymbolFlags.Type : SymbolFlags.Value;
|
||||
@@ -3857,25 +3857,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Since instantiations of the same anonymous type have the same symbol, tracking symbols instead
|
||||
// of types allows us to catch circular references to instantiations of the same anonymous type
|
||||
if (!context.visitedTypes) {
|
||||
context.visitedTypes = createMap<true>();
|
||||
}
|
||||
if (!context.symbolDepth) {
|
||||
context.symbolDepth = createMap<number>();
|
||||
}
|
||||
|
||||
const depth = context.symbolDepth.get(id) || 0;
|
||||
if (depth > 10) {
|
||||
return createElidedInformationPlaceholder(context);
|
||||
}
|
||||
context.symbolDepth.set(id, depth + 1);
|
||||
context.visitedTypes.set(typeId, true);
|
||||
const result = createTypeNodeFromObjectType(type);
|
||||
context.visitedTypes.delete(typeId);
|
||||
context.symbolDepth.set(id, depth);
|
||||
return result;
|
||||
return visitAndTransformType(type, createTypeNodeFromObjectType);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -3897,6 +3879,38 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function visitAndTransformType<T>(type: Type, transform: (type: Type) => T) {
|
||||
const typeId = "" + type.id;
|
||||
const isConstructorObject = getObjectFlags(type) & ObjectFlags.Anonymous && type.symbol && type.symbol.flags & SymbolFlags.Class;
|
||||
const id = getObjectFlags(type) & ObjectFlags.Reference && (<TypeReference>type).node ? "N" + getNodeId((<TypeReference>type).node!) :
|
||||
type.symbol ? (isConstructorObject ? "+" : "") + getSymbolId(type.symbol) :
|
||||
undefined;
|
||||
// Since instantiations of the same anonymous type have the same symbol, tracking symbols instead
|
||||
// of types allows us to catch circular references to instantiations of the same anonymous type
|
||||
if (!context.visitedTypes) {
|
||||
context.visitedTypes = createMap<true>();
|
||||
}
|
||||
if (id && !context.symbolDepth) {
|
||||
context.symbolDepth = createMap<number>();
|
||||
}
|
||||
|
||||
let depth: number | undefined;
|
||||
if (id) {
|
||||
depth = context.symbolDepth!.get(id) || 0;
|
||||
if (depth > 10) {
|
||||
return createElidedInformationPlaceholder(context);
|
||||
}
|
||||
context.symbolDepth!.set(id, depth + 1);
|
||||
}
|
||||
context.visitedTypes.set(typeId, true);
|
||||
const result = transform(type);
|
||||
context.visitedTypes.delete(typeId);
|
||||
if (id) {
|
||||
context.symbolDepth!.set(id, depth!);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function createTypeNodeFromObjectType(type: ObjectType): TypeNode {
|
||||
if (isGenericMappedType(type)) {
|
||||
return createMappedTypeNodeFromType(type);
|
||||
@@ -3933,13 +3947,12 @@ namespace ts {
|
||||
}
|
||||
|
||||
function typeReferenceToTypeNode(type: TypeReference) {
|
||||
const typeArguments: readonly Type[] = type.typeArguments || emptyArray;
|
||||
const typeArguments: readonly Type[] = getTypeArguments(type);
|
||||
if (type.target === globalArrayType || type.target === globalReadonlyArrayType) {
|
||||
if (context.flags & NodeBuilderFlags.WriteArrayAsGenericType) {
|
||||
const typeArgumentNode = typeToTypeNodeHelper(typeArguments[0], context);
|
||||
return createTypeReferenceNode(type.target === globalArrayType ? "Array" : "ReadonlyArray", [typeArgumentNode]);
|
||||
}
|
||||
|
||||
const elementType = typeToTypeNodeHelper(typeArguments[0], context);
|
||||
const arrayType = createArrayTypeNode(elementType);
|
||||
return type.target === globalArrayType ? arrayType : createTypeOperatorNode(SyntaxKind.ReadonlyKeyword, arrayType);
|
||||
@@ -6270,7 +6283,7 @@ namespace ts {
|
||||
const signatures = getSignaturesOfType(type, SignatureKind.Construct);
|
||||
if (signatures.length === 1) {
|
||||
const s = signatures[0];
|
||||
return !s.typeParameters && s.parameters.length === 1 && s.hasRestParameter && getTypeOfParameter(s.parameters[0]) === anyArrayType;
|
||||
return !s.typeParameters && s.parameters.length === 1 && s.hasRestParameter && getElementTypeOfArrayType(getTypeOfParameter(s.parameters[0])) === anyType;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -6383,7 +6396,6 @@ namespace ts {
|
||||
return type.resolvedBaseTypes = emptyArray;
|
||||
}
|
||||
const baseTypeNode = getBaseTypeNodeOfClass(type)!;
|
||||
const typeArgs = typeArgumentsFromTypeReferenceNode(baseTypeNode);
|
||||
let baseType: Type;
|
||||
const originalBaseType = baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : undefined;
|
||||
if (baseConstructorType.symbol && baseConstructorType.symbol.flags & SymbolFlags.Class &&
|
||||
@@ -6391,7 +6403,7 @@ namespace ts {
|
||||
// When base constructor type is a class with no captured type arguments we know that the constructors all have the same type parameters as the
|
||||
// class and all return the instance type of the class. There is no need for further checks and we can apply the
|
||||
// type arguments in the same manner as a type reference to get the same error reporting experience.
|
||||
baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol, typeArgs);
|
||||
baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol);
|
||||
}
|
||||
else if (baseConstructorType.flags & TypeFlags.Any) {
|
||||
baseType = baseConstructorType;
|
||||
@@ -6436,7 +6448,7 @@ namespace ts {
|
||||
const outerTypeParameters = (<InterfaceType>type).outerTypeParameters;
|
||||
if (outerTypeParameters) {
|
||||
const last = outerTypeParameters.length - 1;
|
||||
const typeArguments = (<TypeReference>type).typeArguments!;
|
||||
const typeArguments = getTypeArguments(<TypeReference>type);
|
||||
return outerTypeParameters[last].symbol !== typeArguments[last].symbol;
|
||||
}
|
||||
return true;
|
||||
@@ -6541,7 +6553,7 @@ namespace ts {
|
||||
(<GenericType>type).instantiations = createMap<TypeReference>();
|
||||
(<GenericType>type).instantiations.set(getTypeListId(type.typeParameters), <GenericType>type);
|
||||
(<GenericType>type).target = <GenericType>type;
|
||||
(<GenericType>type).typeArguments = type.typeParameters;
|
||||
(<GenericType>type).resolvedTypeArguments = type.typeParameters;
|
||||
type.thisType = createTypeParameter(symbol);
|
||||
type.thisType.isThisType = true;
|
||||
type.thisType.constraint = type;
|
||||
@@ -7065,7 +7077,7 @@ namespace ts {
|
||||
function getTypeWithThisArgument(type: Type, thisArgument?: Type, needApparentType?: boolean): Type {
|
||||
if (getObjectFlags(type) & ObjectFlags.Reference) {
|
||||
const target = (<TypeReference>type).target;
|
||||
const typeArguments = (<TypeReference>type).typeArguments;
|
||||
const typeArguments = getTypeArguments(<TypeReference>type);
|
||||
if (length(target.typeParameters) === length(typeArguments)) {
|
||||
const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType!]));
|
||||
return needApparentType ? getApparentType(ref) : ref;
|
||||
@@ -7130,9 +7142,9 @@ namespace ts {
|
||||
function resolveTypeReferenceMembers(type: TypeReference): void {
|
||||
const source = resolveDeclaredMembers(type.target);
|
||||
const typeParameters = concatenate(source.typeParameters!, [source.thisType!]);
|
||||
const typeArguments = type.typeArguments && type.typeArguments.length === typeParameters.length ?
|
||||
type.typeArguments : concatenate(type.typeArguments, [type]);
|
||||
resolveObjectTypeMembers(type, source, typeParameters, typeArguments);
|
||||
const typeArguments = getTypeArguments(type);
|
||||
const paddedTypeArguments = typeArguments.length === typeParameters.length ? typeArguments : concatenate(typeArguments, [type]);
|
||||
resolveObjectTypeMembers(type, source, typeParameters, paddedTypeArguments);
|
||||
}
|
||||
|
||||
function createSignature(
|
||||
@@ -7183,7 +7195,7 @@ namespace ts {
|
||||
const restParameter = sig.parameters[restIndex];
|
||||
const restType = getTypeOfSymbol(restParameter);
|
||||
if (isTupleType(restType)) {
|
||||
const elementTypes = restType.typeArguments || emptyArray;
|
||||
const elementTypes = getTypeArguments(restType);
|
||||
const minLength = restType.target.minLength;
|
||||
const tupleRestIndex = restType.target.hasRestElement ? elementTypes.length - 1 : -1;
|
||||
const restParams = map(elementTypes, (t, i) => {
|
||||
@@ -9098,7 +9110,7 @@ namespace ts {
|
||||
target.instantiations.set(id, type);
|
||||
type.objectFlags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, /*excludeKinds*/ 0) : 0;
|
||||
type.target = target;
|
||||
type.typeArguments = typeArguments;
|
||||
type.resolvedTypeArguments = typeArguments;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@@ -9108,18 +9120,43 @@ namespace ts {
|
||||
type.symbol = source.symbol;
|
||||
type.objectFlags = source.objectFlags;
|
||||
type.target = source.target;
|
||||
type.typeArguments = source.typeArguments;
|
||||
type.resolvedTypeArguments = source.resolvedTypeArguments;
|
||||
return type;
|
||||
}
|
||||
|
||||
function createDeferredTypeReference(target: GenericType, node: TypeReferenceNode | ArrayTypeNode | TupleTypeNode, mapper?: TypeMapper): DeferredTypeReference {
|
||||
const aliasSymbol = getAliasSymbolForTypeNode(node);
|
||||
const aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
|
||||
const type = <DeferredTypeReference>createObjectType(ObjectFlags.Reference, target.symbol);
|
||||
type.target = target;
|
||||
type.node = node;
|
||||
type.mapper = mapper;
|
||||
type.aliasSymbol = aliasSymbol;
|
||||
type.aliasTypeArguments = mapper ? instantiateTypes(aliasTypeArguments, mapper) : aliasTypeArguments;
|
||||
return type;
|
||||
}
|
||||
|
||||
function getTypeArguments(type: TypeReference): readonly Type[] {
|
||||
if (!type.resolvedTypeArguments) {
|
||||
const node = type.node;
|
||||
const typeArguments = !node ? emptyArray :
|
||||
node.kind === SyntaxKind.TypeReference ? concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters!)) :
|
||||
node.kind === SyntaxKind.ArrayType ? [getTypeFromTypeNode(node.elementType)] :
|
||||
map(node.elementTypes, getTypeFromTypeNode);
|
||||
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
||||
}
|
||||
return type.resolvedTypeArguments;
|
||||
}
|
||||
|
||||
function getTypeReferenceArity(type: TypeReference): number {
|
||||
return length(type.target.typeParameters);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get type from type-reference that reference to class or interface
|
||||
*/
|
||||
function getTypeFromClassOrInterfaceReference(node: NodeWithTypeArguments, symbol: Symbol, typeArgs: Type[] | undefined): Type {
|
||||
function getTypeFromClassOrInterfaceReference(node: NodeWithTypeArguments, symbol: Symbol): Type {
|
||||
const type = <InterfaceType>getDeclaredTypeOfSymbol(getMergedSymbol(symbol));
|
||||
const typeParameters = type.localTypeParameters;
|
||||
if (typeParameters) {
|
||||
@@ -9144,10 +9181,13 @@ namespace ts {
|
||||
return errorType;
|
||||
}
|
||||
}
|
||||
if (node.kind === SyntaxKind.TypeReference && isAliasedType(node)) {
|
||||
return createDeferredTypeReference(<GenericType>type, <TypeReferenceNode>node, /*mapper*/ undefined);
|
||||
}
|
||||
// In a type reference, the outer type parameters of the referenced class or interface are automatically
|
||||
// supplied as type arguments and the type reference only specifies arguments for the local type parameters
|
||||
// of the class or interface.
|
||||
const typeArguments = concatenate(type.outerTypeParameters, fillMissingTypeArguments(typeArgs, typeParameters, minTypeArgumentCount, isJs));
|
||||
const typeArguments = concatenate(type.outerTypeParameters, fillMissingTypeArguments(typeArgumentsFromTypeReferenceNode(node), typeParameters, minTypeArgumentCount, isJs));
|
||||
return createTypeReference(<GenericType>type, typeArguments);
|
||||
}
|
||||
return checkNoTypeArguments(node, symbol) ? type : errorType;
|
||||
@@ -9170,7 +9210,7 @@ namespace ts {
|
||||
* references to the type parameters of the alias. We replace those with the actual type arguments by instantiating the
|
||||
* declared type. Instantiations are cached using the type identities of the type arguments as the key.
|
||||
*/
|
||||
function getTypeFromTypeAliasReference(node: NodeWithTypeArguments, symbol: Symbol, typeArguments: Type[] | undefined): Type {
|
||||
function getTypeFromTypeAliasReference(node: NodeWithTypeArguments, symbol: Symbol): Type {
|
||||
const type = getDeclaredTypeOfSymbol(symbol);
|
||||
const typeParameters = getSymbolLinks(symbol).typeParameters;
|
||||
if (typeParameters) {
|
||||
@@ -9186,7 +9226,7 @@ namespace ts {
|
||||
typeParameters.length);
|
||||
return errorType;
|
||||
}
|
||||
return getTypeAliasInstantiation(symbol, typeArguments);
|
||||
return getTypeAliasInstantiation(symbol, typeArgumentsFromTypeReferenceNode(node));
|
||||
}
|
||||
return checkNoTypeArguments(node, symbol) ? type : errorType;
|
||||
}
|
||||
@@ -9217,19 +9257,16 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getTypeReferenceType(node: NodeWithTypeArguments, symbol: Symbol): Type {
|
||||
const typeArguments = typeArgumentsFromTypeReferenceNode(node); // Do unconditionally so we mark type arguments as referenced.
|
||||
if (symbol === unknownSymbol) {
|
||||
return errorType;
|
||||
}
|
||||
symbol = getExpandoSymbol(symbol) || symbol;
|
||||
|
||||
if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
|
||||
return getTypeFromClassOrInterfaceReference(node, symbol, typeArguments);
|
||||
return getTypeFromClassOrInterfaceReference(node, symbol);
|
||||
}
|
||||
if (symbol.flags & SymbolFlags.TypeAlias) {
|
||||
return getTypeFromTypeAliasReference(node, symbol, typeArguments);
|
||||
return getTypeFromTypeAliasReference(node, symbol);
|
||||
}
|
||||
|
||||
// Get type from reference to named type that cannot be generic (enum or type parameter)
|
||||
const res = tryGetDeclaredTypeOfSymbol(symbol);
|
||||
if (res) {
|
||||
@@ -9237,7 +9274,6 @@ namespace ts {
|
||||
res.flags & TypeFlags.TypeParameter ? getConstrainedTypeVariable(<TypeParameter>res, node) : getRegularTypeOfLiteralType(res) :
|
||||
errorType;
|
||||
}
|
||||
|
||||
if (symbol.flags & SymbolFlags.Value && isJSDocTypeReference(node)) {
|
||||
const jsdocType = getTypeFromJSAlias(node, symbol);
|
||||
if (jsdocType) {
|
||||
@@ -9249,7 +9285,6 @@ namespace ts {
|
||||
return getTypeOfSymbol(symbol);
|
||||
}
|
||||
}
|
||||
|
||||
return errorType;
|
||||
}
|
||||
|
||||
@@ -9583,10 +9618,52 @@ namespace ts {
|
||||
return createTypeFromGenericGlobalType(readonly ? globalReadonlyArrayType : globalArrayType, [elementType]);
|
||||
}
|
||||
|
||||
function getTypeFromArrayTypeNode(node: ArrayTypeNode): Type {
|
||||
function getArrayOrTupleTargetType(node: ArrayTypeNode | TupleTypeNode): GenericType {
|
||||
const readonly = isReadonlyTypeOperator(node.parent);
|
||||
if (node.kind === SyntaxKind.ArrayType || node.elementTypes.length === 1 && node.elementTypes[0].kind === SyntaxKind.RestType) {
|
||||
return readonly ? globalReadonlyArrayType : globalArrayType;
|
||||
}
|
||||
const lastElement = lastOrUndefined(node.elementTypes);
|
||||
const restElement = lastElement && lastElement.kind === SyntaxKind.RestType ? lastElement : undefined;
|
||||
const minLength = findLastIndex(node.elementTypes, n => n.kind !== SyntaxKind.OptionalType && n !== restElement) + 1;
|
||||
return getTupleTypeOfArity(node.elementTypes.length, minLength, !!restElement, readonly, /*associatedNames*/ undefined);
|
||||
}
|
||||
|
||||
// Return true when the given node is transitively contained in type constructs that eagerly
|
||||
// resolve their constituent types. We include SyntaxKind.TypeReference because type arguments
|
||||
// of type aliases are eagerly resolved.
|
||||
function isAliasedType(node: Node): boolean {
|
||||
const parent = node.parent;
|
||||
switch (parent.kind) {
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
case SyntaxKind.TypeReference:
|
||||
case SyntaxKind.UnionType:
|
||||
case SyntaxKind.IntersectionType:
|
||||
case SyntaxKind.IndexedAccessType:
|
||||
case SyntaxKind.ConditionalType:
|
||||
case SyntaxKind.TypeOperator:
|
||||
return isAliasedType(parent);
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getTypeFromArrayOrTupleTypeNode(node: ArrayTypeNode | TupleTypeNode): Type {
|
||||
const links = getNodeLinks(node);
|
||||
if (!links.resolvedType) {
|
||||
links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType), isReadonlyTypeOperator(node.parent));
|
||||
const target = getArrayOrTupleTargetType(node);
|
||||
if (target === emptyGenericType) {
|
||||
links.resolvedType = emptyObjectType;
|
||||
}
|
||||
else if (isAliasedType(node)) {
|
||||
links.resolvedType = node.kind === SyntaxKind.TupleType && node.elementTypes.length === 0 ? target :
|
||||
createDeferredTypeReference(target, node, /*mapper*/ undefined);
|
||||
}
|
||||
else {
|
||||
const elementTypes = node.kind === SyntaxKind.ArrayType ? [getTypeFromTypeNode(node.elementType)] : map(node.elementTypes, getTypeFromTypeNode);
|
||||
links.resolvedType = createTypeReference(target, elementTypes);
|
||||
}
|
||||
}
|
||||
return links.resolvedType;
|
||||
}
|
||||
@@ -9630,7 +9707,7 @@ namespace ts {
|
||||
type.instantiations = createMap<TypeReference>();
|
||||
type.instantiations.set(getTypeListId(type.typeParameters), <GenericType>type);
|
||||
type.target = <GenericType>type;
|
||||
type.typeArguments = type.typeParameters;
|
||||
type.resolvedTypeArguments = type.typeParameters;
|
||||
type.thisType = createTypeParameter();
|
||||
type.thisType.isThisType = true;
|
||||
type.thisType.constraint = type;
|
||||
@@ -9664,21 +9741,6 @@ namespace ts {
|
||||
return elementTypes.length ? createTypeReference(tupleType, elementTypes) : tupleType;
|
||||
}
|
||||
|
||||
function getTypeFromTupleTypeNode(node: TupleTypeNode): Type {
|
||||
const links = getNodeLinks(node);
|
||||
if (!links.resolvedType) {
|
||||
const lastElement = lastOrUndefined(node.elementTypes);
|
||||
const restElement = lastElement && lastElement.kind === SyntaxKind.RestType ? lastElement : undefined;
|
||||
const minLength = findLastIndex(node.elementTypes, n => n.kind !== SyntaxKind.OptionalType && n !== restElement) + 1;
|
||||
const elementTypes = map(node.elementTypes, n => {
|
||||
const type = getTypeFromTypeNode(n);
|
||||
return n === restElement && getIndexTypeOfType(type, IndexKind.Number) || type;
|
||||
});
|
||||
links.resolvedType = createTupleType(elementTypes, minLength, !!restElement, isReadonlyTypeOperator(node.parent));
|
||||
}
|
||||
return links.resolvedType;
|
||||
}
|
||||
|
||||
function sliceTupleType(type: TupleTypeReference, index: number) {
|
||||
const tuple = type.target;
|
||||
if (tuple.hasRestElement) {
|
||||
@@ -9686,7 +9748,7 @@ namespace ts {
|
||||
index = Math.min(index, getTypeReferenceArity(type) - 1);
|
||||
}
|
||||
return createTupleType(
|
||||
(type.typeArguments || emptyArray).slice(index),
|
||||
getTypeArguments(type).slice(index),
|
||||
Math.max(0, tuple.minLength - index),
|
||||
tuple.hasRestElement,
|
||||
tuple.readonly,
|
||||
@@ -11196,9 +11258,8 @@ namespace ts {
|
||||
case SyntaxKind.TypeQuery:
|
||||
return getTypeFromTypeQueryNode(<TypeQueryNode>node);
|
||||
case SyntaxKind.ArrayType:
|
||||
return getTypeFromArrayTypeNode(<ArrayTypeNode>node);
|
||||
case SyntaxKind.TupleType:
|
||||
return getTypeFromTupleTypeNode(<TupleTypeNode>node);
|
||||
return getTypeFromArrayOrTupleTypeNode(<ArrayTypeNode | TupleTypeNode>node);
|
||||
case SyntaxKind.OptionalType:
|
||||
return getTypeFromOptionalTypeNode(<OptionalTypeNode>node);
|
||||
case SyntaxKind.UnionType:
|
||||
@@ -11210,10 +11271,11 @@ namespace ts {
|
||||
case SyntaxKind.JSDocOptionalType:
|
||||
return addOptionality(getTypeFromTypeNode((node as JSDocOptionalType).type));
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
case SyntaxKind.RestType:
|
||||
case SyntaxKind.JSDocNonNullableType:
|
||||
case SyntaxKind.JSDocTypeExpression:
|
||||
return getTypeFromTypeNode((<ParenthesizedTypeNode | RestTypeNode | JSDocTypeReferencingNode | JSDocTypeExpression>node).type);
|
||||
return getTypeFromTypeNode((<ParenthesizedTypeNode | JSDocTypeReferencingNode | JSDocTypeExpression>node).type);
|
||||
case SyntaxKind.RestType:
|
||||
return getElementTypeOfArrayType(getTypeFromTypeNode((<RestTypeNode>node).type)) || errorType;
|
||||
case SyntaxKind.JSDocVariadicType:
|
||||
return getTypeFromJSDocVariadicType(node as JSDocVariadicType);
|
||||
case SyntaxKind.FunctionType:
|
||||
@@ -11410,17 +11472,17 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function getAnonymousTypeInstantiation(type: AnonymousType, mapper: TypeMapper) {
|
||||
function getObjectTypeInstantiation(type: AnonymousType | DeferredTypeReference, mapper: TypeMapper) {
|
||||
const target = type.objectFlags & ObjectFlags.Instantiated ? type.target! : type;
|
||||
const { symbol } = target;
|
||||
const links = getSymbolLinks(symbol);
|
||||
const node = type.objectFlags & ObjectFlags.Reference ? (<TypeReference>type).node! : type.symbol.declarations[0];
|
||||
const links = getNodeLinks(node);
|
||||
let typeParameters = links.outerTypeParameters;
|
||||
if (!typeParameters) {
|
||||
// The first time an anonymous type is instantiated we compute and store a list of the type
|
||||
// parameters that are in scope (and therefore potentially referenced). For type literals that
|
||||
// aren't the right hand side of a generic type alias declaration we optimize by reducing the
|
||||
// set of type parameters to those that are possibly referenced in the literal.
|
||||
let declaration = symbol.declarations[0];
|
||||
let declaration = node;
|
||||
if (isInJSFile(declaration)) {
|
||||
const paramTag = findAncestor(declaration, isJSDocParameterTag);
|
||||
if (paramTag) {
|
||||
@@ -11436,7 +11498,7 @@ namespace ts {
|
||||
outerTypeParameters = addRange(outerTypeParameters, templateTagParameters);
|
||||
}
|
||||
typeParameters = outerTypeParameters || emptyArray;
|
||||
typeParameters = symbol.flags & SymbolFlags.TypeLiteral && !target.aliasTypeArguments ?
|
||||
typeParameters = (target.objectFlags & ObjectFlags.Reference || target.symbol.flags & SymbolFlags.TypeLiteral) && !target.aliasTypeArguments ?
|
||||
filter(typeParameters, tp => isTypeParameterPossiblyReferenced(tp, declaration)) :
|
||||
typeParameters;
|
||||
links.outerTypeParameters = typeParameters;
|
||||
@@ -11449,13 +11511,14 @@ namespace ts {
|
||||
// We are instantiating an anonymous type that has one or more type parameters in scope. Apply the
|
||||
// mapper to the type parameters to produce the effective list of type arguments, and compute the
|
||||
// instantiation cache key from the type IDs of the type arguments.
|
||||
const combinedMapper = type.objectFlags & ObjectFlags.Instantiated ? combineTypeMappers(type.mapper, mapper) : mapper;
|
||||
const typeArguments: Type[] = map(typeParameters, combinedMapper);
|
||||
const typeArguments = map(typeParameters, combineTypeMappers(type.mapper, mapper));
|
||||
const id = getTypeListId(typeArguments);
|
||||
let result = links.instantiations!.get(id);
|
||||
if (!result) {
|
||||
const newMapper = createTypeMapper(typeParameters, typeArguments);
|
||||
result = target.objectFlags & ObjectFlags.Mapped ? instantiateMappedType(<MappedType>target, newMapper) : instantiateAnonymousType(target, newMapper);
|
||||
result = target.objectFlags & ObjectFlags.Reference ? createDeferredTypeReference((<DeferredTypeReference>type).target, (<DeferredTypeReference>type).node, newMapper) :
|
||||
target.objectFlags & ObjectFlags.Mapped ? instantiateMappedType(<MappedType>target, newMapper) :
|
||||
instantiateAnonymousType(target, newMapper);
|
||||
links.instantiations!.set(id, result);
|
||||
}
|
||||
return result;
|
||||
@@ -11549,7 +11612,7 @@ namespace ts {
|
||||
|
||||
function instantiateMappedTupleType(tupleType: TupleTypeReference, mappedType: MappedType, mapper: TypeMapper) {
|
||||
const minLength = tupleType.target.minLength;
|
||||
const elementTypes = map(tupleType.typeArguments || emptyArray, (_, i) =>
|
||||
const elementTypes = map(getTypeArguments(tupleType), (_, i) =>
|
||||
instantiateMappedTypeTemplate(mappedType, getLiteralType("" + i), i >= minLength, mapper));
|
||||
const modifiers = getMappedTypeModifiers(mappedType);
|
||||
const newMinLength = modifiers & MappedTypeModifiers.IncludeOptional ? 0 :
|
||||
@@ -11652,15 +11715,18 @@ namespace ts {
|
||||
// interface, in an object type literal, or in an object literal expression, we may need
|
||||
// to instantiate the type because it might reference a type parameter.
|
||||
return couldContainTypeVariables(type) ?
|
||||
getAnonymousTypeInstantiation(<AnonymousType>type, mapper) : type;
|
||||
getObjectTypeInstantiation(<AnonymousType>type, mapper) : type;
|
||||
}
|
||||
if (objectFlags & ObjectFlags.Mapped) {
|
||||
return getAnonymousTypeInstantiation(<AnonymousType>type, mapper);
|
||||
return getObjectTypeInstantiation(<AnonymousType>type, mapper);
|
||||
}
|
||||
if (objectFlags & ObjectFlags.Reference) {
|
||||
const typeArguments = (<TypeReference>type).typeArguments;
|
||||
const newTypeArguments = instantiateTypes(typeArguments, mapper);
|
||||
return newTypeArguments !== typeArguments ? createTypeReference((<TypeReference>type).target, newTypeArguments) : type;
|
||||
if ((<TypeReference>type).node) {
|
||||
return getObjectTypeInstantiation(<TypeReference>type, mapper);
|
||||
}
|
||||
const resolvedTypeArguments = (<TypeReference>type).resolvedTypeArguments;
|
||||
const newTypeArguments = instantiateTypes(resolvedTypeArguments, mapper);
|
||||
return newTypeArguments !== resolvedTypeArguments ? createTypeReference((<TypeReference>type).target, newTypeArguments) : type;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@@ -13776,7 +13842,7 @@ namespace ts {
|
||||
// type references (which are intended by be compared structurally). Obtain the variance
|
||||
// information for the type parameters and relate the type arguments accordingly.
|
||||
const variances = getVariances((<TypeReference>source).target);
|
||||
const varianceResult = relateVariances((<TypeReference>source).typeArguments, (<TypeReference>target).typeArguments, variances, isIntersectionConstituent);
|
||||
const varianceResult = relateVariances(getTypeArguments(<TypeReference>source), getTypeArguments(<TypeReference>target), variances, isIntersectionConstituent);
|
||||
if (varianceResult !== undefined) {
|
||||
return varianceResult;
|
||||
}
|
||||
@@ -14202,8 +14268,9 @@ namespace ts {
|
||||
}
|
||||
const targetCount = getTypeReferenceArity(target) - 1;
|
||||
const sourceCount = getTypeReferenceArity(source) - (sourceRestType ? 1 : 0);
|
||||
const sourceTypeArguments = getTypeArguments(<TypeReference>source);
|
||||
for (let i = targetCount; i < sourceCount; i++) {
|
||||
const related = isRelatedTo((<TypeReference>source).typeArguments![i], targetRestType, reportErrors);
|
||||
const related = isRelatedTo(sourceTypeArguments[i], targetRestType, reportErrors);
|
||||
if (!related) {
|
||||
if (reportErrors) {
|
||||
reportError(Diagnostics.Property_0_is_incompatible_with_rest_element_type, "" + i);
|
||||
@@ -14217,9 +14284,11 @@ namespace ts {
|
||||
// We only call this for union target types when we're attempting to do excess property checking - in those cases, we want to get _all possible props_
|
||||
// from the target union, across all members
|
||||
const properties = target.flags & TypeFlags.Union ? getPossiblePropertiesOfUnionType(target as UnionType) : getPropertiesOfType(target);
|
||||
const numericNamesOnly = isTupleType(source) && isTupleType(target);
|
||||
for (const targetProp of excludeProperties(properties, excludedProperties)) {
|
||||
if (!(targetProp.flags & SymbolFlags.Prototype)) {
|
||||
const sourceProp = getPropertyOfType(source, targetProp.escapedName);
|
||||
const name = targetProp.escapedName;
|
||||
if (!(targetProp.flags & SymbolFlags.Prototype) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
|
||||
const sourceProp = getPropertyOfType(source, name);
|
||||
if (sourceProp && sourceProp !== targetProp) {
|
||||
const related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors, isIntersectionConstituent);
|
||||
if (!related) {
|
||||
@@ -14629,8 +14698,12 @@ namespace ts {
|
||||
return type.flags & TypeFlags.TypeParameter && !getConstraintOfTypeParameter(<TypeParameter>type);
|
||||
}
|
||||
|
||||
function isNonDeferredTypeReference(type: Type): type is TypeReference {
|
||||
return !!(getObjectFlags(type) & ObjectFlags.Reference) && !(<TypeReference>type).node;
|
||||
}
|
||||
|
||||
function isTypeReferenceWithGenericArguments(type: Type): boolean {
|
||||
return !!(getObjectFlags(type) & ObjectFlags.Reference) && some((<TypeReference>type).typeArguments, t => isUnconstrainedTypeParameter(t) || isTypeReferenceWithGenericArguments(t));
|
||||
return isNonDeferredTypeReference(type) && some(getTypeArguments(type), t => isUnconstrainedTypeParameter(t) || isTypeReferenceWithGenericArguments(t));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14639,7 +14712,7 @@ namespace ts {
|
||||
*/
|
||||
function getTypeReferenceId(type: TypeReference, typeParameters: Type[], depth = 0) {
|
||||
let result = "" + type.target.id;
|
||||
for (const t of type.typeArguments!) {
|
||||
for (const t of getTypeArguments(type)) {
|
||||
if (isUnconstrainedTypeParameter(t)) {
|
||||
let index = typeParameters.indexOf(t);
|
||||
if (index < 0) {
|
||||
@@ -14937,7 +15010,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getElementTypeOfArrayType(type: Type): Type | undefined {
|
||||
return isArrayType(type) && (type as TypeReference).typeArguments ? (type as TypeReference).typeArguments![0] : undefined;
|
||||
return isArrayType(type) ? getTypeArguments(type as TypeReference)[0] : undefined;
|
||||
}
|
||||
|
||||
function isArrayLikeType(type: Type): boolean {
|
||||
@@ -14947,7 +15020,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function isEmptyArrayLiteralType(type: Type): boolean {
|
||||
const elementType = isArrayType(type) ? (<TypeReference>type).typeArguments![0] : undefined;
|
||||
const elementType = isArrayType(type) ? getTypeArguments(<TypeReference>type)[0] : undefined;
|
||||
return elementType === undefinedWideningType || elementType === implicitNeverType;
|
||||
}
|
||||
|
||||
@@ -15045,7 +15118,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getRestTypeOfTupleType(type: TupleTypeReference) {
|
||||
return type.target.hasRestElement ? type.typeArguments![type.target.typeParameters!.length - 1] : undefined;
|
||||
return type.target.hasRestElement ? getTypeArguments(type)[type.target.typeParameters!.length - 1] : undefined;
|
||||
}
|
||||
|
||||
function getRestArrayTypeOfTupleType(type: TupleTypeReference) {
|
||||
@@ -15334,7 +15407,7 @@ namespace ts {
|
||||
result = getIntersectionType(sameMap((<IntersectionType>type).types, getWidenedType));
|
||||
}
|
||||
else if (isArrayType(type) || isTupleType(type)) {
|
||||
result = createTypeReference((<TypeReference>type).target, sameMap((<TypeReference>type).typeArguments, getWidenedType));
|
||||
result = createTypeReference((<TypeReference>type).target, sameMap(getTypeArguments(<TypeReference>type), getWidenedType));
|
||||
}
|
||||
if (result && context === undefined) {
|
||||
type.widened = result;
|
||||
@@ -15371,7 +15444,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
if (isArrayType(type) || isTupleType(type)) {
|
||||
for (const t of (<TypeReference>type).typeArguments!) {
|
||||
for (const t of getTypeArguments(<TypeReference>type)) {
|
||||
if (reportWideningErrorsInType(t)) {
|
||||
errorReported = true;
|
||||
}
|
||||
@@ -15587,7 +15660,7 @@ namespace ts {
|
||||
function couldContainTypeVariables(type: Type): boolean {
|
||||
const objectFlags = getObjectFlags(type);
|
||||
return !!(type.flags & TypeFlags.Instantiable ||
|
||||
objectFlags & ObjectFlags.Reference && forEach((<TypeReference>type).typeArguments, couldContainTypeVariables) ||
|
||||
objectFlags & ObjectFlags.Reference && forEach(getTypeArguments(<TypeReference>type), couldContainTypeVariables) ||
|
||||
objectFlags & ObjectFlags.Anonymous && type.symbol && type.symbol.flags & (SymbolFlags.Function | SymbolFlags.Method | SymbolFlags.Class | SymbolFlags.TypeLiteral | SymbolFlags.ObjectLiteral) && type.symbol.declarations ||
|
||||
objectFlags & ObjectFlags.Mapped ||
|
||||
type.flags & TypeFlags.UnionOrIntersection && !(type.flags & TypeFlags.EnumLiteral) && couldUnionOrIntersectionContainTypeVariables(<UnionOrIntersectionType>type));
|
||||
@@ -15663,10 +15736,10 @@ namespace ts {
|
||||
// For arrays and tuples we infer new arrays and tuples where the reverse mapping has been
|
||||
// applied to the element type(s).
|
||||
if (isArrayType(source)) {
|
||||
return createArrayType(inferReverseMappedType((<TypeReference>source).typeArguments![0], target, constraint), isReadonlyArrayType(source));
|
||||
return createArrayType(inferReverseMappedType(getTypeArguments(<TypeReference>source)[0], target, constraint), isReadonlyArrayType(source));
|
||||
}
|
||||
if (isTupleType(source)) {
|
||||
const elementTypes = map(source.typeArguments || emptyArray, t => inferReverseMappedType(t, target, constraint));
|
||||
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);
|
||||
@@ -15886,7 +15959,7 @@ namespace ts {
|
||||
if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && (
|
||||
(<TypeReference>source).target === (<TypeReference>target).target || isArrayType(source) && isArrayType(target))) {
|
||||
// If source and target are references to the same generic type, infer from type arguments
|
||||
inferFromTypeArguments((<TypeReference>source).typeArguments || emptyArray, (<TypeReference>target).typeArguments || emptyArray, getVariances((<TypeReference>source).target));
|
||||
inferFromTypeArguments(getTypeArguments(<TypeReference>source), getTypeArguments(<TypeReference>target), getVariances((<TypeReference>source).target));
|
||||
}
|
||||
else if (source.flags & TypeFlags.Index && target.flags & TypeFlags.Index) {
|
||||
contravariant = !contravariant;
|
||||
@@ -16195,10 +16268,10 @@ namespace ts {
|
||||
const targetRestType = getRestTypeOfTupleType(target);
|
||||
const fixedLength = targetLength < sourceLength || sourceRestType ? targetLength : sourceLength;
|
||||
for (let i = 0; i < fixedLength; i++) {
|
||||
inferFromTypes(i < sourceLength ? (<TypeReference>source).typeArguments![i] : sourceRestType!, target.typeArguments![i]);
|
||||
inferFromTypes(i < sourceLength ? getTypeArguments(<TypeReference>source)[i] : sourceRestType!, getTypeArguments(target)[i]);
|
||||
}
|
||||
if (targetRestType) {
|
||||
const types = fixedLength < sourceLength ? (<TypeReference>source).typeArguments!.slice(fixedLength, sourceLength) : [];
|
||||
const types = fixedLength < sourceLength ? getTypeArguments(<TypeReference>source).slice(fixedLength, sourceLength) : [];
|
||||
if (sourceRestType) {
|
||||
types.push(sourceRestType);
|
||||
}
|
||||
@@ -19017,7 +19090,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getThisTypeArgument(type: Type): Type | undefined {
|
||||
return getObjectFlags(type) & ObjectFlags.Reference && (<TypeReference>type).target === globalThisType ? (<TypeReference>type).typeArguments![0] : undefined;
|
||||
return getObjectFlags(type) & ObjectFlags.Reference && (<TypeReference>type).target === globalThisType ? getTypeArguments(<TypeReference>type)[0] : undefined;
|
||||
}
|
||||
|
||||
function getThisTypeFromContextualType(type: Type): Type | undefined {
|
||||
@@ -22070,7 +22143,7 @@ namespace ts {
|
||||
const spreadArgument = <SpreadElement>args[length - 1];
|
||||
const type = flowLoopCount ? checkExpression(spreadArgument.expression) : checkExpressionCached(spreadArgument.expression);
|
||||
if (isTupleType(type)) {
|
||||
const typeArguments = (<TypeReference>type).typeArguments || emptyArray;
|
||||
const typeArguments = getTypeArguments(<TypeReference>type);
|
||||
const restIndex = type.target.hasRestElement ? typeArguments.length - 1 : -1;
|
||||
const syntheticArgs = map(typeArguments, (t, i) => createSyntheticExpression(spreadArgument, t, /*isSpread*/ i === restIndex));
|
||||
return concatenate(args.slice(0, length - 1), syntheticArgs);
|
||||
@@ -23610,7 +23683,7 @@ namespace ts {
|
||||
// otherwise would return the type 'undefined').
|
||||
const restType = getTypeOfSymbol(signature.parameters[paramCount]);
|
||||
const index = pos - paramCount;
|
||||
if (!isTupleType(restType) || restType.target.hasRestElement || index < (restType.typeArguments || emptyArray).length) {
|
||||
if (!isTupleType(restType) || restType.target.hasRestElement || index < getTypeArguments(restType).length) {
|
||||
return getIndexedAccessType(restType, getLiteralType(index));
|
||||
}
|
||||
}
|
||||
@@ -23644,7 +23717,7 @@ namespace ts {
|
||||
if (signature.hasRestParameter) {
|
||||
const restType = getTypeOfSymbol(signature.parameters[length - 1]);
|
||||
if (isTupleType(restType)) {
|
||||
return length + (restType.typeArguments || emptyArray).length - 1;
|
||||
return length + getTypeArguments(restType).length - 1;
|
||||
}
|
||||
}
|
||||
return length;
|
||||
@@ -25382,7 +25455,7 @@ namespace ts {
|
||||
function padTupleType(type: TupleTypeReference, pattern: ArrayBindingPattern) {
|
||||
const patternElements = pattern.elements;
|
||||
const arity = getTypeReferenceArity(type);
|
||||
const elementTypes = arity ? type.typeArguments!.slice() : [];
|
||||
const elementTypes = arity ? getTypeArguments(type).slice() : [];
|
||||
for (let i = arity; i < patternElements.length; i++) {
|
||||
const e = patternElements[i];
|
||||
if (i < patternElements.length - 1 || !(e.kind === SyntaxKind.BindingElement && e.dotDotDotToken)) {
|
||||
@@ -26406,16 +26479,13 @@ namespace ts {
|
||||
if (node.kind === SyntaxKind.TypeReference && node.typeName.jsdocDotPos !== undefined && !isInJSFile(node) && !isInJSDoc(node)) {
|
||||
grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
|
||||
}
|
||||
forEach(node.typeArguments, checkSourceElement);
|
||||
const type = getTypeFromTypeReference(node);
|
||||
if (type !== errorType) {
|
||||
if (node.typeArguments) {
|
||||
// Do type argument local checks only if referenced type is successfully resolved
|
||||
forEach(node.typeArguments, checkSourceElement);
|
||||
if (produceDiagnostics) {
|
||||
const typeParameters = getTypeParametersForTypeReference(node);
|
||||
if (typeParameters) {
|
||||
checkTypeArgumentConstraints(node, typeParameters);
|
||||
}
|
||||
if (node.typeArguments && produceDiagnostics) {
|
||||
const typeParameters = getTypeParametersForTypeReference(node);
|
||||
if (typeParameters) {
|
||||
checkTypeArgumentConstraints(node, typeParameters);
|
||||
}
|
||||
}
|
||||
if (type.flags & TypeFlags.Enum && getNodeLinks(node).resolvedSymbol!.flags & SymbolFlags.EnumMember) {
|
||||
@@ -26460,7 +26530,7 @@ namespace ts {
|
||||
grammarErrorOnNode(e, Diagnostics.A_rest_element_must_be_last_in_a_tuple_type);
|
||||
break;
|
||||
}
|
||||
if (!isArrayType(getTypeFromTypeNode(e))) {
|
||||
if (!isArrayType(getTypeFromTypeNode((<RestTypeNode>e).type))) {
|
||||
error(e, Diagnostics.A_rest_element_type_must_be_an_array_type);
|
||||
}
|
||||
}
|
||||
@@ -26954,7 +27024,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (isReferenceToType(promise, getGlobalPromiseType(/*reportErrors*/ false))) {
|
||||
return typeAsPromise.promisedTypeOfPromise = (<GenericType>promise).typeArguments![0];
|
||||
return typeAsPromise.promisedTypeOfPromise = getTypeArguments(<GenericType>promise)[0];
|
||||
}
|
||||
|
||||
const thenFunction = getTypeOfPropertyOfType(promise, "then" as __String)!; // TODO: GH#18217
|
||||
@@ -28899,7 +28969,7 @@ namespace ts {
|
||||
let globalType: Type;
|
||||
if (isReferenceToType(type, globalType = resolver.getGlobalIterableType(/*reportErrors*/ false)) ||
|
||||
isReferenceToType(type, globalType = resolver.getGlobalIterableIteratorType(/*reportErrors*/ false))) {
|
||||
const [yieldType] = (type as GenericType).typeArguments!;
|
||||
const [yieldType] = getTypeArguments(type as GenericType);
|
||||
// The "return" and "next" types of `Iterable` and `IterableIterator` are defined by the
|
||||
// iteration types of their `[Symbol.iterator]()` method. The same is true for their async cousins.
|
||||
// While we define these as `any` and `undefined` in our libs by default, a custom lib *could* use
|
||||
@@ -28912,7 +28982,7 @@ namespace ts {
|
||||
// just grab its related type arguments:
|
||||
// - `Generator<T, TReturn, TNext>` or `AsyncGenerator<T, TReturn, TNext>`
|
||||
if (isReferenceToType(type, resolver.getGlobalGeneratorType(/*reportErrors*/ false))) {
|
||||
const [yieldType, returnType, nextType] = (type as GenericType).typeArguments!;
|
||||
const [yieldType, returnType, nextType] = getTypeArguments(type as GenericType);
|
||||
return (type as IterableOrIteratorType)[resolver.iterableCacheKey] = createIterationTypes(yieldType, returnType, nextType);
|
||||
}
|
||||
}
|
||||
@@ -29000,7 +29070,7 @@ namespace ts {
|
||||
// - `Generator<T, TReturn, TNext>` or `AsyncGenerator<T, TReturn, TNext>`
|
||||
const globalType = resolver.getGlobalIterableIteratorType(/*reportErrors*/ false);
|
||||
if (isReferenceToType(type, globalType)) {
|
||||
const [yieldType] = (type as GenericType).typeArguments!;
|
||||
const [yieldType] = getTypeArguments(type as GenericType);
|
||||
// The "return" and "next" types of `IterableIterator` and `AsyncIterableIterator` are defined by the
|
||||
// iteration types of their `next`, `return`, and `throw` methods. While we define these as `any`
|
||||
// and `undefined` in our libs by default, a custom lib *could* use different definitions.
|
||||
@@ -29012,7 +29082,7 @@ namespace ts {
|
||||
}
|
||||
if (isReferenceToType(type, resolver.getGlobalIteratorType(/*reportErrors*/ false)) ||
|
||||
isReferenceToType(type, resolver.getGlobalGeneratorType(/*reportErrors*/ false))) {
|
||||
const [yieldType, returnType, nextType] = (type as GenericType).typeArguments!;
|
||||
const [yieldType, returnType, nextType] = getTypeArguments(type as GenericType);
|
||||
return (type as IterableOrIteratorType)[resolver.iteratorCacheKey] = createIterationTypes(yieldType, returnType, nextType);
|
||||
}
|
||||
}
|
||||
@@ -29054,11 +29124,11 @@ namespace ts {
|
||||
// As an optimization, if the type is an instantiation of one of the global `IteratorYieldResult<T>`
|
||||
// or `IteratorReturnResult<TReturn>` types, then just grab its type argument.
|
||||
if (isReferenceToType(type, getGlobalIteratorYieldResultType(/*reportErrors*/ false))) {
|
||||
const yieldType = (type as GenericType).typeArguments![0];
|
||||
const yieldType = getTypeArguments(type as GenericType)[0];
|
||||
return (type as IterableOrIteratorType).iterationTypesOfIteratorResult = createIterationTypes(yieldType, /*returnType*/ undefined, /*nextType*/ undefined);
|
||||
}
|
||||
if (isReferenceToType(type, getGlobalIteratorReturnResultType(/*reportErrors*/ false))) {
|
||||
const returnType = (type as GenericType).typeArguments![0];
|
||||
const returnType = getTypeArguments(type as GenericType)[0];
|
||||
return (type as IterableOrIteratorType).iterationTypesOfIteratorResult = createIterationTypes(/*yieldType*/ undefined, returnType, /*nextType*/ undefined);
|
||||
}
|
||||
|
||||
@@ -29694,6 +29764,7 @@ namespace ts {
|
||||
|
||||
const baseTypeNode = getEffectiveBaseTypeNode(node);
|
||||
if (baseTypeNode) {
|
||||
forEach(baseTypeNode.typeArguments, checkSourceElement);
|
||||
if (languageVersion < ScriptTarget.ES2015) {
|
||||
checkExternalEmitHelpers(baseTypeNode.parent, ExternalEmitHelpers.Extends);
|
||||
}
|
||||
@@ -29733,12 +29804,9 @@ namespace ts {
|
||||
|
||||
if (!(staticBaseType.symbol && staticBaseType.symbol.flags & SymbolFlags.Class) && !(baseConstructorType.flags & TypeFlags.TypeVariable)) {
|
||||
// When the static base type is a "class-like" constructor function (but not actually a class), we verify
|
||||
// that all instantiated base constructor signatures return the same type. We can simply compare the type
|
||||
// references (as opposed to checking the structure of the types) because elsewhere we have already checked
|
||||
// that the base type is a class or interface type (and not, for example, an anonymous object type).
|
||||
// (Javascript constructor functions have this property trivially true since their return type is ignored.)
|
||||
// that all instantiated base constructor signatures return the same type.
|
||||
const constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode);
|
||||
if (forEach(constructors, sig => !isJSConstructor(sig.declaration) && getReturnTypeOfSignature(sig) !== baseType)) {
|
||||
if (forEach(constructors, sig => !isJSConstructor(sig.declaration) && !isTypeIdenticalTo(getReturnTypeOfSignature(sig), baseType))) {
|
||||
error(baseTypeNode.expression, Diagnostics.Base_constructors_must_all_have_the_same_return_type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ namespace ts {
|
||||
getResolvedSymbol: (node: Node) => Symbol,
|
||||
getIndexTypeOfStructuredType: (type: Type, kind: IndexKind) => Type | undefined,
|
||||
getConstraintOfTypeParameter: (typeParameter: TypeParameter) => Type | undefined,
|
||||
getFirstIdentifier: (node: EntityNameOrEntityNameExpression) => Identifier) {
|
||||
getFirstIdentifier: (node: EntityNameOrEntityNameExpression) => Identifier,
|
||||
getTypeArguments: (type: TypeReference) => readonly Type[]) {
|
||||
|
||||
return getSymbolWalker;
|
||||
|
||||
@@ -89,7 +90,7 @@ namespace ts {
|
||||
|
||||
function visitTypeReference(type: TypeReference): void {
|
||||
visitType(type.target);
|
||||
forEach(type.typeArguments, visitType);
|
||||
forEach(getTypeArguments(type), visitType);
|
||||
}
|
||||
|
||||
function visitTypeParameter(type: TypeParameter): void {
|
||||
|
||||
+15
-1
@@ -3193,6 +3193,7 @@ namespace ts {
|
||||
/* @internal */ getParameterType(signature: Signature, parameterIndex: number): Type;
|
||||
getNullableType(type: Type, flags: TypeFlags): Type;
|
||||
getNonNullableType(type: Type): Type;
|
||||
getTypeArguments(type: TypeReference): readonly Type[];
|
||||
|
||||
// TODO: GH#18217 `xToDeclaration` calls are frequently asserted as defined.
|
||||
/** Note that the resulting nodes cannot be checked. */
|
||||
@@ -4027,6 +4028,8 @@ namespace ts {
|
||||
contextFreeType?: Type; // Cached context-free type used by the first pass of inference; used when a function's return is partially contextually sensitive
|
||||
deferredNodes?: Map<Node>; // Set of nodes whose checking has been deferred
|
||||
capturedBlockScopeBindings?: Symbol[]; // Block-scoped bindings captured beneath this part of an IterationStatement
|
||||
outerTypeParameters?: TypeParameter[]; // Outer type parameters of anonymous object type
|
||||
instantiations?: Map<Type>; // Instantiations of generic type alias (undefined if non-generic)
|
||||
isExhaustive?: boolean; // Is node an exhaustive switch statement
|
||||
}
|
||||
|
||||
@@ -4274,11 +4277,22 @@ namespace ts {
|
||||
*/
|
||||
export interface TypeReference extends ObjectType {
|
||||
target: GenericType; // Type reference target
|
||||
typeArguments?: readonly Type[]; // Type reference type arguments (undefined if none)
|
||||
node?: TypeReferenceNode | ArrayTypeNode | TupleTypeNode;
|
||||
/* @internal */
|
||||
mapper?: TypeMapper;
|
||||
/* @internal */
|
||||
resolvedTypeArguments?: readonly Type[]; // Resolved type reference type arguments
|
||||
/* @internal */
|
||||
literalType?: TypeReference; // Clone of type with ObjectFlags.ArrayLiteral set
|
||||
}
|
||||
|
||||
export interface DeferredTypeReference extends TypeReference {
|
||||
/* @internal */
|
||||
node: TypeReferenceNode | ArrayTypeNode | TupleTypeNode;
|
||||
/* @internal */
|
||||
mapper?: TypeMapper;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export const enum VarianceFlags {
|
||||
Invariant = 0, // Neither covariant nor contravariant
|
||||
|
||||
@@ -993,8 +993,8 @@ namespace ts.codefix {
|
||||
}
|
||||
else if (getObjectFlags(genericType) & ObjectFlags.Reference && getObjectFlags(usageType) & ObjectFlags.Reference) {
|
||||
// this is wrong because we need a reference to the targetType to, so we can check that it's also a reference
|
||||
const genericArgs = (genericType as TypeReference).typeArguments;
|
||||
const usageArgs = (usageType as TypeReference).typeArguments;
|
||||
const genericArgs = checker.getTypeArguments(genericType as TypeReference);
|
||||
const usageArgs = checker.getTypeArguments(usageType as TypeReference);
|
||||
const types = [];
|
||||
if (genericArgs && usageArgs) {
|
||||
for (let i = 0; i < genericArgs.length; i++) {
|
||||
|
||||
+4
-1
@@ -1967,6 +1967,7 @@ declare namespace ts {
|
||||
getReturnTypeOfSignature(signature: Signature): Type;
|
||||
getNullableType(type: Type, flags: TypeFlags): Type;
|
||||
getNonNullableType(type: Type): Type;
|
||||
getTypeArguments(type: TypeReference): readonly Type[];
|
||||
/** Note that the resulting nodes cannot be checked. */
|
||||
typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeNode | undefined;
|
||||
/** Note that the resulting nodes cannot be checked. */
|
||||
@@ -2388,7 +2389,9 @@ declare namespace ts {
|
||||
*/
|
||||
export interface TypeReference extends ObjectType {
|
||||
target: GenericType;
|
||||
typeArguments?: readonly Type[];
|
||||
node?: TypeReferenceNode | ArrayTypeNode | TupleTypeNode;
|
||||
}
|
||||
export interface DeferredTypeReference extends TypeReference {
|
||||
}
|
||||
export interface GenericType extends InterfaceType, TypeReference {
|
||||
}
|
||||
|
||||
+4
-1
@@ -1967,6 +1967,7 @@ declare namespace ts {
|
||||
getReturnTypeOfSignature(signature: Signature): Type;
|
||||
getNullableType(type: Type, flags: TypeFlags): Type;
|
||||
getNonNullableType(type: Type): Type;
|
||||
getTypeArguments(type: TypeReference): readonly Type[];
|
||||
/** Note that the resulting nodes cannot be checked. */
|
||||
typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeNode | undefined;
|
||||
/** Note that the resulting nodes cannot be checked. */
|
||||
@@ -2388,7 +2389,9 @@ declare namespace ts {
|
||||
*/
|
||||
export interface TypeReference extends ObjectType {
|
||||
target: GenericType;
|
||||
typeArguments?: readonly Type[];
|
||||
node?: TypeReferenceNode | ArrayTypeNode | TupleTypeNode;
|
||||
}
|
||||
export interface DeferredTypeReference extends TypeReference {
|
||||
}
|
||||
export interface GenericType extends InterfaceType, TypeReference {
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/async/es5/asyncAliasReturnType_es5.ts ===
|
||||
type PromiseAlias<T> = Promise<T>;
|
||||
>PromiseAlias : Promise<T>
|
||||
>PromiseAlias : PromiseAlias<T>
|
||||
|
||||
async function f(): PromiseAlias<void> {
|
||||
>f : () => Promise<void>
|
||||
>f : () => PromiseAlias<void>
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/async/es6/asyncAliasReturnType_es6.ts ===
|
||||
type PromiseAlias<T> = Promise<T>;
|
||||
>PromiseAlias : Promise<T>
|
||||
>PromiseAlias : PromiseAlias<T>
|
||||
|
||||
async function f(): PromiseAlias<void> {
|
||||
>f : () => Promise<void>
|
||||
>f : () => PromiseAlias<void>
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/async/es2017/asyncAwait_es2017.ts ===
|
||||
type MyPromise<T> = Promise<T>;
|
||||
>MyPromise : Promise<T>
|
||||
>MyPromise : MyPromise<T>
|
||||
|
||||
declare var MyPromise: typeof Promise;
|
||||
>MyPromise : PromiseConstructor
|
||||
@@ -10,7 +10,7 @@ declare var p: Promise<number>;
|
||||
>p : Promise<number>
|
||||
|
||||
declare var mp: MyPromise<number>;
|
||||
>mp : Promise<number>
|
||||
>mp : MyPromise<number>
|
||||
|
||||
async function f0() { }
|
||||
>f0 : () => Promise<void>
|
||||
@@ -19,7 +19,7 @@ async function f1(): Promise<void> { }
|
||||
>f1 : () => Promise<void>
|
||||
|
||||
async function f3(): MyPromise<void> { }
|
||||
>f3 : () => Promise<void>
|
||||
>f3 : () => MyPromise<void>
|
||||
|
||||
let f4 = async function() { }
|
||||
>f4 : () => Promise<void>
|
||||
@@ -30,8 +30,8 @@ let f5 = async function(): Promise<void> { }
|
||||
>async function(): Promise<void> { } : () => Promise<void>
|
||||
|
||||
let f6 = async function(): MyPromise<void> { }
|
||||
>f6 : () => Promise<void>
|
||||
>async function(): MyPromise<void> { } : () => Promise<void>
|
||||
>f6 : () => MyPromise<void>
|
||||
>async function(): MyPromise<void> { } : () => MyPromise<void>
|
||||
|
||||
let f7 = async () => { };
|
||||
>f7 : () => Promise<void>
|
||||
@@ -42,8 +42,8 @@ let f8 = async (): Promise<void> => { };
|
||||
>async (): Promise<void> => { } : () => Promise<void>
|
||||
|
||||
let f9 = async (): MyPromise<void> => { };
|
||||
>f9 : () => Promise<void>
|
||||
>async (): MyPromise<void> => { } : () => Promise<void>
|
||||
>f9 : () => MyPromise<void>
|
||||
>async (): MyPromise<void> => { } : () => MyPromise<void>
|
||||
|
||||
let f10 = async () => p;
|
||||
>f10 : () => Promise<number>
|
||||
@@ -53,21 +53,21 @@ let f10 = async () => p;
|
||||
let f11 = async () => mp;
|
||||
>f11 : () => Promise<number>
|
||||
>async () => mp : () => Promise<number>
|
||||
>mp : Promise<number>
|
||||
>mp : MyPromise<number>
|
||||
|
||||
let f12 = async (): Promise<number> => mp;
|
||||
>f12 : () => Promise<number>
|
||||
>async (): Promise<number> => mp : () => Promise<number>
|
||||
>mp : Promise<number>
|
||||
>mp : MyPromise<number>
|
||||
|
||||
let f13 = async (): MyPromise<number> => p;
|
||||
>f13 : () => Promise<number>
|
||||
>async (): MyPromise<number> => p : () => Promise<number>
|
||||
>f13 : () => MyPromise<number>
|
||||
>async (): MyPromise<number> => p : () => MyPromise<number>
|
||||
>p : Promise<number>
|
||||
|
||||
let o = {
|
||||
>o : { m1(): Promise<void>; m2(): Promise<void>; m3(): Promise<void>; }
|
||||
>{ async m1() { }, async m2(): Promise<void> { }, async m3(): MyPromise<void> { }} : { m1(): Promise<void>; m2(): Promise<void>; m3(): Promise<void>; }
|
||||
>o : { m1(): Promise<void>; m2(): Promise<void>; m3(): MyPromise<void>; }
|
||||
>{ async m1() { }, async m2(): Promise<void> { }, async m3(): MyPromise<void> { }} : { m1(): Promise<void>; m2(): Promise<void>; m3(): MyPromise<void>; }
|
||||
|
||||
async m1() { },
|
||||
>m1 : () => Promise<void>
|
||||
@@ -76,7 +76,7 @@ let o = {
|
||||
>m2 : () => Promise<void>
|
||||
|
||||
async m3(): MyPromise<void> { }
|
||||
>m3 : () => Promise<void>
|
||||
>m3 : () => MyPromise<void>
|
||||
|
||||
};
|
||||
|
||||
@@ -90,7 +90,7 @@ class C {
|
||||
>m2 : () => Promise<void>
|
||||
|
||||
async m3(): MyPromise<void> { }
|
||||
>m3 : () => Promise<void>
|
||||
>m3 : () => MyPromise<void>
|
||||
|
||||
static async m4() { }
|
||||
>m4 : () => Promise<void>
|
||||
@@ -99,7 +99,7 @@ class C {
|
||||
>m5 : () => Promise<void>
|
||||
|
||||
static async m6(): MyPromise<void> { }
|
||||
>m6 : () => Promise<void>
|
||||
>m6 : () => MyPromise<void>
|
||||
}
|
||||
|
||||
module M {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/async/es5/asyncAwait_es5.ts ===
|
||||
type MyPromise<T> = Promise<T>;
|
||||
>MyPromise : Promise<T>
|
||||
>MyPromise : MyPromise<T>
|
||||
|
||||
declare var MyPromise: typeof Promise;
|
||||
>MyPromise : PromiseConstructor
|
||||
@@ -10,7 +10,7 @@ declare var p: Promise<number>;
|
||||
>p : Promise<number>
|
||||
|
||||
declare var mp: MyPromise<number>;
|
||||
>mp : Promise<number>
|
||||
>mp : MyPromise<number>
|
||||
|
||||
async function f0() { }
|
||||
>f0 : () => Promise<void>
|
||||
@@ -19,7 +19,7 @@ async function f1(): Promise<void> { }
|
||||
>f1 : () => Promise<void>
|
||||
|
||||
async function f3(): MyPromise<void> { }
|
||||
>f3 : () => Promise<void>
|
||||
>f3 : () => MyPromise<void>
|
||||
|
||||
let f4 = async function() { }
|
||||
>f4 : () => Promise<void>
|
||||
@@ -30,8 +30,8 @@ let f5 = async function(): Promise<void> { }
|
||||
>async function(): Promise<void> { } : () => Promise<void>
|
||||
|
||||
let f6 = async function(): MyPromise<void> { }
|
||||
>f6 : () => Promise<void>
|
||||
>async function(): MyPromise<void> { } : () => Promise<void>
|
||||
>f6 : () => MyPromise<void>
|
||||
>async function(): MyPromise<void> { } : () => MyPromise<void>
|
||||
|
||||
let f7 = async () => { };
|
||||
>f7 : () => Promise<void>
|
||||
@@ -42,8 +42,8 @@ let f8 = async (): Promise<void> => { };
|
||||
>async (): Promise<void> => { } : () => Promise<void>
|
||||
|
||||
let f9 = async (): MyPromise<void> => { };
|
||||
>f9 : () => Promise<void>
|
||||
>async (): MyPromise<void> => { } : () => Promise<void>
|
||||
>f9 : () => MyPromise<void>
|
||||
>async (): MyPromise<void> => { } : () => MyPromise<void>
|
||||
|
||||
let f10 = async () => p;
|
||||
>f10 : () => Promise<number>
|
||||
@@ -53,21 +53,21 @@ let f10 = async () => p;
|
||||
let f11 = async () => mp;
|
||||
>f11 : () => Promise<number>
|
||||
>async () => mp : () => Promise<number>
|
||||
>mp : Promise<number>
|
||||
>mp : MyPromise<number>
|
||||
|
||||
let f12 = async (): Promise<number> => mp;
|
||||
>f12 : () => Promise<number>
|
||||
>async (): Promise<number> => mp : () => Promise<number>
|
||||
>mp : Promise<number>
|
||||
>mp : MyPromise<number>
|
||||
|
||||
let f13 = async (): MyPromise<number> => p;
|
||||
>f13 : () => Promise<number>
|
||||
>async (): MyPromise<number> => p : () => Promise<number>
|
||||
>f13 : () => MyPromise<number>
|
||||
>async (): MyPromise<number> => p : () => MyPromise<number>
|
||||
>p : Promise<number>
|
||||
|
||||
let o = {
|
||||
>o : { m1(): Promise<void>; m2(): Promise<void>; m3(): Promise<void>; }
|
||||
>{ async m1() { }, async m2(): Promise<void> { }, async m3(): MyPromise<void> { }} : { m1(): Promise<void>; m2(): Promise<void>; m3(): Promise<void>; }
|
||||
>o : { m1(): Promise<void>; m2(): Promise<void>; m3(): MyPromise<void>; }
|
||||
>{ async m1() { }, async m2(): Promise<void> { }, async m3(): MyPromise<void> { }} : { m1(): Promise<void>; m2(): Promise<void>; m3(): MyPromise<void>; }
|
||||
|
||||
async m1() { },
|
||||
>m1 : () => Promise<void>
|
||||
@@ -76,7 +76,7 @@ let o = {
|
||||
>m2 : () => Promise<void>
|
||||
|
||||
async m3(): MyPromise<void> { }
|
||||
>m3 : () => Promise<void>
|
||||
>m3 : () => MyPromise<void>
|
||||
|
||||
};
|
||||
|
||||
@@ -90,7 +90,7 @@ class C {
|
||||
>m2 : () => Promise<void>
|
||||
|
||||
async m3(): MyPromise<void> { }
|
||||
>m3 : () => Promise<void>
|
||||
>m3 : () => MyPromise<void>
|
||||
|
||||
static async m4() { }
|
||||
>m4 : () => Promise<void>
|
||||
@@ -99,7 +99,7 @@ class C {
|
||||
>m5 : () => Promise<void>
|
||||
|
||||
static async m6(): MyPromise<void> { }
|
||||
>m6 : () => Promise<void>
|
||||
>m6 : () => MyPromise<void>
|
||||
}
|
||||
|
||||
module M {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/async/es6/asyncAwait_es6.ts ===
|
||||
type MyPromise<T> = Promise<T>;
|
||||
>MyPromise : Promise<T>
|
||||
>MyPromise : MyPromise<T>
|
||||
|
||||
declare var MyPromise: typeof Promise;
|
||||
>MyPromise : PromiseConstructor
|
||||
@@ -10,7 +10,7 @@ declare var p: Promise<number>;
|
||||
>p : Promise<number>
|
||||
|
||||
declare var mp: MyPromise<number>;
|
||||
>mp : Promise<number>
|
||||
>mp : MyPromise<number>
|
||||
|
||||
async function f0() { }
|
||||
>f0 : () => Promise<void>
|
||||
@@ -19,7 +19,7 @@ async function f1(): Promise<void> { }
|
||||
>f1 : () => Promise<void>
|
||||
|
||||
async function f3(): MyPromise<void> { }
|
||||
>f3 : () => Promise<void>
|
||||
>f3 : () => MyPromise<void>
|
||||
|
||||
let f4 = async function() { }
|
||||
>f4 : () => Promise<void>
|
||||
@@ -30,8 +30,8 @@ let f5 = async function(): Promise<void> { }
|
||||
>async function(): Promise<void> { } : () => Promise<void>
|
||||
|
||||
let f6 = async function(): MyPromise<void> { }
|
||||
>f6 : () => Promise<void>
|
||||
>async function(): MyPromise<void> { } : () => Promise<void>
|
||||
>f6 : () => MyPromise<void>
|
||||
>async function(): MyPromise<void> { } : () => MyPromise<void>
|
||||
|
||||
let f7 = async () => { };
|
||||
>f7 : () => Promise<void>
|
||||
@@ -42,8 +42,8 @@ let f8 = async (): Promise<void> => { };
|
||||
>async (): Promise<void> => { } : () => Promise<void>
|
||||
|
||||
let f9 = async (): MyPromise<void> => { };
|
||||
>f9 : () => Promise<void>
|
||||
>async (): MyPromise<void> => { } : () => Promise<void>
|
||||
>f9 : () => MyPromise<void>
|
||||
>async (): MyPromise<void> => { } : () => MyPromise<void>
|
||||
|
||||
let f10 = async () => p;
|
||||
>f10 : () => Promise<number>
|
||||
@@ -53,21 +53,21 @@ let f10 = async () => p;
|
||||
let f11 = async () => mp;
|
||||
>f11 : () => Promise<number>
|
||||
>async () => mp : () => Promise<number>
|
||||
>mp : Promise<number>
|
||||
>mp : MyPromise<number>
|
||||
|
||||
let f12 = async (): Promise<number> => mp;
|
||||
>f12 : () => Promise<number>
|
||||
>async (): Promise<number> => mp : () => Promise<number>
|
||||
>mp : Promise<number>
|
||||
>mp : MyPromise<number>
|
||||
|
||||
let f13 = async (): MyPromise<number> => p;
|
||||
>f13 : () => Promise<number>
|
||||
>async (): MyPromise<number> => p : () => Promise<number>
|
||||
>f13 : () => MyPromise<number>
|
||||
>async (): MyPromise<number> => p : () => MyPromise<number>
|
||||
>p : Promise<number>
|
||||
|
||||
let o = {
|
||||
>o : { m1(): Promise<void>; m2(): Promise<void>; m3(): Promise<void>; }
|
||||
>{ async m1() { }, async m2(): Promise<void> { }, async m3(): MyPromise<void> { }} : { m1(): Promise<void>; m2(): Promise<void>; m3(): Promise<void>; }
|
||||
>o : { m1(): Promise<void>; m2(): Promise<void>; m3(): MyPromise<void>; }
|
||||
>{ async m1() { }, async m2(): Promise<void> { }, async m3(): MyPromise<void> { }} : { m1(): Promise<void>; m2(): Promise<void>; m3(): MyPromise<void>; }
|
||||
|
||||
async m1() { },
|
||||
>m1 : () => Promise<void>
|
||||
@@ -76,7 +76,7 @@ let o = {
|
||||
>m2 : () => Promise<void>
|
||||
|
||||
async m3(): MyPromise<void> { }
|
||||
>m3 : () => Promise<void>
|
||||
>m3 : () => MyPromise<void>
|
||||
|
||||
};
|
||||
|
||||
@@ -90,7 +90,7 @@ class C {
|
||||
>m2 : () => Promise<void>
|
||||
|
||||
async m3(): MyPromise<void> { }
|
||||
>m3 : () => Promise<void>
|
||||
>m3 : () => MyPromise<void>
|
||||
|
||||
static async m4() { }
|
||||
>m4 : () => Promise<void>
|
||||
@@ -99,7 +99,7 @@ class C {
|
||||
>m5 : () => Promise<void>
|
||||
|
||||
static async m6(): MyPromise<void> { }
|
||||
>m6 : () => Promise<void>
|
||||
>m6 : () => MyPromise<void>
|
||||
}
|
||||
|
||||
module M {
|
||||
|
||||
@@ -31,11 +31,11 @@ class FetchUser extends React.Component<IFetchUserProps, any> {
|
||||
|
||||
? this.props.children(this.state.result)
|
||||
>this.props.children(this.state.result) : JSX.Element
|
||||
>this.props.children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & React.ReactElement<any>) | (((user: IUser) => JSX.Element) & (string | number | boolean | any[] | React.ReactElement<any>)[])
|
||||
>this.props.children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & React.ReactElement<any>) | (((user: IUser) => JSX.Element) & (string | number | boolean | React.ReactElement<any> | any[])[])
|
||||
>this.props : IFetchUserProps & { children?: React.ReactNode; }
|
||||
>this : this
|
||||
>props : IFetchUserProps & { children?: React.ReactNode; }
|
||||
>children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & React.ReactElement<any>) | (((user: IUser) => JSX.Element) & (string | number | boolean | any[] | React.ReactElement<any>)[])
|
||||
>children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & React.ReactElement<any>) | (((user: IUser) => JSX.Element) & (string | number | boolean | React.ReactElement<any> | any[])[])
|
||||
>this.state.result : any
|
||||
>this.state : any
|
||||
>this : this
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/jsx/file.tsx(24,28): error TS2551: Property 'NAme' does not exist on type 'IUser'. Did you mean 'Name'?
|
||||
tests/cases/conformance/jsx/file.tsx(36,15): error TS2322: Type '(user: IUser) => Element' is not assignable to type 'string | number | boolean | any[] | ReactElement<any>'.
|
||||
Type '(user: IUser) => Element' is missing the following properties from type 'ReactElement<any>': type, props
|
||||
tests/cases/conformance/jsx/file.tsx(39,15): error TS2322: Type '(user: IUser) => Element' is not assignable to type 'string | number | boolean | any[] | ReactElement<any>'.
|
||||
Type '(user: IUser) => Element' is missing the following properties from type 'ReactElement<any>': type, props
|
||||
tests/cases/conformance/jsx/file.tsx(36,15): error TS2322: Type '(user: IUser) => Element' is not assignable to type 'string | number | boolean | ReactElement<any> | any[]'.
|
||||
Type '(user: IUser) => Element' is missing the following properties from type 'any[]': push, pop, concat, join, and 15 more.
|
||||
tests/cases/conformance/jsx/file.tsx(39,15): error TS2322: Type '(user: IUser) => Element' is not assignable to type 'string | number | boolean | ReactElement<any> | any[]'.
|
||||
Type '(user: IUser) => Element' is missing the following properties from type 'any[]': push, pop, concat, join, and 15 more.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (3 errors) ====
|
||||
@@ -50,8 +50,8 @@ tests/cases/conformance/jsx/file.tsx(39,15): error TS2322: Type '(user: IUser) =
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
) }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '(user: IUser) => Element' is not assignable to type 'string | number | boolean | any[] | ReactElement<any>'.
|
||||
!!! error TS2322: Type '(user: IUser) => Element' is missing the following properties from type 'ReactElement<any>': type, props
|
||||
!!! error TS2322: Type '(user: IUser) => Element' is not assignable to type 'string | number | boolean | ReactElement<any> | any[]'.
|
||||
!!! error TS2322: Type '(user: IUser) => Element' is missing the following properties from type 'any[]': push, pop, concat, join, and 15 more.
|
||||
!!! related TS6212 tests/cases/conformance/jsx/file.tsx:36:15: Did you mean to call this expression?
|
||||
{ user => (
|
||||
~~~~~~~~~
|
||||
@@ -59,8 +59,8 @@ tests/cases/conformance/jsx/file.tsx(39,15): error TS2322: Type '(user: IUser) =
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
) }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '(user: IUser) => Element' is not assignable to type 'string | number | boolean | any[] | ReactElement<any>'.
|
||||
!!! error TS2322: Type '(user: IUser) => Element' is missing the following properties from type 'ReactElement<any>': type, props
|
||||
!!! error TS2322: Type '(user: IUser) => Element' is not assignable to type 'string | number | boolean | ReactElement<any> | any[]'.
|
||||
!!! error TS2322: Type '(user: IUser) => Element' is missing the following properties from type 'any[]': push, pop, concat, join, and 15 more.
|
||||
!!! related TS6212 tests/cases/conformance/jsx/file.tsx:39:15: Did you mean to call this expression?
|
||||
</FetchUser>
|
||||
);
|
||||
|
||||
@@ -31,11 +31,11 @@ class FetchUser extends React.Component<IFetchUserProps, any> {
|
||||
|
||||
? this.props.children(this.state.result)
|
||||
>this.props.children(this.state.result) : JSX.Element
|
||||
>this.props.children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & React.ReactElement<any>) | (((user: IUser) => JSX.Element) & (string | number | boolean | any[] | React.ReactElement<any>)[])
|
||||
>this.props.children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & React.ReactElement<any>) | (((user: IUser) => JSX.Element) & (string | number | boolean | React.ReactElement<any> | any[])[])
|
||||
>this.props : IFetchUserProps & { children?: React.ReactNode; }
|
||||
>this : this
|
||||
>props : IFetchUserProps & { children?: React.ReactNode; }
|
||||
>children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & React.ReactElement<any>) | (((user: IUser) => JSX.Element) & (string | number | boolean | any[] | React.ReactElement<any>)[])
|
||||
>children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & React.ReactElement<any>) | (((user: IUser) => JSX.Element) & (string | number | boolean | React.ReactElement<any> | any[])[])
|
||||
>this.state.result : any
|
||||
>this.state : any
|
||||
>this : this
|
||||
|
||||
@@ -12,10 +12,10 @@ interface FormikConfig<Values> {
|
||||
}
|
||||
|
||||
declare function Func<Values = object, ExtraProps = {}>(
|
||||
>Func : <Values = object, ExtraProps = {}>(x: string extends "validate" | "initialValues" | keyof ExtraProps ? Readonly<FormikConfig<Values> & ExtraProps> : Pick<Readonly<FormikConfig<Values> & ExtraProps>, "validate" | "initialValues" | Exclude<keyof ExtraProps, "validateOnChange">> & Partial<Pick<Readonly<FormikConfig<Values> & ExtraProps>, "validateOnChange" | Extract<keyof ExtraProps, "validateOnChange">>>) => void
|
||||
>Func : <Values = object, ExtraProps = {}>(x: string extends keyof ExtraProps | "validate" | "initialValues" ? Readonly<FormikConfig<Values> & ExtraProps> : Pick<Readonly<FormikConfig<Values> & ExtraProps>, Exclude<keyof ExtraProps, "validateOnChange"> | "validate" | "initialValues"> & Partial<Pick<Readonly<FormikConfig<Values> & ExtraProps>, "validateOnChange" | Extract<keyof ExtraProps, "validateOnChange">>>) => void
|
||||
|
||||
x: (string extends "validate" | "initialValues" | keyof ExtraProps
|
||||
>x : string extends "validate" | "initialValues" | keyof ExtraProps ? Readonly<FormikConfig<Values> & ExtraProps> : Pick<Readonly<FormikConfig<Values> & ExtraProps>, "validate" | "initialValues" | Exclude<keyof ExtraProps, "validateOnChange">> & Partial<Pick<Readonly<FormikConfig<Values> & ExtraProps>, "validateOnChange" | Extract<keyof ExtraProps, "validateOnChange">>>
|
||||
>x : string extends keyof ExtraProps | "validate" | "initialValues" ? Readonly<FormikConfig<Values> & ExtraProps> : Pick<Readonly<FormikConfig<Values> & ExtraProps>, Exclude<keyof ExtraProps, "validateOnChange"> | "validate" | "initialValues"> & Partial<Pick<Readonly<FormikConfig<Values> & ExtraProps>, "validateOnChange" | Extract<keyof ExtraProps, "validateOnChange">>>
|
||||
|
||||
? Readonly<FormikConfig<Values> & ExtraProps>
|
||||
: Pick<Readonly<FormikConfig<Values> & ExtraProps>, "validate" | "initialValues" | Exclude<keyof ExtraProps, "validateOnChange">>
|
||||
@@ -24,7 +24,7 @@ declare function Func<Values = object, ExtraProps = {}>(
|
||||
|
||||
Func({
|
||||
>Func({ initialValues: { foo: "" }, validate: props => { props.foo; }}) : void
|
||||
>Func : <Values = object, ExtraProps = {}>(x: string extends "validate" | "initialValues" | keyof ExtraProps ? Readonly<FormikConfig<Values> & ExtraProps> : Pick<Readonly<FormikConfig<Values> & ExtraProps>, "validate" | "initialValues" | Exclude<keyof ExtraProps, "validateOnChange">> & Partial<Pick<Readonly<FormikConfig<Values> & ExtraProps>, "validateOnChange" | Extract<keyof ExtraProps, "validateOnChange">>>) => void
|
||||
>Func : <Values = object, ExtraProps = {}>(x: string extends keyof ExtraProps | "validate" | "initialValues" ? Readonly<FormikConfig<Values> & ExtraProps> : Pick<Readonly<FormikConfig<Values> & ExtraProps>, Exclude<keyof ExtraProps, "validateOnChange"> | "validate" | "initialValues"> & Partial<Pick<Readonly<FormikConfig<Values> & ExtraProps>, "validateOnChange" | Extract<keyof ExtraProps, "validateOnChange">>>) => void
|
||||
>{ initialValues: { foo: "" }, validate: props => { props.foo; }} : { initialValues: { foo: string; }; validate: (props: { foo: string; }) => void; }
|
||||
|
||||
initialValues: {
|
||||
|
||||
@@ -494,7 +494,7 @@ function f21<T extends number | string>(x: T, y: ZeroOf<T>) {
|
||||
}
|
||||
|
||||
type T35<T extends { a: string, b: number }> = T[];
|
||||
>T35 : T[]
|
||||
>T35 : T35<T>
|
||||
>a : string
|
||||
>b : number
|
||||
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ interface Map<K, V> {
|
||||
}
|
||||
|
||||
export type ImmutableTypes = IImmutableMap<any>;
|
||||
>ImmutableTypes : IImmutableMap<any>
|
||||
>ImmutableTypes : ImmutableTypes
|
||||
|
||||
export type ImmutableModel<T> = { [K in keyof T]: T[K] extends ImmutableTypes ? T[K] : never };
|
||||
>ImmutableModel : ImmutableModel<T>
|
||||
@@ -19,7 +19,7 @@ export interface IImmutableMap<T extends ImmutableModel<T>> extends Map<string,
|
||||
}
|
||||
|
||||
export type ImmutableTypes2 = IImmutableMap2<any>;
|
||||
>ImmutableTypes2 : IImmutableMap2<any>
|
||||
>ImmutableTypes2 : ImmutableTypes2
|
||||
|
||||
type isImmutableType<T> = [T] extends [ImmutableTypes2] ? T : never;
|
||||
>isImmutableType : isImmutableType<T>
|
||||
|
||||
@@ -124,17 +124,17 @@ app2({
|
||||
|
||||
|
||||
type ActionsArray<State> = ((state: State) => State)[];
|
||||
>ActionsArray : ((state: State) => State)[]
|
||||
>ActionsArray : ActionsArray<State>
|
||||
>state : State
|
||||
|
||||
declare function app3<State, Actions extends ActionsArray<State>>(obj: Options<State, Actions>): void;
|
||||
>app3 : <State, Actions extends ((state: State) => State)[]>(obj: Options<State, Actions>) => void
|
||||
>app3 : <State, Actions extends ActionsArray<State>>(obj: Options<State, Actions>) => void
|
||||
>obj : Options<State, Actions>
|
||||
|
||||
app3({
|
||||
>app3({ state: 100, actions: [ s => s // Should be typed number => number ], view: (s, a) => undefined as any,}) : void
|
||||
>app3 : <State, Actions extends ((state: State) => State)[]>(obj: Options<State, Actions>) => void
|
||||
>{ state: 100, actions: [ s => s // Should be typed number => number ], view: (s, a) => undefined as any,} : { state: number; actions: ((s: number) => number)[]; view: (s: number, a: ((state: number) => number)[]) => any; }
|
||||
>app3 : <State, Actions extends ActionsArray<State>>(obj: Options<State, Actions>) => void
|
||||
>{ state: 100, actions: [ s => s // Should be typed number => number ], view: (s, a) => undefined as any,} : { state: number; actions: ((s: number) => number)[]; view: (s: number, a: ActionsArray<number>) => any; }
|
||||
|
||||
state: 100,
|
||||
>state : number
|
||||
@@ -151,10 +151,10 @@ app3({
|
||||
|
||||
],
|
||||
view: (s, a) => undefined as any,
|
||||
>view : (s: number, a: ((state: number) => number)[]) => any
|
||||
>(s, a) => undefined as any : (s: number, a: ((state: number) => number)[]) => any
|
||||
>view : (s: number, a: ActionsArray<number>) => any
|
||||
>(s, a) => undefined as any : (s: number, a: ActionsArray<number>) => any
|
||||
>s : number
|
||||
>a : ((state: number) => number)[]
|
||||
>a : ActionsArray<number>
|
||||
>undefined as any : any
|
||||
>undefined : undefined
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class C1 {
|
||||
}
|
||||
|
||||
type TupleType1 =[string, number, boolean];
|
||||
>TupleType1 : [string, number, boolean]
|
||||
>TupleType1 : TupleType1
|
||||
|
||||
class C2 {
|
||||
>C2 : C2
|
||||
|
||||
@@ -61,6 +61,6 @@ declare type StringHash = Hash<string>;
|
||||
interface StringHash2 extends Hash<string> {
|
||||
}
|
||||
//// [a.d.ts]
|
||||
import { StringHash2 } from "./b";
|
||||
import { StringHash, StringHash2 } from "./b";
|
||||
export { doSome };
|
||||
declare function doSome(arg1: string, arg2?: import("./b").Hash<string>, arg3?: StringHash2): void;
|
||||
declare function doSome(arg1: string, arg2?: StringHash, arg3?: StringHash2): void;
|
||||
|
||||
@@ -15,7 +15,7 @@ interface Hash<T> {
|
||||
}
|
||||
|
||||
type StringHash = Hash<string>;
|
||||
>StringHash : Hash<string>
|
||||
>StringHash : StringHash
|
||||
|
||||
interface StringHash2 extends Hash<string> {}
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
@@ -25,11 +25,11 @@ import {StringHash, StringHash2} from "./b";
|
||||
|
||||
export {
|
||||
doSome
|
||||
>doSome : (arg1: string, arg2?: import("tests/cases/compiler/b").Hash<string>, arg3?: StringHash2) => void
|
||||
>doSome : (arg1: string, arg2?: StringHash, arg3?: StringHash2) => void
|
||||
}
|
||||
|
||||
const MAP: StringHash = {
|
||||
>MAP : import("tests/cases/compiler/b").Hash<string>
|
||||
>MAP : StringHash
|
||||
>{ a: "a"} : { a: string; }
|
||||
|
||||
a: "a"
|
||||
@@ -49,12 +49,12 @@ const MAP2: StringHash2 = {
|
||||
};
|
||||
|
||||
function doSome(arg1: string,
|
||||
>doSome : (arg1: string, arg2?: import("tests/cases/compiler/b").Hash<string>, arg3?: StringHash2) => void
|
||||
>doSome : (arg1: string, arg2?: StringHash, arg3?: StringHash2) => void
|
||||
>arg1 : string
|
||||
|
||||
arg2 = MAP,
|
||||
>arg2 : import("tests/cases/compiler/b").Hash<string>
|
||||
>MAP : import("tests/cases/compiler/b").Hash<string>
|
||||
>arg2 : StringHash
|
||||
>MAP : StringHash
|
||||
|
||||
arg3 = MAP2) {
|
||||
>arg3 : StringHash2
|
||||
|
||||
@@ -161,7 +161,7 @@ function f4() {
|
||||
// Repro from #31770
|
||||
|
||||
type KeyValue = [string, string?];
|
||||
>KeyValue : [string, (string | undefined)?]
|
||||
>KeyValue : KeyValue
|
||||
|
||||
let [key, value]: KeyValue = ["foo"];
|
||||
>key : string
|
||||
|
||||
@@ -9,7 +9,7 @@ interface c { c }
|
||||
>c : any
|
||||
|
||||
type T1 = ([a, b, c]);
|
||||
>T1 : [a, b, c]
|
||||
>T1 : T1
|
||||
|
||||
type F1 = ([a, b, c]) => void;
|
||||
>F1 : F1
|
||||
@@ -26,7 +26,7 @@ type F2 = ({ a }) => void;
|
||||
>a : any
|
||||
|
||||
type T3 = ([{ a: b }, { b: a }]);
|
||||
>T3 : [{ a: b; }, { b: a; }]
|
||||
>T3 : T3
|
||||
>a : b
|
||||
>b : a
|
||||
|
||||
@@ -38,7 +38,7 @@ type F3 = ([{ a: b }, { b: a }]) => void;
|
||||
>a : any
|
||||
|
||||
type T4 = ([{ a: [b, c] }]);
|
||||
>T4 : [{ a: [b, c]; }]
|
||||
>T4 : T4
|
||||
>a : [b, c]
|
||||
|
||||
type F4 = ([{ a: [b, c] }]) => void;
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
// ... Identifier TypeAnnotation(opt)
|
||||
|
||||
type arrayString = Array<String>
|
||||
>arrayString : String[]
|
||||
>arrayString : arrayString
|
||||
|
||||
type someArray = Array<String> | number[];
|
||||
>someArray : someArray
|
||||
|
||||
type stringOrNumArray = Array<String|Number>;
|
||||
>stringOrNumArray : (String | Number)[]
|
||||
>stringOrNumArray : stringOrNumArray
|
||||
|
||||
function a1(...x: (number|string)[]) { }
|
||||
>a1 : (...x: (string | number)[]) => void
|
||||
@@ -27,12 +27,12 @@ function a3(...a: Array<String>) { }
|
||||
>a : String[]
|
||||
|
||||
function a4(...a: arrayString) { }
|
||||
>a4 : (...a: String[]) => void
|
||||
>a : String[]
|
||||
>a4 : (...a: arrayString) => void
|
||||
>a : arrayString
|
||||
|
||||
function a5(...a: stringOrNumArray) { }
|
||||
>a5 : (...a: (String | Number)[]) => void
|
||||
>a : (String | Number)[]
|
||||
>a5 : (...a: stringOrNumArray) => void
|
||||
>a : stringOrNumArray
|
||||
|
||||
function a9([a, b, [[c]]]) { }
|
||||
>a9 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
// ... Identifier TypeAnnotation(opt)
|
||||
|
||||
type arrayString = Array<String>
|
||||
>arrayString : String[]
|
||||
>arrayString : arrayString
|
||||
|
||||
type someArray = Array<String> | number[];
|
||||
>someArray : someArray
|
||||
|
||||
type stringOrNumArray = Array<String|Number>;
|
||||
>stringOrNumArray : (String | Number)[]
|
||||
>stringOrNumArray : stringOrNumArray
|
||||
|
||||
function a1(...x: (number|string)[]) { }
|
||||
>a1 : (...x: (string | number)[]) => void
|
||||
@@ -27,12 +27,12 @@ function a3(...a: Array<String>) { }
|
||||
>a : String[]
|
||||
|
||||
function a4(...a: arrayString) { }
|
||||
>a4 : (...a: String[]) => void
|
||||
>a : String[]
|
||||
>a4 : (...a: arrayString) => void
|
||||
>a : arrayString
|
||||
|
||||
function a5(...a: stringOrNumArray) { }
|
||||
>a5 : (...a: (String | Number)[]) => void
|
||||
>a : (String | Number)[]
|
||||
>a5 : (...a: stringOrNumArray) => void
|
||||
>a : stringOrNumArray
|
||||
|
||||
function a9([a, b, [[c]]]) { }
|
||||
>a9 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
// ... Identifier TypeAnnotation(opt)
|
||||
|
||||
type arrayString = Array<String>
|
||||
>arrayString : String[]
|
||||
>arrayString : arrayString
|
||||
|
||||
type someArray = Array<String> | number[];
|
||||
>someArray : someArray
|
||||
|
||||
type stringOrNumArray = Array<String|Number>;
|
||||
>stringOrNumArray : (String | Number)[]
|
||||
>stringOrNumArray : stringOrNumArray
|
||||
|
||||
function a1(...x: (number|string)[]) { }
|
||||
>a1 : (...x: (string | number)[]) => void
|
||||
@@ -27,12 +27,12 @@ function a3(...a: Array<String>) { }
|
||||
>a : String[]
|
||||
|
||||
function a4(...a: arrayString) { }
|
||||
>a4 : (...a: String[]) => void
|
||||
>a : String[]
|
||||
>a4 : (...a: arrayString) => void
|
||||
>a : arrayString
|
||||
|
||||
function a5(...a: stringOrNumArray) { }
|
||||
>a5 : (...a: (String | Number)[]) => void
|
||||
>a : (String | Number)[]
|
||||
>a5 : (...a: stringOrNumArray) => void
|
||||
>a : stringOrNumArray
|
||||
|
||||
function a9([a, b, [[c]]]) { }
|
||||
>a9 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
// ... Identifier TypeAnnotation(opt)
|
||||
|
||||
type arrayString = Array<String>
|
||||
>arrayString : String[]
|
||||
>arrayString : arrayString
|
||||
|
||||
type someArray = Array<String> | number[];
|
||||
>someArray : someArray
|
||||
|
||||
type stringOrNumArray = Array<String|Number>;
|
||||
>stringOrNumArray : (String | Number)[]
|
||||
>stringOrNumArray : stringOrNumArray
|
||||
|
||||
function a0(...x: [number, number, string]) { } // Error, rest parameter must be array type
|
||||
>a0 : (x_0: number, x_1: number, x_2: string) => void
|
||||
|
||||
@@ -10,7 +10,7 @@ class C1 {
|
||||
}
|
||||
|
||||
type TupleType1 = [string, number, boolean];
|
||||
>TupleType1 : [string, number, boolean]
|
||||
>TupleType1 : TupleType1
|
||||
|
||||
class C2 {
|
||||
>C2 : C2
|
||||
|
||||
@@ -6,7 +6,7 @@ type ObjType1 = { x: number; y: string; z: boolean }
|
||||
>z : boolean
|
||||
|
||||
type TupleType1 = [ObjType1, number, string]
|
||||
>TupleType1 : [ObjType1, number, string]
|
||||
>TupleType1 : TupleType1
|
||||
|
||||
class C1 {
|
||||
>C1 : C1
|
||||
|
||||
@@ -2,20 +2,12 @@ tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(5,6): error TS2456: Type alias 'T0_1' circularly references itself.
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(6,6): error TS2456: Type alias 'T0_2' circularly references itself.
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(7,6): error TS2456: Type alias 'T0_3' circularly references itself.
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(11,6): error TS2456: Type alias 'T1' circularly references itself.
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(14,6): error TS2456: Type alias 'T2' circularly references itself.
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(16,6): error TS2456: Type alias 'T2_1' circularly references itself.
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(19,6): error TS2456: Type alias 'T3' circularly references itself.
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(22,6): error TS2456: Type alias 'T4' circularly references itself.
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(25,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(26,6): error TS2456: Type alias 'T5' circularly references itself.
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(29,6): error TS2456: Type alias 'T6' circularly references itself.
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(30,6): error TS2456: Type alias 'T7' circularly references itself.
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(31,5): error TS2502: 'yy' is referenced directly or indirectly in its own type annotation.
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(32,6): error TS2456: Type alias 'T8' circularly references itself.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts (15 errors) ====
|
||||
==== tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts (7 errors) ====
|
||||
// It is an error for the type specified in a type alias to depend on that type alias
|
||||
|
||||
// A type alias directly depends on the type it aliases.
|
||||
@@ -35,8 +27,6 @@ tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(
|
||||
// A type reference directly depends on the referenced type and each of the type arguments, if any.
|
||||
interface I<T> {}
|
||||
type T1 = I<T1>
|
||||
~~
|
||||
!!! error TS2456: Type alias 'T1' circularly references itself.
|
||||
|
||||
// A union type directly depends on each of the constituent types.
|
||||
type T2 = T2 | string
|
||||
@@ -44,18 +34,12 @@ tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(
|
||||
!!! error TS2456: Type alias 'T2' circularly references itself.
|
||||
class C<T> {}
|
||||
type T2_1 = T2_1[] | number
|
||||
~~~~
|
||||
!!! error TS2456: Type alias 'T2_1' circularly references itself.
|
||||
|
||||
// An array type directly depends on its element type.
|
||||
type T3 = T3[]
|
||||
~~
|
||||
!!! error TS2456: Type alias 'T3' circularly references itself.
|
||||
|
||||
// A tuple type directly depends on each of its element types.
|
||||
type T4 = [number, T4]
|
||||
~~
|
||||
!!! error TS2456: Type alias 'T4' circularly references itself.
|
||||
|
||||
// A type query directly depends on the type of the referenced entity.
|
||||
var x: T5[] = []
|
||||
@@ -67,17 +51,9 @@ tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(
|
||||
|
||||
class C1<T> {}
|
||||
type T6 = T7 | number
|
||||
~~
|
||||
!!! error TS2456: Type alias 'T6' circularly references itself.
|
||||
type T7 = typeof yy
|
||||
~~
|
||||
!!! error TS2456: Type alias 'T7' circularly references itself.
|
||||
var yy: [string, T8[]];
|
||||
~~
|
||||
!!! error TS2502: 'yy' is referenced directly or indirectly in its own type annotation.
|
||||
type T8 = C<T6>
|
||||
~~
|
||||
!!! error TS2456: Type alias 'T8' circularly references itself.
|
||||
|
||||
// legal cases
|
||||
type T9 = () => T9
|
||||
|
||||
@@ -17,7 +17,7 @@ type T0_3 = T0_1
|
||||
// A type reference directly depends on the referenced type and each of the type arguments, if any.
|
||||
interface I<T> {}
|
||||
type T1 = I<T1>
|
||||
>T1 : any
|
||||
>T1 : T1
|
||||
|
||||
// A union type directly depends on each of the constituent types.
|
||||
type T2 = T2 | string
|
||||
@@ -27,15 +27,15 @@ class C<T> {}
|
||||
>C : C<T>
|
||||
|
||||
type T2_1 = T2_1[] | number
|
||||
>T2_1 : any
|
||||
>T2_1 : T2_1
|
||||
|
||||
// An array type directly depends on its element type.
|
||||
type T3 = T3[]
|
||||
>T3 : any
|
||||
>T3 : T3
|
||||
|
||||
// A tuple type directly depends on each of its element types.
|
||||
type T4 = [number, T4]
|
||||
>T4 : any
|
||||
>T4 : T4
|
||||
|
||||
// A type query directly depends on the type of the referenced entity.
|
||||
var x: T5[] = []
|
||||
@@ -50,17 +50,17 @@ class C1<T> {}
|
||||
>C1 : C1<T>
|
||||
|
||||
type T6 = T7 | number
|
||||
>T6 : any
|
||||
>T6 : T6
|
||||
|
||||
type T7 = typeof yy
|
||||
>T7 : any
|
||||
>yy : any
|
||||
>T7 : [string, T8[]]
|
||||
>yy : [string, T8[]]
|
||||
|
||||
var yy: [string, T8[]];
|
||||
>yy : any
|
||||
>yy : [string, T8[]]
|
||||
|
||||
type T8 = C<T6>
|
||||
>T8 : any
|
||||
>T8 : T8
|
||||
|
||||
// legal cases
|
||||
type T9 = () => T9
|
||||
@@ -72,17 +72,17 @@ type T10 = { x: T10 } | { new(v: T10): string }
|
||||
>v : T10
|
||||
|
||||
type T11 = T12[]
|
||||
>T11 : [{ x: [any, string][]; }, string][]
|
||||
>T11 : T11
|
||||
|
||||
type T12 = [T13, string]
|
||||
>T12 : [{ x: [any, string][]; }, string]
|
||||
>T12 : T12
|
||||
|
||||
type T13 = typeof zz
|
||||
>T13 : { x: [any, string][]; }
|
||||
>zz : { x: [any, string][]; }
|
||||
>T13 : { x: T11; }
|
||||
>zz : { x: T11; }
|
||||
|
||||
var zz: { x: T11 }
|
||||
>zz : { x: [any, string][]; }
|
||||
>x : [{ x: [any, string][]; }, string][]
|
||||
>zz : { x: T11; }
|
||||
>x : T11
|
||||
|
||||
|
||||
|
||||
@@ -70,10 +70,10 @@ type i09t01 = i09<1>; // error
|
||||
>i09t01 : any
|
||||
|
||||
type i09t02 = i09<1, 2>; // ok
|
||||
>i09t02 : i09<1, 2, number>
|
||||
>i09t02 : i09t02
|
||||
|
||||
type i09t03 = i09<1, 2, 3>; // ok
|
||||
>i09t03 : i09<1, 2, 3>
|
||||
>i09t03 : i09t03
|
||||
|
||||
type i09t04 = i09<1, 2, 3, 4>; // error
|
||||
>i09t04 : any
|
||||
|
||||
@@ -143,7 +143,7 @@ interface AB<A, B> {
|
||||
}
|
||||
|
||||
type Pair<T> = AB<T, T>;
|
||||
>Pair : AB<T, T>
|
||||
>Pair : Pair<T>
|
||||
|
||||
interface TaggedPair<T> extends Pair<T> {
|
||||
tag: string;
|
||||
|
||||
@@ -14,7 +14,7 @@ class B {
|
||||
}
|
||||
|
||||
type X<T extends A> = [T["a"], (T | B)["a"]];
|
||||
>X : [T["a"], (B | T)["a"]]
|
||||
>X : X<T>
|
||||
|
||||
type Y<T extends A | B> = T["a"];
|
||||
>Y : T["a"]
|
||||
|
||||
@@ -269,19 +269,19 @@ type T78<T> = T extends T76<infer X, infer X> ? T76<X, X> : never;
|
||||
>T78 : T78<T>
|
||||
|
||||
type Foo<T extends string, U extends T> = [T, U];
|
||||
>Foo : [T, U]
|
||||
>Foo : Foo<T, U>
|
||||
|
||||
type Bar<T> = T extends Foo<infer X, infer Y> ? Foo<X, Y> : never;
|
||||
>Bar : Bar<T>
|
||||
|
||||
type T90 = Bar<[string, string]>; // [string, string]
|
||||
>T90 : [string, string]
|
||||
>T90 : Foo<string, string>
|
||||
|
||||
type T91 = Bar<[string, "a"]>; // [string, "a"]
|
||||
>T91 : [string, "a"]
|
||||
>T91 : Foo<string, "a">
|
||||
|
||||
type T92 = Bar<[string, "a"] & { x: string }>; // [string, "a"]
|
||||
>T92 : [string, "a"]
|
||||
>T92 : Foo<string, "a">
|
||||
>x : string
|
||||
|
||||
type T93 = Bar<["a", string]>; // never
|
||||
@@ -371,13 +371,13 @@ const z2: string = ex.obj.nested.attr;
|
||||
// Repros from #21631
|
||||
|
||||
type A1<T, U extends A1<any, any>> = [T, U];
|
||||
>A1 : [T, U]
|
||||
>A1 : A1<T, U>
|
||||
|
||||
type B1<S> = S extends A1<infer T, infer U> ? [T, U] : never;
|
||||
>B1 : B1<S>
|
||||
|
||||
type A2<T, U extends void> = [T, U];
|
||||
>A2 : [T, U]
|
||||
>A2 : A2<T, U>
|
||||
|
||||
type B2<S> = S extends A2<infer T, infer U> ? [T, U] : never;
|
||||
>B2 : B2<S>
|
||||
|
||||
@@ -15,10 +15,10 @@ type T4 = new () => { a: number };
|
||||
>a : number
|
||||
|
||||
type T5 = number[];
|
||||
>T5 : number[]
|
||||
>T5 : T5
|
||||
|
||||
type T6 = [string, number];
|
||||
>T6 : [string, number]
|
||||
>T6 : T6
|
||||
|
||||
type T7 = { [P in 'a' | 'b' | 'c']: string };
|
||||
>T7 : T7
|
||||
|
||||
@@ -8,10 +8,10 @@ type T2 = T1 & { b: number };
|
||||
>b : number
|
||||
|
||||
type T3 = number[];
|
||||
>T3 : number[]
|
||||
>T3 : T3
|
||||
|
||||
type T4 = [string, number];
|
||||
>T4 : [string, number]
|
||||
>T4 : T4
|
||||
|
||||
type T5 = { [P in 'a' | 'b' | 'c']: string };
|
||||
>T5 : T5
|
||||
|
||||
@@ -12,7 +12,7 @@ type B =
|
||||
>bar : number
|
||||
|
||||
type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }];
|
||||
>C : [{ foo: 1; } & { bar: 2; }, { foo: 3; } & { bar: 4; }]
|
||||
>C : C
|
||||
>foo : 1
|
||||
>bar : 2
|
||||
>foo : 3
|
||||
|
||||
+2
-2
@@ -5,12 +5,12 @@ import * as React from 'react'
|
||||
>React : typeof React
|
||||
|
||||
type Tab = [string, React.ReactNode] // [tabName, tabContent]
|
||||
>Tab : [string, React.ReactNode]
|
||||
>Tab : Tab
|
||||
>React : any
|
||||
|
||||
interface Props {
|
||||
children: Tab[]
|
||||
>children : [string, React.ReactNode][]
|
||||
>children : Tab[]
|
||||
}
|
||||
|
||||
function TabLayout(props: Props) {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
=== tests/cases/compiler/mapOnTupleTypes02.ts ===
|
||||
export type Point = [number, number];
|
||||
>Point : [number, number]
|
||||
>Point : Point
|
||||
|
||||
export function increment(point: Point) {
|
||||
>increment : (point: [number, number]) => number[]
|
||||
>point : [number, number]
|
||||
>increment : (point: Point) => number[]
|
||||
>point : Point
|
||||
|
||||
return point.map(d => d + 1);
|
||||
>point.map(d => d + 1) : number[]
|
||||
>point.map : <U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]
|
||||
>point : [number, number]
|
||||
>point : Point
|
||||
>map : <U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]
|
||||
>d => d + 1 : (d: number) => number
|
||||
>d : number
|
||||
|
||||
@@ -66,7 +66,7 @@ type B = { b: string };
|
||||
>b : string
|
||||
|
||||
type T40 = Boxified<A | A[] | ReadonlyArray<A> | [A, B] | string | string[]>;
|
||||
>T40 : string | Box<string>[] | Boxified<A> | Box<A>[] | readonly Box<A>[] | [Box<A>, Box<B>]
|
||||
>T40 : string | Box<string>[] | Boxified<A> | readonly Box<A>[] | Box<A>[] | [Box<A>, Box<B>]
|
||||
|
||||
type ReadWrite<T> = { -readonly [P in keyof T] : T[P] };
|
||||
>ReadWrite : ReadWrite<T>
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(11,29): error TS1257: A required element cannot follow an optional element.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(15,5): error TS2322: Type '[number, string, (boolean | undefined)?]' is not assignable to type '[number, string, boolean]'.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(15,5): error TS2322: Type 'T2' is not assignable to type 'T1'.
|
||||
Types of property '2' are incompatible.
|
||||
Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(16,5): error TS2322: Type '[number, (string | undefined)?, (boolean | undefined)?]' is not assignable to type '[number, string, boolean]'.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(16,5): error TS2322: Type 'T3' is not assignable to type 'T1'.
|
||||
Types of property '1' are incompatible.
|
||||
Type 'string | undefined' is not assignable to type 'string'.
|
||||
Type 'undefined' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(17,5): error TS2322: Type '[(number | undefined)?, (string | undefined)?, (boolean | undefined)?]' is not assignable to type '[number, string, boolean]'.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(17,5): error TS2322: Type 'T4' is not assignable to type 'T1'.
|
||||
Types of property '0' are incompatible.
|
||||
Type 'number | undefined' is not assignable to type 'number'.
|
||||
Type 'undefined' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(20,5): error TS2322: Type '[number, (string | undefined)?, (boolean | undefined)?]' is not assignable to type '[number, string, (boolean | undefined)?]'.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(20,5): error TS2322: Type 'T3' is not assignable to type 'T2'.
|
||||
Types of property '1' are incompatible.
|
||||
Type 'string | undefined' is not assignable to type 'string'.
|
||||
Type 'undefined' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(21,5): error TS2322: Type '[(number | undefined)?, (string | undefined)?, (boolean | undefined)?]' is not assignable to type '[number, string, (boolean | undefined)?]'.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(21,5): error TS2322: Type 'T4' is not assignable to type 'T2'.
|
||||
Types of property '0' are incompatible.
|
||||
Type 'number | undefined' is not assignable to type 'number'.
|
||||
Type 'undefined' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(25,5): error TS2322: Type '[(number | undefined)?, (string | undefined)?, (boolean | undefined)?]' is not assignable to type '[number, (string | undefined)?, (boolean | undefined)?]'.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(25,5): error TS2322: Type 'T4' is not assignable to type 'T3'.
|
||||
Types of property '0' are incompatible.
|
||||
Type 'number | undefined' is not assignable to type 'number'.
|
||||
Type 'undefined' is not assignable to type 'number'.
|
||||
@@ -44,19 +44,19 @@ tests/cases/conformance/types/tuple/optionalTupleElements1.ts(25,5): error TS232
|
||||
t1 = t1;
|
||||
t1 = t2; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '[number, string, (boolean | undefined)?]' is not assignable to type '[number, string, boolean]'.
|
||||
!!! error TS2322: Type 'T2' is not assignable to type 'T1'.
|
||||
!!! error TS2322: Types of property '2' are incompatible.
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
t1 = t3; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '[number, (string | undefined)?, (boolean | undefined)?]' is not assignable to type '[number, string, boolean]'.
|
||||
!!! error TS2322: Type 'T3' is not assignable to type 'T1'.
|
||||
!!! error TS2322: Types of property '1' are incompatible.
|
||||
!!! error TS2322: Type 'string | undefined' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'.
|
||||
t1 = t4; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '[(number | undefined)?, (string | undefined)?, (boolean | undefined)?]' is not assignable to type '[number, string, boolean]'.
|
||||
!!! error TS2322: Type 'T4' is not assignable to type 'T1'.
|
||||
!!! error TS2322: Types of property '0' are incompatible.
|
||||
!!! error TS2322: Type 'number | undefined' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'number'.
|
||||
@@ -64,13 +64,13 @@ tests/cases/conformance/types/tuple/optionalTupleElements1.ts(25,5): error TS232
|
||||
t2 = t2;
|
||||
t2 = t3; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '[number, (string | undefined)?, (boolean | undefined)?]' is not assignable to type '[number, string, (boolean | undefined)?]'.
|
||||
!!! error TS2322: Type 'T3' is not assignable to type 'T2'.
|
||||
!!! error TS2322: Types of property '1' are incompatible.
|
||||
!!! error TS2322: Type 'string | undefined' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'.
|
||||
t2 = t4; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '[(number | undefined)?, (string | undefined)?, (boolean | undefined)?]' is not assignable to type '[number, string, (boolean | undefined)?]'.
|
||||
!!! error TS2322: Type 'T4' is not assignable to type 'T2'.
|
||||
!!! error TS2322: Types of property '0' are incompatible.
|
||||
!!! error TS2322: Type 'number | undefined' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'number'.
|
||||
@@ -79,7 +79,7 @@ tests/cases/conformance/types/tuple/optionalTupleElements1.ts(25,5): error TS232
|
||||
t3 = t3;
|
||||
t3 = t4; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '[(number | undefined)?, (string | undefined)?, (boolean | undefined)?]' is not assignable to type '[number, (string | undefined)?, (boolean | undefined)?]'.
|
||||
!!! error TS2322: Type 'T4' is not assignable to type 'T3'.
|
||||
!!! error TS2322: Types of property '0' are incompatible.
|
||||
!!! error TS2322: Type 'number | undefined' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'number'.
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
=== tests/cases/conformance/types/tuple/optionalTupleElements1.ts ===
|
||||
type T1 = [number, string, boolean];
|
||||
>T1 : [number, string, boolean]
|
||||
>T1 : T1
|
||||
|
||||
type T2 = [number, string, boolean?];
|
||||
>T2 : [number, string, (boolean | undefined)?]
|
||||
>T2 : T2
|
||||
|
||||
type T3 = [number, string?, boolean?];
|
||||
>T3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>T3 : T3
|
||||
|
||||
type T4 = [number?, string?, boolean?];
|
||||
>T4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>T4 : T4
|
||||
|
||||
type L1 = T1["length"];
|
||||
>L1 : 3
|
||||
@@ -24,122 +24,122 @@ type L4 = T4["length"];
|
||||
>L4 : 0 | 3 | 2 | 1
|
||||
|
||||
type T5 = [number, string?, boolean]; // Error
|
||||
>T5 : [number, string | undefined, boolean]
|
||||
>T5 : T5
|
||||
|
||||
function f1(t1: T1, t2: T2, t3: T3, t4: T4) {
|
||||
>f1 : (t1: [number, string, boolean], t2: [number, string, (boolean | undefined)?], t3: [number, (string | undefined)?, (boolean | undefined)?], t4: [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]) => void
|
||||
>t1 : [number, string, boolean]
|
||||
>t2 : [number, string, (boolean | undefined)?]
|
||||
>t3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>f1 : (t1: T1, t2: T2, t3: T3, t4: T4) => void
|
||||
>t1 : T1
|
||||
>t2 : T2
|
||||
>t3 : T3
|
||||
>t4 : T4
|
||||
|
||||
t1 = t1;
|
||||
>t1 = t1 : [number, string, boolean]
|
||||
>t1 : [number, string, boolean]
|
||||
>t1 : [number, string, boolean]
|
||||
>t1 = t1 : T1
|
||||
>t1 : T1
|
||||
>t1 : T1
|
||||
|
||||
t1 = t2; // Error
|
||||
>t1 = t2 : [number, string, (boolean | undefined)?]
|
||||
>t1 : [number, string, boolean]
|
||||
>t2 : [number, string, (boolean | undefined)?]
|
||||
>t1 = t2 : T2
|
||||
>t1 : T1
|
||||
>t2 : T2
|
||||
|
||||
t1 = t3; // Error
|
||||
>t1 = t3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>t1 : [number, string, boolean]
|
||||
>t3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>t1 = t3 : T3
|
||||
>t1 : T1
|
||||
>t3 : T3
|
||||
|
||||
t1 = t4; // Error
|
||||
>t1 = t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t1 : [number, string, boolean]
|
||||
>t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t1 = t4 : T4
|
||||
>t1 : T1
|
||||
>t4 : T4
|
||||
|
||||
t2 = t1;
|
||||
>t2 = t1 : [number, string, boolean]
|
||||
>t2 : [number, string, (boolean | undefined)?]
|
||||
>t1 : [number, string, boolean]
|
||||
>t2 = t1 : T1
|
||||
>t2 : T2
|
||||
>t1 : T1
|
||||
|
||||
t2 = t2;
|
||||
>t2 = t2 : [number, string, (boolean | undefined)?]
|
||||
>t2 : [number, string, (boolean | undefined)?]
|
||||
>t2 : [number, string, (boolean | undefined)?]
|
||||
>t2 = t2 : T2
|
||||
>t2 : T2
|
||||
>t2 : T2
|
||||
|
||||
t2 = t3; // Error
|
||||
>t2 = t3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>t2 : [number, string, (boolean | undefined)?]
|
||||
>t3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>t2 = t3 : T3
|
||||
>t2 : T2
|
||||
>t3 : T3
|
||||
|
||||
t2 = t4; // Error
|
||||
>t2 = t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t2 : [number, string, (boolean | undefined)?]
|
||||
>t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t2 = t4 : T4
|
||||
>t2 : T2
|
||||
>t4 : T4
|
||||
|
||||
t3 = t1;
|
||||
>t3 = t1 : [number, string, boolean]
|
||||
>t3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>t1 : [number, string, boolean]
|
||||
>t3 = t1 : T1
|
||||
>t3 : T3
|
||||
>t1 : T1
|
||||
|
||||
t3 = t2;
|
||||
>t3 = t2 : [number, string, (boolean | undefined)?]
|
||||
>t3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>t2 : [number, string, (boolean | undefined)?]
|
||||
>t3 = t2 : T2
|
||||
>t3 : T3
|
||||
>t2 : T2
|
||||
|
||||
t3 = t3;
|
||||
>t3 = t3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>t3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>t3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>t3 = t3 : T3
|
||||
>t3 : T3
|
||||
>t3 : T3
|
||||
|
||||
t3 = t4; // Error
|
||||
>t3 = t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t3 = t4 : T4
|
||||
>t3 : T3
|
||||
>t4 : T4
|
||||
|
||||
t4 = t1;
|
||||
>t4 = t1 : [number, string, boolean]
|
||||
>t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t1 : [number, string, boolean]
|
||||
>t4 = t1 : T1
|
||||
>t4 : T4
|
||||
>t1 : T1
|
||||
|
||||
t4 = t2;
|
||||
>t4 = t2 : [number, string, (boolean | undefined)?]
|
||||
>t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t2 : [number, string, (boolean | undefined)?]
|
||||
>t4 = t2 : T2
|
||||
>t4 : T4
|
||||
>t2 : T2
|
||||
|
||||
t4 = t3;
|
||||
>t4 = t3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>t4 = t3 : T3
|
||||
>t4 : T4
|
||||
>t3 : T3
|
||||
|
||||
t4 = t4;
|
||||
>t4 = t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t4 = t4 : T4
|
||||
>t4 : T4
|
||||
>t4 : T4
|
||||
}
|
||||
|
||||
let t2: T2;
|
||||
>t2 : [number, string, (boolean | undefined)?]
|
||||
>t2 : T2
|
||||
|
||||
let t3: T3;
|
||||
>t3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>t3 : T3
|
||||
|
||||
let t4: T4;
|
||||
>t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t4 : T4
|
||||
|
||||
t2 = [42, "hello"];
|
||||
>t2 = [42, "hello"] : [number, string]
|
||||
>t2 : [number, string, (boolean | undefined)?]
|
||||
>t2 : T2
|
||||
>[42, "hello"] : [number, string]
|
||||
>42 : 42
|
||||
>"hello" : "hello"
|
||||
|
||||
t3 = [42, "hello"];
|
||||
>t3 = [42, "hello"] : [number, string]
|
||||
>t3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>t3 : T3
|
||||
>[42, "hello"] : [number, string]
|
||||
>42 : 42
|
||||
>"hello" : "hello"
|
||||
|
||||
t3 = [42,,true]
|
||||
>t3 = [42,,true] : [number, undefined, true]
|
||||
>t3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>t3 : T3
|
||||
>[42,,true] : [number, undefined, true]
|
||||
>42 : 42
|
||||
> : undefined
|
||||
@@ -147,20 +147,20 @@ t3 = [42,,true]
|
||||
|
||||
t3 = [42];
|
||||
>t3 = [42] : [number]
|
||||
>t3 : [number, (string | undefined)?, (boolean | undefined)?]
|
||||
>t3 : T3
|
||||
>[42] : [number]
|
||||
>42 : 42
|
||||
|
||||
t4 = [42, "hello"];
|
||||
>t4 = [42, "hello"] : [number, string]
|
||||
>t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t4 : T4
|
||||
>[42, "hello"] : [number, string]
|
||||
>42 : 42
|
||||
>"hello" : "hello"
|
||||
|
||||
t4 = [42,,true];
|
||||
>t4 = [42,,true] : [number, undefined, true]
|
||||
>t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t4 : T4
|
||||
>[42,,true] : [number, undefined, true]
|
||||
>42 : 42
|
||||
> : undefined
|
||||
@@ -168,7 +168,7 @@ t4 = [42,,true];
|
||||
|
||||
t4 = [,"hello", true];
|
||||
>t4 = [,"hello", true] : [undefined, string, true]
|
||||
>t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t4 : T4
|
||||
>[,"hello", true] : [undefined, string, true]
|
||||
> : undefined
|
||||
>"hello" : "hello"
|
||||
@@ -176,7 +176,7 @@ t4 = [,"hello", true];
|
||||
|
||||
t4 = [,,true];
|
||||
>t4 = [,,true] : [undefined, undefined, true]
|
||||
>t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t4 : T4
|
||||
>[,,true] : [undefined, undefined, true]
|
||||
> : undefined
|
||||
> : undefined
|
||||
@@ -184,6 +184,6 @@ t4 = [,,true];
|
||||
|
||||
t4 = [];
|
||||
>t4 = [] : []
|
||||
>t4 : [(number | undefined)?, (string | undefined)?, (boolean | undefined)?]
|
||||
>t4 : T4
|
||||
>[] : []
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ declare const OtherRadio: () => React.ReactElement<{}>;
|
||||
>React : any
|
||||
|
||||
declare const Checkbox: React.SFC;
|
||||
>Checkbox : React.StatelessComponent<{}>
|
||||
>Checkbox : React.SFC<{}>
|
||||
>React : any
|
||||
|
||||
declare const condition1: boolean;
|
||||
@@ -27,43 +27,43 @@ declare const condition3: boolean;
|
||||
>condition3 : boolean
|
||||
|
||||
const RandomComponent: React.SFC = () => {
|
||||
>RandomComponent : React.StatelessComponent<{}>
|
||||
>RandomComponent : React.SFC<{}>
|
||||
>React : any
|
||||
>() => { const Component = condition1 ? Radio : Checkbox; const OtherComponent = condition2 ? OtherRadio : Checkbox; return condition1 ? <Component /> : <OtherComponent />;} : () => JSX.Element
|
||||
|
||||
const Component =
|
||||
>Component : React.StatelessComponent<{}> | ((props: {}) => React.ReactElement<{}>)
|
||||
>Component : ((props: {}) => React.ReactElement<{}>) | React.SFC<{}>
|
||||
|
||||
condition1
|
||||
>condition1 ? Radio : Checkbox : React.StatelessComponent<{}> | ((props: {}) => React.ReactElement<{}>)
|
||||
>condition1 ? Radio : Checkbox : ((props: {}) => React.ReactElement<{}>) | React.SFC<{}>
|
||||
>condition1 : boolean
|
||||
|
||||
? Radio
|
||||
>Radio : (props: {}) => React.ReactElement<{}>
|
||||
|
||||
: Checkbox;
|
||||
>Checkbox : React.StatelessComponent<{}>
|
||||
>Checkbox : React.SFC<{}>
|
||||
|
||||
const OtherComponent =
|
||||
>OtherComponent : React.StatelessComponent<{}> | (() => React.ReactElement<{}>)
|
||||
>OtherComponent : (() => React.ReactElement<{}>) | React.SFC<{}>
|
||||
|
||||
condition2
|
||||
>condition2 ? OtherRadio : Checkbox : React.StatelessComponent<{}> | (() => React.ReactElement<{}>)
|
||||
>condition2 ? OtherRadio : Checkbox : (() => React.ReactElement<{}>) | React.SFC<{}>
|
||||
>condition2 : boolean
|
||||
|
||||
? OtherRadio
|
||||
>OtherRadio : () => React.ReactElement<{}>
|
||||
|
||||
: Checkbox;
|
||||
>Checkbox : React.StatelessComponent<{}>
|
||||
>Checkbox : React.SFC<{}>
|
||||
|
||||
return condition1 ? <Component /> : <OtherComponent />;
|
||||
>condition1 ? <Component /> : <OtherComponent /> : JSX.Element
|
||||
>condition1 : boolean
|
||||
><Component /> : JSX.Element
|
||||
>Component : React.StatelessComponent<{}> | ((props: {}) => React.ReactElement<{}>)
|
||||
>Component : ((props: {}) => React.ReactElement<{}>) | React.SFC<{}>
|
||||
><OtherComponent /> : JSX.Element
|
||||
>OtherComponent : React.StatelessComponent<{}> | (() => React.ReactElement<{}>)
|
||||
>OtherComponent : (() => React.ReactElement<{}>) | React.SFC<{}>
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
=== tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts ===
|
||||
type T10 = string[];
|
||||
>T10 : string[]
|
||||
>T10 : T10
|
||||
|
||||
type T11 = Array<string>;
|
||||
>T11 : string[]
|
||||
>T11 : T11
|
||||
|
||||
type T12 = readonly string[];
|
||||
>T12 : readonly string[]
|
||||
|
||||
type T13 = ReadonlyArray<string>;
|
||||
>T13 : readonly string[]
|
||||
>T13 : T13
|
||||
|
||||
type T20 = [number, number];
|
||||
>T20 : [number, number]
|
||||
>T20 : T20
|
||||
|
||||
type T21 = readonly [number, number];
|
||||
>T21 : readonly [number, number]
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
=== tests/cases/conformance/types/tuple/readonlyArraysAndTuples2.ts ===
|
||||
type T10 = string[];
|
||||
>T10 : string[]
|
||||
>T10 : T10
|
||||
|
||||
type T11 = Array<string>;
|
||||
>T11 : string[]
|
||||
>T11 : T11
|
||||
|
||||
type T12 = readonly string[];
|
||||
>T12 : readonly string[]
|
||||
|
||||
type T13 = ReadonlyArray<string>;
|
||||
>T13 : readonly string[]
|
||||
>T13 : T13
|
||||
|
||||
type T20 = [number, number];
|
||||
>T20 : [number, number]
|
||||
>T20 : T20
|
||||
|
||||
type T21 = readonly [number, number];
|
||||
>T21 : readonly [number, number]
|
||||
|
||||
@@ -25,10 +25,10 @@ export type Circular<T> = {[P in keyof T]: Circular<T>};
|
||||
>Circular : Circular<T>
|
||||
|
||||
type tup = [number, number, number, number];
|
||||
>tup : [number, number, number, number]
|
||||
>tup : tup
|
||||
|
||||
function foo(arg: Circular<tup>): tup {
|
||||
>foo : (arg: any) => [number, number, number, number]
|
||||
>foo : (arg: any) => tup
|
||||
>arg : any
|
||||
|
||||
return arg;
|
||||
@@ -44,10 +44,10 @@ type DeepMap<T extends unknown[], R> = {
|
||||
};
|
||||
|
||||
type tpl = [string, [string, [string]]];
|
||||
>tpl : [string, [string, [string]]]
|
||||
>tpl : tpl
|
||||
|
||||
type arr = string[][];
|
||||
>arr : string[][]
|
||||
>arr : arr
|
||||
|
||||
type t1 = DeepMap<tpl, number>; // [number, [number, [number]]]
|
||||
>t1 : [number, [number, [number]]]
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeReferences1.ts(45,7): error TS2322: Type '42' is not assignable to type 'Box2'.
|
||||
tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeReferences1.ts(60,7): error TS2322: Type 'number' is not assignable to type 'string | RecArray<string>'.
|
||||
tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeReferences1.ts(66,8): error TS2322: Type 'number' is not assignable to type 'string | string[]'.
|
||||
tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeReferences1.ts(72,8): error TS2322: Type 'number' is not assignable to type 'string | (string | string[])[]'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeReferences1.ts (4 errors) ====
|
||||
type ValueOrArray<T> = T | Array<ValueOrArray<T>>;
|
||||
|
||||
const a0: ValueOrArray<number> = 1;
|
||||
const a1: ValueOrArray<number> = [1, [2, 3], [4, [5, [6, 7]]]];
|
||||
|
||||
type HypertextNode = string | [string, { [key: string]: unknown }, ...HypertextNode[]];
|
||||
|
||||
const hypertextNode: HypertextNode =
|
||||
["div", { id: "parent" },
|
||||
["div", { id: "first-child" }, "I'm the first child"],
|
||||
["div", { id: "second-child" }, "I'm the second child"]
|
||||
];
|
||||
|
||||
type Json = string | number | boolean | null | Json[] | { [key: string]: Json };
|
||||
|
||||
let data: Json = {
|
||||
caption: "Test",
|
||||
location: { x: 10, y: 20 },
|
||||
values: [true, [10, 20], null]
|
||||
};
|
||||
|
||||
interface Box<T> { value: T };
|
||||
|
||||
type T1 = Box<T1>;
|
||||
type T2 = Box<Box<T2>>;
|
||||
type T3 = Box<Box<Box<T3>>>;
|
||||
|
||||
function f1(t1: T1, t2: T2, t3: T3) {
|
||||
t1 = t2;
|
||||
t1 = t3;
|
||||
t2 = t1;
|
||||
t2 = t3;
|
||||
t3 = t1;
|
||||
t3 = t2;
|
||||
}
|
||||
|
||||
type Box1 = Box<Box1> | number;
|
||||
|
||||
const b10: Box1 = 42;
|
||||
const b11: Box1 = { value: 42 };
|
||||
const b12: Box1 = { value: { value: { value: 42 }}};
|
||||
|
||||
type Box2 = Box<Box2 | number>;
|
||||
|
||||
const b20: Box2 = 42; // Error
|
||||
~~~
|
||||
!!! error TS2322: Type '42' is not assignable to type 'Box2'.
|
||||
const b21: Box2 = { value: 42 };
|
||||
const b22: Box2 = { value: { value: { value: 42 }}};
|
||||
|
||||
type RecArray<T> = Array<T | RecArray<T>>;
|
||||
|
||||
declare function flat<T>(a: RecArray<T>): Array<T>;
|
||||
declare function flat1<T>(a: Array<T | Array<T>>): Array<T>
|
||||
declare function flat2<T>(a: Array<T | Array<T | Array<T>>>): Array<T>;
|
||||
|
||||
flat([1, [2, [3]]]); // number[]
|
||||
flat([[[0]]]); // number[]
|
||||
flat([[[[[[[[[[[4]]]]]]]]]]]); // number[]
|
||||
flat([1, 'a', [2]]); // (string | number)[]
|
||||
flat([1, [2, 'a']]); // (string | number)[]
|
||||
flat([1, ['a']]); // Error
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string | RecArray<string>'.
|
||||
|
||||
flat1([1, [2, [3]]]); // (number | number[])[]
|
||||
flat1([[[0]]]); // number[][]
|
||||
flat1([1, 'a', [2]]); // (string | number)[]
|
||||
flat1([1, [2, 'a']]); // (string | number)[]
|
||||
flat1([1, ['a']]); // Error
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string | string[]'.
|
||||
|
||||
flat2([1, [2, [3]]]); // number[]
|
||||
flat2([[[0]]]); // number[]
|
||||
flat2([1, 'a', [2]]); // (string | number)[]
|
||||
flat2([1, [2, 'a']]); // (string | number)[]
|
||||
flat2([1, ['a']]); // Error
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string | (string | string[])[]'.
|
||||
|
||||
type T10 = T10[];
|
||||
type T11 = readonly T11[];
|
||||
type T12 = (T12)[];
|
||||
type T13 = T13[] | string;
|
||||
type T14 = T14[] & { x: string };
|
||||
type T15<X> = X extends string ? T15<X>[] : never;
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
//// [recursiveTypeReferences1.ts]
|
||||
type ValueOrArray<T> = T | Array<ValueOrArray<T>>;
|
||||
|
||||
const a0: ValueOrArray<number> = 1;
|
||||
const a1: ValueOrArray<number> = [1, [2, 3], [4, [5, [6, 7]]]];
|
||||
|
||||
type HypertextNode = string | [string, { [key: string]: unknown }, ...HypertextNode[]];
|
||||
|
||||
const hypertextNode: HypertextNode =
|
||||
["div", { id: "parent" },
|
||||
["div", { id: "first-child" }, "I'm the first child"],
|
||||
["div", { id: "second-child" }, "I'm the second child"]
|
||||
];
|
||||
|
||||
type Json = string | number | boolean | null | Json[] | { [key: string]: Json };
|
||||
|
||||
let data: Json = {
|
||||
caption: "Test",
|
||||
location: { x: 10, y: 20 },
|
||||
values: [true, [10, 20], null]
|
||||
};
|
||||
|
||||
interface Box<T> { value: T };
|
||||
|
||||
type T1 = Box<T1>;
|
||||
type T2 = Box<Box<T2>>;
|
||||
type T3 = Box<Box<Box<T3>>>;
|
||||
|
||||
function f1(t1: T1, t2: T2, t3: T3) {
|
||||
t1 = t2;
|
||||
t1 = t3;
|
||||
t2 = t1;
|
||||
t2 = t3;
|
||||
t3 = t1;
|
||||
t3 = t2;
|
||||
}
|
||||
|
||||
type Box1 = Box<Box1> | number;
|
||||
|
||||
const b10: Box1 = 42;
|
||||
const b11: Box1 = { value: 42 };
|
||||
const b12: Box1 = { value: { value: { value: 42 }}};
|
||||
|
||||
type Box2 = Box<Box2 | number>;
|
||||
|
||||
const b20: Box2 = 42; // Error
|
||||
const b21: Box2 = { value: 42 };
|
||||
const b22: Box2 = { value: { value: { value: 42 }}};
|
||||
|
||||
type RecArray<T> = Array<T | RecArray<T>>;
|
||||
|
||||
declare function flat<T>(a: RecArray<T>): Array<T>;
|
||||
declare function flat1<T>(a: Array<T | Array<T>>): Array<T>
|
||||
declare function flat2<T>(a: Array<T | Array<T | Array<T>>>): Array<T>;
|
||||
|
||||
flat([1, [2, [3]]]); // number[]
|
||||
flat([[[0]]]); // number[]
|
||||
flat([[[[[[[[[[[4]]]]]]]]]]]); // number[]
|
||||
flat([1, 'a', [2]]); // (string | number)[]
|
||||
flat([1, [2, 'a']]); // (string | number)[]
|
||||
flat([1, ['a']]); // Error
|
||||
|
||||
flat1([1, [2, [3]]]); // (number | number[])[]
|
||||
flat1([[[0]]]); // number[][]
|
||||
flat1([1, 'a', [2]]); // (string | number)[]
|
||||
flat1([1, [2, 'a']]); // (string | number)[]
|
||||
flat1([1, ['a']]); // Error
|
||||
|
||||
flat2([1, [2, [3]]]); // number[]
|
||||
flat2([[[0]]]); // number[]
|
||||
flat2([1, 'a', [2]]); // (string | number)[]
|
||||
flat2([1, [2, 'a']]); // (string | number)[]
|
||||
flat2([1, ['a']]); // Error
|
||||
|
||||
type T10 = T10[];
|
||||
type T11 = readonly T11[];
|
||||
type T12 = (T12)[];
|
||||
type T13 = T13[] | string;
|
||||
type T14 = T14[] & { x: string };
|
||||
type T15<X> = X extends string ? T15<X>[] : never;
|
||||
|
||||
|
||||
//// [recursiveTypeReferences1.js]
|
||||
"use strict";
|
||||
var a0 = 1;
|
||||
var a1 = [1, [2, 3], [4, [5, [6, 7]]]];
|
||||
var hypertextNode = ["div", { id: "parent" },
|
||||
["div", { id: "first-child" }, "I'm the first child"],
|
||||
["div", { id: "second-child" }, "I'm the second child"]
|
||||
];
|
||||
var data = {
|
||||
caption: "Test",
|
||||
location: { x: 10, y: 20 },
|
||||
values: [true, [10, 20], null]
|
||||
};
|
||||
;
|
||||
function f1(t1, t2, t3) {
|
||||
t1 = t2;
|
||||
t1 = t3;
|
||||
t2 = t1;
|
||||
t2 = t3;
|
||||
t3 = t1;
|
||||
t3 = t2;
|
||||
}
|
||||
var b10 = 42;
|
||||
var b11 = { value: 42 };
|
||||
var b12 = { value: { value: { value: 42 } } };
|
||||
var b20 = 42; // Error
|
||||
var b21 = { value: 42 };
|
||||
var b22 = { value: { value: { value: 42 } } };
|
||||
flat([1, [2, [3]]]); // number[]
|
||||
flat([[[0]]]); // number[]
|
||||
flat([[[[[[[[[[[4]]]]]]]]]]]); // number[]
|
||||
flat([1, 'a', [2]]); // (string | number)[]
|
||||
flat([1, [2, 'a']]); // (string | number)[]
|
||||
flat([1, ['a']]); // Error
|
||||
flat1([1, [2, [3]]]); // (number | number[])[]
|
||||
flat1([[[0]]]); // number[][]
|
||||
flat1([1, 'a', [2]]); // (string | number)[]
|
||||
flat1([1, [2, 'a']]); // (string | number)[]
|
||||
flat1([1, ['a']]); // Error
|
||||
flat2([1, [2, [3]]]); // number[]
|
||||
flat2([[[0]]]); // number[]
|
||||
flat2([1, 'a', [2]]); // (string | number)[]
|
||||
flat2([1, [2, 'a']]); // (string | number)[]
|
||||
flat2([1, ['a']]); // Error
|
||||
|
||||
|
||||
//// [recursiveTypeReferences1.d.ts]
|
||||
declare type ValueOrArray<T> = T | Array<ValueOrArray<T>>;
|
||||
declare const a0: ValueOrArray<number>;
|
||||
declare const a1: ValueOrArray<number>;
|
||||
declare type HypertextNode = string | [string, {
|
||||
[key: string]: unknown;
|
||||
}, ...HypertextNode[]];
|
||||
declare const hypertextNode: HypertextNode;
|
||||
declare type Json = string | number | boolean | null | Json[] | {
|
||||
[key: string]: Json;
|
||||
};
|
||||
declare let data: Json;
|
||||
interface Box<T> {
|
||||
value: T;
|
||||
}
|
||||
declare type T1 = Box<T1>;
|
||||
declare type T2 = Box<Box<T2>>;
|
||||
declare type T3 = Box<Box<Box<T3>>>;
|
||||
declare function f1(t1: T1, t2: T2, t3: T3): void;
|
||||
declare type Box1 = Box<Box1> | number;
|
||||
declare const b10: Box1;
|
||||
declare const b11: Box1;
|
||||
declare const b12: Box1;
|
||||
declare type Box2 = Box<Box2 | number>;
|
||||
declare const b20: Box2;
|
||||
declare const b21: Box2;
|
||||
declare const b22: Box2;
|
||||
declare type RecArray<T> = Array<T | RecArray<T>>;
|
||||
declare function flat<T>(a: RecArray<T>): Array<T>;
|
||||
declare function flat1<T>(a: Array<T | Array<T>>): Array<T>;
|
||||
declare function flat2<T>(a: Array<T | Array<T | Array<T>>>): Array<T>;
|
||||
declare type T10 = T10[];
|
||||
declare type T11 = readonly T11[];
|
||||
declare type T12 = (T12)[];
|
||||
declare type T13 = T13[] | string;
|
||||
declare type T14 = T14[] & {
|
||||
x: string;
|
||||
};
|
||||
declare type T15<X> = X extends string ? T15<X>[] : never;
|
||||
@@ -0,0 +1,277 @@
|
||||
=== tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeReferences1.ts ===
|
||||
type ValueOrArray<T> = T | Array<ValueOrArray<T>>;
|
||||
>ValueOrArray : Symbol(ValueOrArray, Decl(recursiveTypeReferences1.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 0, 18))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 0, 18))
|
||||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>ValueOrArray : Symbol(ValueOrArray, Decl(recursiveTypeReferences1.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 0, 18))
|
||||
|
||||
const a0: ValueOrArray<number> = 1;
|
||||
>a0 : Symbol(a0, Decl(recursiveTypeReferences1.ts, 2, 5))
|
||||
>ValueOrArray : Symbol(ValueOrArray, Decl(recursiveTypeReferences1.ts, 0, 0))
|
||||
|
||||
const a1: ValueOrArray<number> = [1, [2, 3], [4, [5, [6, 7]]]];
|
||||
>a1 : Symbol(a1, Decl(recursiveTypeReferences1.ts, 3, 5))
|
||||
>ValueOrArray : Symbol(ValueOrArray, Decl(recursiveTypeReferences1.ts, 0, 0))
|
||||
|
||||
type HypertextNode = string | [string, { [key: string]: unknown }, ...HypertextNode[]];
|
||||
>HypertextNode : Symbol(HypertextNode, Decl(recursiveTypeReferences1.ts, 3, 63))
|
||||
>key : Symbol(key, Decl(recursiveTypeReferences1.ts, 5, 42))
|
||||
>HypertextNode : Symbol(HypertextNode, Decl(recursiveTypeReferences1.ts, 3, 63))
|
||||
|
||||
const hypertextNode: HypertextNode =
|
||||
>hypertextNode : Symbol(hypertextNode, Decl(recursiveTypeReferences1.ts, 7, 5))
|
||||
>HypertextNode : Symbol(HypertextNode, Decl(recursiveTypeReferences1.ts, 3, 63))
|
||||
|
||||
["div", { id: "parent" },
|
||||
>id : Symbol(id, Decl(recursiveTypeReferences1.ts, 8, 13))
|
||||
|
||||
["div", { id: "first-child" }, "I'm the first child"],
|
||||
>id : Symbol(id, Decl(recursiveTypeReferences1.ts, 9, 17))
|
||||
|
||||
["div", { id: "second-child" }, "I'm the second child"]
|
||||
>id : Symbol(id, Decl(recursiveTypeReferences1.ts, 10, 17))
|
||||
|
||||
];
|
||||
|
||||
type Json = string | number | boolean | null | Json[] | { [key: string]: Json };
|
||||
>Json : Symbol(Json, Decl(recursiveTypeReferences1.ts, 11, 6))
|
||||
>Json : Symbol(Json, Decl(recursiveTypeReferences1.ts, 11, 6))
|
||||
>key : Symbol(key, Decl(recursiveTypeReferences1.ts, 13, 59))
|
||||
>Json : Symbol(Json, Decl(recursiveTypeReferences1.ts, 11, 6))
|
||||
|
||||
let data: Json = {
|
||||
>data : Symbol(data, Decl(recursiveTypeReferences1.ts, 15, 3))
|
||||
>Json : Symbol(Json, Decl(recursiveTypeReferences1.ts, 11, 6))
|
||||
|
||||
caption: "Test",
|
||||
>caption : Symbol(caption, Decl(recursiveTypeReferences1.ts, 15, 18))
|
||||
|
||||
location: { x: 10, y: 20 },
|
||||
>location : Symbol(location, Decl(recursiveTypeReferences1.ts, 16, 20))
|
||||
>x : Symbol(x, Decl(recursiveTypeReferences1.ts, 17, 15))
|
||||
>y : Symbol(y, Decl(recursiveTypeReferences1.ts, 17, 22))
|
||||
|
||||
values: [true, [10, 20], null]
|
||||
>values : Symbol(values, Decl(recursiveTypeReferences1.ts, 17, 31))
|
||||
|
||||
};
|
||||
|
||||
interface Box<T> { value: T };
|
||||
>Box : Symbol(Box, Decl(recursiveTypeReferences1.ts, 19, 2))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 21, 14))
|
||||
>value : Symbol(Box.value, Decl(recursiveTypeReferences1.ts, 21, 18))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 21, 14))
|
||||
|
||||
type T1 = Box<T1>;
|
||||
>T1 : Symbol(T1, Decl(recursiveTypeReferences1.ts, 21, 30))
|
||||
>Box : Symbol(Box, Decl(recursiveTypeReferences1.ts, 19, 2))
|
||||
>T1 : Symbol(T1, Decl(recursiveTypeReferences1.ts, 21, 30))
|
||||
|
||||
type T2 = Box<Box<T2>>;
|
||||
>T2 : Symbol(T2, Decl(recursiveTypeReferences1.ts, 23, 18))
|
||||
>Box : Symbol(Box, Decl(recursiveTypeReferences1.ts, 19, 2))
|
||||
>Box : Symbol(Box, Decl(recursiveTypeReferences1.ts, 19, 2))
|
||||
>T2 : Symbol(T2, Decl(recursiveTypeReferences1.ts, 23, 18))
|
||||
|
||||
type T3 = Box<Box<Box<T3>>>;
|
||||
>T3 : Symbol(T3, Decl(recursiveTypeReferences1.ts, 24, 23))
|
||||
>Box : Symbol(Box, Decl(recursiveTypeReferences1.ts, 19, 2))
|
||||
>Box : Symbol(Box, Decl(recursiveTypeReferences1.ts, 19, 2))
|
||||
>Box : Symbol(Box, Decl(recursiveTypeReferences1.ts, 19, 2))
|
||||
>T3 : Symbol(T3, Decl(recursiveTypeReferences1.ts, 24, 23))
|
||||
|
||||
function f1(t1: T1, t2: T2, t3: T3) {
|
||||
>f1 : Symbol(f1, Decl(recursiveTypeReferences1.ts, 25, 28))
|
||||
>t1 : Symbol(t1, Decl(recursiveTypeReferences1.ts, 27, 12))
|
||||
>T1 : Symbol(T1, Decl(recursiveTypeReferences1.ts, 21, 30))
|
||||
>t2 : Symbol(t2, Decl(recursiveTypeReferences1.ts, 27, 19))
|
||||
>T2 : Symbol(T2, Decl(recursiveTypeReferences1.ts, 23, 18))
|
||||
>t3 : Symbol(t3, Decl(recursiveTypeReferences1.ts, 27, 27))
|
||||
>T3 : Symbol(T3, Decl(recursiveTypeReferences1.ts, 24, 23))
|
||||
|
||||
t1 = t2;
|
||||
>t1 : Symbol(t1, Decl(recursiveTypeReferences1.ts, 27, 12))
|
||||
>t2 : Symbol(t2, Decl(recursiveTypeReferences1.ts, 27, 19))
|
||||
|
||||
t1 = t3;
|
||||
>t1 : Symbol(t1, Decl(recursiveTypeReferences1.ts, 27, 12))
|
||||
>t3 : Symbol(t3, Decl(recursiveTypeReferences1.ts, 27, 27))
|
||||
|
||||
t2 = t1;
|
||||
>t2 : Symbol(t2, Decl(recursiveTypeReferences1.ts, 27, 19))
|
||||
>t1 : Symbol(t1, Decl(recursiveTypeReferences1.ts, 27, 12))
|
||||
|
||||
t2 = t3;
|
||||
>t2 : Symbol(t2, Decl(recursiveTypeReferences1.ts, 27, 19))
|
||||
>t3 : Symbol(t3, Decl(recursiveTypeReferences1.ts, 27, 27))
|
||||
|
||||
t3 = t1;
|
||||
>t3 : Symbol(t3, Decl(recursiveTypeReferences1.ts, 27, 27))
|
||||
>t1 : Symbol(t1, Decl(recursiveTypeReferences1.ts, 27, 12))
|
||||
|
||||
t3 = t2;
|
||||
>t3 : Symbol(t3, Decl(recursiveTypeReferences1.ts, 27, 27))
|
||||
>t2 : Symbol(t2, Decl(recursiveTypeReferences1.ts, 27, 19))
|
||||
}
|
||||
|
||||
type Box1 = Box<Box1> | number;
|
||||
>Box1 : Symbol(Box1, Decl(recursiveTypeReferences1.ts, 34, 1))
|
||||
>Box : Symbol(Box, Decl(recursiveTypeReferences1.ts, 19, 2))
|
||||
>Box1 : Symbol(Box1, Decl(recursiveTypeReferences1.ts, 34, 1))
|
||||
|
||||
const b10: Box1 = 42;
|
||||
>b10 : Symbol(b10, Decl(recursiveTypeReferences1.ts, 38, 5))
|
||||
>Box1 : Symbol(Box1, Decl(recursiveTypeReferences1.ts, 34, 1))
|
||||
|
||||
const b11: Box1 = { value: 42 };
|
||||
>b11 : Symbol(b11, Decl(recursiveTypeReferences1.ts, 39, 5))
|
||||
>Box1 : Symbol(Box1, Decl(recursiveTypeReferences1.ts, 34, 1))
|
||||
>value : Symbol(value, Decl(recursiveTypeReferences1.ts, 39, 19))
|
||||
|
||||
const b12: Box1 = { value: { value: { value: 42 }}};
|
||||
>b12 : Symbol(b12, Decl(recursiveTypeReferences1.ts, 40, 5))
|
||||
>Box1 : Symbol(Box1, Decl(recursiveTypeReferences1.ts, 34, 1))
|
||||
>value : Symbol(value, Decl(recursiveTypeReferences1.ts, 40, 19))
|
||||
>value : Symbol(value, Decl(recursiveTypeReferences1.ts, 40, 28))
|
||||
>value : Symbol(value, Decl(recursiveTypeReferences1.ts, 40, 37))
|
||||
|
||||
type Box2 = Box<Box2 | number>;
|
||||
>Box2 : Symbol(Box2, Decl(recursiveTypeReferences1.ts, 40, 52))
|
||||
>Box : Symbol(Box, Decl(recursiveTypeReferences1.ts, 19, 2))
|
||||
>Box2 : Symbol(Box2, Decl(recursiveTypeReferences1.ts, 40, 52))
|
||||
|
||||
const b20: Box2 = 42; // Error
|
||||
>b20 : Symbol(b20, Decl(recursiveTypeReferences1.ts, 44, 5))
|
||||
>Box2 : Symbol(Box2, Decl(recursiveTypeReferences1.ts, 40, 52))
|
||||
|
||||
const b21: Box2 = { value: 42 };
|
||||
>b21 : Symbol(b21, Decl(recursiveTypeReferences1.ts, 45, 5))
|
||||
>Box2 : Symbol(Box2, Decl(recursiveTypeReferences1.ts, 40, 52))
|
||||
>value : Symbol(value, Decl(recursiveTypeReferences1.ts, 45, 19))
|
||||
|
||||
const b22: Box2 = { value: { value: { value: 42 }}};
|
||||
>b22 : Symbol(b22, Decl(recursiveTypeReferences1.ts, 46, 5))
|
||||
>Box2 : Symbol(Box2, Decl(recursiveTypeReferences1.ts, 40, 52))
|
||||
>value : Symbol(value, Decl(recursiveTypeReferences1.ts, 46, 19))
|
||||
>value : Symbol(value, Decl(recursiveTypeReferences1.ts, 46, 28))
|
||||
>value : Symbol(value, Decl(recursiveTypeReferences1.ts, 46, 37))
|
||||
|
||||
type RecArray<T> = Array<T | RecArray<T>>;
|
||||
>RecArray : Symbol(RecArray, Decl(recursiveTypeReferences1.ts, 46, 52))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 48, 14))
|
||||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 48, 14))
|
||||
>RecArray : Symbol(RecArray, Decl(recursiveTypeReferences1.ts, 46, 52))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 48, 14))
|
||||
|
||||
declare function flat<T>(a: RecArray<T>): Array<T>;
|
||||
>flat : Symbol(flat, Decl(recursiveTypeReferences1.ts, 48, 42))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 50, 22))
|
||||
>a : Symbol(a, Decl(recursiveTypeReferences1.ts, 50, 25))
|
||||
>RecArray : Symbol(RecArray, Decl(recursiveTypeReferences1.ts, 46, 52))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 50, 22))
|
||||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 50, 22))
|
||||
|
||||
declare function flat1<T>(a: Array<T | Array<T>>): Array<T>
|
||||
>flat1 : Symbol(flat1, Decl(recursiveTypeReferences1.ts, 50, 51))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 51, 23))
|
||||
>a : Symbol(a, Decl(recursiveTypeReferences1.ts, 51, 26))
|
||||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 51, 23))
|
||||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 51, 23))
|
||||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 51, 23))
|
||||
|
||||
declare function flat2<T>(a: Array<T | Array<T | Array<T>>>): Array<T>;
|
||||
>flat2 : Symbol(flat2, Decl(recursiveTypeReferences1.ts, 51, 59))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 52, 23))
|
||||
>a : Symbol(a, Decl(recursiveTypeReferences1.ts, 52, 26))
|
||||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 52, 23))
|
||||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 52, 23))
|
||||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 52, 23))
|
||||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(recursiveTypeReferences1.ts, 52, 23))
|
||||
|
||||
flat([1, [2, [3]]]); // number[]
|
||||
>flat : Symbol(flat, Decl(recursiveTypeReferences1.ts, 48, 42))
|
||||
|
||||
flat([[[0]]]); // number[]
|
||||
>flat : Symbol(flat, Decl(recursiveTypeReferences1.ts, 48, 42))
|
||||
|
||||
flat([[[[[[[[[[[4]]]]]]]]]]]); // number[]
|
||||
>flat : Symbol(flat, Decl(recursiveTypeReferences1.ts, 48, 42))
|
||||
|
||||
flat([1, 'a', [2]]); // (string | number)[]
|
||||
>flat : Symbol(flat, Decl(recursiveTypeReferences1.ts, 48, 42))
|
||||
|
||||
flat([1, [2, 'a']]); // (string | number)[]
|
||||
>flat : Symbol(flat, Decl(recursiveTypeReferences1.ts, 48, 42))
|
||||
|
||||
flat([1, ['a']]); // Error
|
||||
>flat : Symbol(flat, Decl(recursiveTypeReferences1.ts, 48, 42))
|
||||
|
||||
flat1([1, [2, [3]]]); // (number | number[])[]
|
||||
>flat1 : Symbol(flat1, Decl(recursiveTypeReferences1.ts, 50, 51))
|
||||
|
||||
flat1([[[0]]]); // number[][]
|
||||
>flat1 : Symbol(flat1, Decl(recursiveTypeReferences1.ts, 50, 51))
|
||||
|
||||
flat1([1, 'a', [2]]); // (string | number)[]
|
||||
>flat1 : Symbol(flat1, Decl(recursiveTypeReferences1.ts, 50, 51))
|
||||
|
||||
flat1([1, [2, 'a']]); // (string | number)[]
|
||||
>flat1 : Symbol(flat1, Decl(recursiveTypeReferences1.ts, 50, 51))
|
||||
|
||||
flat1([1, ['a']]); // Error
|
||||
>flat1 : Symbol(flat1, Decl(recursiveTypeReferences1.ts, 50, 51))
|
||||
|
||||
flat2([1, [2, [3]]]); // number[]
|
||||
>flat2 : Symbol(flat2, Decl(recursiveTypeReferences1.ts, 51, 59))
|
||||
|
||||
flat2([[[0]]]); // number[]
|
||||
>flat2 : Symbol(flat2, Decl(recursiveTypeReferences1.ts, 51, 59))
|
||||
|
||||
flat2([1, 'a', [2]]); // (string | number)[]
|
||||
>flat2 : Symbol(flat2, Decl(recursiveTypeReferences1.ts, 51, 59))
|
||||
|
||||
flat2([1, [2, 'a']]); // (string | number)[]
|
||||
>flat2 : Symbol(flat2, Decl(recursiveTypeReferences1.ts, 51, 59))
|
||||
|
||||
flat2([1, ['a']]); // Error
|
||||
>flat2 : Symbol(flat2, Decl(recursiveTypeReferences1.ts, 51, 59))
|
||||
|
||||
type T10 = T10[];
|
||||
>T10 : Symbol(T10, Decl(recursiveTypeReferences1.ts, 71, 18))
|
||||
>T10 : Symbol(T10, Decl(recursiveTypeReferences1.ts, 71, 18))
|
||||
|
||||
type T11 = readonly T11[];
|
||||
>T11 : Symbol(T11, Decl(recursiveTypeReferences1.ts, 73, 17))
|
||||
>T11 : Symbol(T11, Decl(recursiveTypeReferences1.ts, 73, 17))
|
||||
|
||||
type T12 = (T12)[];
|
||||
>T12 : Symbol(T12, Decl(recursiveTypeReferences1.ts, 74, 26))
|
||||
>T12 : Symbol(T12, Decl(recursiveTypeReferences1.ts, 74, 26))
|
||||
|
||||
type T13 = T13[] | string;
|
||||
>T13 : Symbol(T13, Decl(recursiveTypeReferences1.ts, 75, 19))
|
||||
>T13 : Symbol(T13, Decl(recursiveTypeReferences1.ts, 75, 19))
|
||||
|
||||
type T14 = T14[] & { x: string };
|
||||
>T14 : Symbol(T14, Decl(recursiveTypeReferences1.ts, 76, 26))
|
||||
>T14 : Symbol(T14, Decl(recursiveTypeReferences1.ts, 76, 26))
|
||||
>x : Symbol(x, Decl(recursiveTypeReferences1.ts, 77, 20))
|
||||
|
||||
type T15<X> = X extends string ? T15<X>[] : never;
|
||||
>T15 : Symbol(T15, Decl(recursiveTypeReferences1.ts, 77, 33))
|
||||
>X : Symbol(X, Decl(recursiveTypeReferences1.ts, 78, 9))
|
||||
>X : Symbol(X, Decl(recursiveTypeReferences1.ts, 78, 9))
|
||||
>T15 : Symbol(T15, Decl(recursiveTypeReferences1.ts, 77, 33))
|
||||
>X : Symbol(X, Decl(recursiveTypeReferences1.ts, 78, 9))
|
||||
|
||||
@@ -0,0 +1,364 @@
|
||||
=== tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeReferences1.ts ===
|
||||
type ValueOrArray<T> = T | Array<ValueOrArray<T>>;
|
||||
>ValueOrArray : ValueOrArray<T>
|
||||
|
||||
const a0: ValueOrArray<number> = 1;
|
||||
>a0 : ValueOrArray<number>
|
||||
>1 : 1
|
||||
|
||||
const a1: ValueOrArray<number> = [1, [2, 3], [4, [5, [6, 7]]]];
|
||||
>a1 : ValueOrArray<number>
|
||||
>[1, [2, 3], [4, [5, [6, 7]]]] : (number | (number | (number | number[])[])[])[]
|
||||
>1 : 1
|
||||
>[2, 3] : number[]
|
||||
>2 : 2
|
||||
>3 : 3
|
||||
>[4, [5, [6, 7]]] : (number | (number | number[])[])[]
|
||||
>4 : 4
|
||||
>[5, [6, 7]] : (number | number[])[]
|
||||
>5 : 5
|
||||
>[6, 7] : number[]
|
||||
>6 : 6
|
||||
>7 : 7
|
||||
|
||||
type HypertextNode = string | [string, { [key: string]: unknown }, ...HypertextNode[]];
|
||||
>HypertextNode : HypertextNode
|
||||
>key : string
|
||||
|
||||
const hypertextNode: HypertextNode =
|
||||
>hypertextNode : HypertextNode
|
||||
|
||||
["div", { id: "parent" },
|
||||
>["div", { id: "parent" }, ["div", { id: "first-child" }, "I'm the first child"], ["div", { id: "second-child" }, "I'm the second child"] ] : [string, { id: string; }, [string, { id: string; }, string], [string, { id: string; }, string]]
|
||||
>"div" : "div"
|
||||
>{ id: "parent" } : { id: string; }
|
||||
>id : string
|
||||
>"parent" : "parent"
|
||||
|
||||
["div", { id: "first-child" }, "I'm the first child"],
|
||||
>["div", { id: "first-child" }, "I'm the first child"] : [string, { id: string; }, string]
|
||||
>"div" : "div"
|
||||
>{ id: "first-child" } : { id: string; }
|
||||
>id : string
|
||||
>"first-child" : "first-child"
|
||||
>"I'm the first child" : "I'm the first child"
|
||||
|
||||
["div", { id: "second-child" }, "I'm the second child"]
|
||||
>["div", { id: "second-child" }, "I'm the second child"] : [string, { id: string; }, string]
|
||||
>"div" : "div"
|
||||
>{ id: "second-child" } : { id: string; }
|
||||
>id : string
|
||||
>"second-child" : "second-child"
|
||||
>"I'm the second child" : "I'm the second child"
|
||||
|
||||
];
|
||||
|
||||
type Json = string | number | boolean | null | Json[] | { [key: string]: Json };
|
||||
>Json : Json
|
||||
>null : null
|
||||
>key : string
|
||||
|
||||
let data: Json = {
|
||||
>data : Json
|
||||
>{ caption: "Test", location: { x: 10, y: 20 }, values: [true, [10, 20], null]} : { caption: string; location: { x: number; y: number; }; values: (true | number[] | null)[]; }
|
||||
|
||||
caption: "Test",
|
||||
>caption : string
|
||||
>"Test" : "Test"
|
||||
|
||||
location: { x: 10, y: 20 },
|
||||
>location : { x: number; y: number; }
|
||||
>{ x: 10, y: 20 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>10 : 10
|
||||
>y : number
|
||||
>20 : 20
|
||||
|
||||
values: [true, [10, 20], null]
|
||||
>values : (true | number[] | null)[]
|
||||
>[true, [10, 20], null] : (true | number[] | null)[]
|
||||
>true : true
|
||||
>[10, 20] : number[]
|
||||
>10 : 10
|
||||
>20 : 20
|
||||
>null : null
|
||||
|
||||
};
|
||||
|
||||
interface Box<T> { value: T };
|
||||
>value : T
|
||||
|
||||
type T1 = Box<T1>;
|
||||
>T1 : T1
|
||||
|
||||
type T2 = Box<Box<T2>>;
|
||||
>T2 : T2
|
||||
|
||||
type T3 = Box<Box<Box<T3>>>;
|
||||
>T3 : T3
|
||||
|
||||
function f1(t1: T1, t2: T2, t3: T3) {
|
||||
>f1 : (t1: T1, t2: T2, t3: T3) => void
|
||||
>t1 : T1
|
||||
>t2 : T2
|
||||
>t3 : T3
|
||||
|
||||
t1 = t2;
|
||||
>t1 = t2 : T2
|
||||
>t1 : T1
|
||||
>t2 : T2
|
||||
|
||||
t1 = t3;
|
||||
>t1 = t3 : T3
|
||||
>t1 : T1
|
||||
>t3 : T3
|
||||
|
||||
t2 = t1;
|
||||
>t2 = t1 : T1
|
||||
>t2 : T2
|
||||
>t1 : T1
|
||||
|
||||
t2 = t3;
|
||||
>t2 = t3 : T3
|
||||
>t2 : T2
|
||||
>t3 : T3
|
||||
|
||||
t3 = t1;
|
||||
>t3 = t1 : T1
|
||||
>t3 : T3
|
||||
>t1 : T1
|
||||
|
||||
t3 = t2;
|
||||
>t3 = t2 : T2
|
||||
>t3 : T3
|
||||
>t2 : T2
|
||||
}
|
||||
|
||||
type Box1 = Box<Box1> | number;
|
||||
>Box1 : Box1
|
||||
|
||||
const b10: Box1 = 42;
|
||||
>b10 : Box1
|
||||
>42 : 42
|
||||
|
||||
const b11: Box1 = { value: 42 };
|
||||
>b11 : Box1
|
||||
>{ value: 42 } : { value: number; }
|
||||
>value : number
|
||||
>42 : 42
|
||||
|
||||
const b12: Box1 = { value: { value: { value: 42 }}};
|
||||
>b12 : Box1
|
||||
>{ value: { value: { value: 42 }}} : { value: { value: { value: number; }; }; }
|
||||
>value : { value: { value: number; }; }
|
||||
>{ value: { value: 42 }} : { value: { value: number; }; }
|
||||
>value : { value: number; }
|
||||
>{ value: 42 } : { value: number; }
|
||||
>value : number
|
||||
>42 : 42
|
||||
|
||||
type Box2 = Box<Box2 | number>;
|
||||
>Box2 : Box2
|
||||
|
||||
const b20: Box2 = 42; // Error
|
||||
>b20 : Box2
|
||||
>42 : 42
|
||||
|
||||
const b21: Box2 = { value: 42 };
|
||||
>b21 : Box2
|
||||
>{ value: 42 } : { value: number; }
|
||||
>value : number
|
||||
>42 : 42
|
||||
|
||||
const b22: Box2 = { value: { value: { value: 42 }}};
|
||||
>b22 : Box2
|
||||
>{ value: { value: { value: 42 }}} : { value: { value: { value: number; }; }; }
|
||||
>value : { value: { value: number; }; }
|
||||
>{ value: { value: 42 }} : { value: { value: number; }; }
|
||||
>value : { value: number; }
|
||||
>{ value: 42 } : { value: number; }
|
||||
>value : number
|
||||
>42 : 42
|
||||
|
||||
type RecArray<T> = Array<T | RecArray<T>>;
|
||||
>RecArray : RecArray<T>
|
||||
|
||||
declare function flat<T>(a: RecArray<T>): Array<T>;
|
||||
>flat : <T>(a: RecArray<T>) => T[]
|
||||
>a : RecArray<T>
|
||||
|
||||
declare function flat1<T>(a: Array<T | Array<T>>): Array<T>
|
||||
>flat1 : <T>(a: (T | T[])[]) => T[]
|
||||
>a : (T | T[])[]
|
||||
|
||||
declare function flat2<T>(a: Array<T | Array<T | Array<T>>>): Array<T>;
|
||||
>flat2 : <T>(a: (T | (T | T[])[])[]) => T[]
|
||||
>a : (T | (T | T[])[])[]
|
||||
|
||||
flat([1, [2, [3]]]); // number[]
|
||||
>flat([1, [2, [3]]]) : number[]
|
||||
>flat : <T>(a: RecArray<T>) => T[]
|
||||
>[1, [2, [3]]] : (number | (number | number[])[])[]
|
||||
>1 : 1
|
||||
>[2, [3]] : (number | number[])[]
|
||||
>2 : 2
|
||||
>[3] : number[]
|
||||
>3 : 3
|
||||
|
||||
flat([[[0]]]); // number[]
|
||||
>flat([[[0]]]) : number[]
|
||||
>flat : <T>(a: RecArray<T>) => T[]
|
||||
>[[[0]]] : number[][][]
|
||||
>[[0]] : number[][]
|
||||
>[0] : number[]
|
||||
>0 : 0
|
||||
|
||||
flat([[[[[[[[[[[4]]]]]]]]]]]); // number[]
|
||||
>flat([[[[[[[[[[[4]]]]]]]]]]]) : number[]
|
||||
>flat : <T>(a: RecArray<T>) => T[]
|
||||
>[[[[[[[[[[[4]]]]]]]]]]] : number[][][][][][][][][][][]
|
||||
>[[[[[[[[[[4]]]]]]]]]] : number[][][][][][][][][][]
|
||||
>[[[[[[[[[4]]]]]]]]] : number[][][][][][][][][]
|
||||
>[[[[[[[[4]]]]]]]] : number[][][][][][][][]
|
||||
>[[[[[[[4]]]]]]] : number[][][][][][][]
|
||||
>[[[[[[4]]]]]] : number[][][][][][]
|
||||
>[[[[[4]]]]] : number[][][][][]
|
||||
>[[[[4]]]] : number[][][][]
|
||||
>[[[4]]] : number[][][]
|
||||
>[[4]] : number[][]
|
||||
>[4] : number[]
|
||||
>4 : 4
|
||||
|
||||
flat([1, 'a', [2]]); // (string | number)[]
|
||||
>flat([1, 'a', [2]]) : (string | number)[]
|
||||
>flat : <T>(a: RecArray<T>) => T[]
|
||||
>[1, 'a', [2]] : (string | number | number[])[]
|
||||
>1 : 1
|
||||
>'a' : "a"
|
||||
>[2] : number[]
|
||||
>2 : 2
|
||||
|
||||
flat([1, [2, 'a']]); // (string | number)[]
|
||||
>flat([1, [2, 'a']]) : (string | number)[]
|
||||
>flat : <T>(a: RecArray<T>) => T[]
|
||||
>[1, [2, 'a']] : (number | (string | number)[])[]
|
||||
>1 : 1
|
||||
>[2, 'a'] : (string | number)[]
|
||||
>2 : 2
|
||||
>'a' : "a"
|
||||
|
||||
flat([1, ['a']]); // Error
|
||||
>flat([1, ['a']]) : any
|
||||
>flat : <T>(a: RecArray<T>) => T[]
|
||||
>[1, ['a']] : (number | string[])[]
|
||||
>1 : 1
|
||||
>['a'] : string[]
|
||||
>'a' : "a"
|
||||
|
||||
flat1([1, [2, [3]]]); // (number | number[])[]
|
||||
>flat1([1, [2, [3]]]) : (number | number[])[]
|
||||
>flat1 : <T>(a: (T | T[])[]) => T[]
|
||||
>[1, [2, [3]]] : (number | (number | number[])[])[]
|
||||
>1 : 1
|
||||
>[2, [3]] : (number | number[])[]
|
||||
>2 : 2
|
||||
>[3] : number[]
|
||||
>3 : 3
|
||||
|
||||
flat1([[[0]]]); // number[][]
|
||||
>flat1([[[0]]]) : number[][]
|
||||
>flat1 : <T>(a: (T | T[])[]) => T[]
|
||||
>[[[0]]] : number[][][]
|
||||
>[[0]] : number[][]
|
||||
>[0] : number[]
|
||||
>0 : 0
|
||||
|
||||
flat1([1, 'a', [2]]); // (string | number)[]
|
||||
>flat1([1, 'a', [2]]) : (string | number)[]
|
||||
>flat1 : <T>(a: (T | T[])[]) => T[]
|
||||
>[1, 'a', [2]] : (string | number | number[])[]
|
||||
>1 : 1
|
||||
>'a' : "a"
|
||||
>[2] : number[]
|
||||
>2 : 2
|
||||
|
||||
flat1([1, [2, 'a']]); // (string | number)[]
|
||||
>flat1([1, [2, 'a']]) : (string | number)[]
|
||||
>flat1 : <T>(a: (T | T[])[]) => T[]
|
||||
>[1, [2, 'a']] : (number | (string | number)[])[]
|
||||
>1 : 1
|
||||
>[2, 'a'] : (string | number)[]
|
||||
>2 : 2
|
||||
>'a' : "a"
|
||||
|
||||
flat1([1, ['a']]); // Error
|
||||
>flat1([1, ['a']]) : any
|
||||
>flat1 : <T>(a: (T | T[])[]) => T[]
|
||||
>[1, ['a']] : (number | string[])[]
|
||||
>1 : 1
|
||||
>['a'] : string[]
|
||||
>'a' : "a"
|
||||
|
||||
flat2([1, [2, [3]]]); // number[]
|
||||
>flat2([1, [2, [3]]]) : number[]
|
||||
>flat2 : <T>(a: (T | (T | T[])[])[]) => T[]
|
||||
>[1, [2, [3]]] : (number | (number | number[])[])[]
|
||||
>1 : 1
|
||||
>[2, [3]] : (number | number[])[]
|
||||
>2 : 2
|
||||
>[3] : number[]
|
||||
>3 : 3
|
||||
|
||||
flat2([[[0]]]); // number[]
|
||||
>flat2([[[0]]]) : number[]
|
||||
>flat2 : <T>(a: (T | (T | T[])[])[]) => T[]
|
||||
>[[[0]]] : number[][][]
|
||||
>[[0]] : number[][]
|
||||
>[0] : number[]
|
||||
>0 : 0
|
||||
|
||||
flat2([1, 'a', [2]]); // (string | number)[]
|
||||
>flat2([1, 'a', [2]]) : (string | number)[]
|
||||
>flat2 : <T>(a: (T | (T | T[])[])[]) => T[]
|
||||
>[1, 'a', [2]] : (string | number | number[])[]
|
||||
>1 : 1
|
||||
>'a' : "a"
|
||||
>[2] : number[]
|
||||
>2 : 2
|
||||
|
||||
flat2([1, [2, 'a']]); // (string | number)[]
|
||||
>flat2([1, [2, 'a']]) : (string | number)[]
|
||||
>flat2 : <T>(a: (T | (T | T[])[])[]) => T[]
|
||||
>[1, [2, 'a']] : (number | (string | number)[])[]
|
||||
>1 : 1
|
||||
>[2, 'a'] : (string | number)[]
|
||||
>2 : 2
|
||||
>'a' : "a"
|
||||
|
||||
flat2([1, ['a']]); // Error
|
||||
>flat2([1, ['a']]) : any
|
||||
>flat2 : <T>(a: (T | (T | T[])[])[]) => T[]
|
||||
>[1, ['a']] : (number | string[])[]
|
||||
>1 : 1
|
||||
>['a'] : string[]
|
||||
>'a' : "a"
|
||||
|
||||
type T10 = T10[];
|
||||
>T10 : T10
|
||||
|
||||
type T11 = readonly T11[];
|
||||
>T11 : readonly (readonly (readonly (readonly (readonly (readonly (readonly (readonly (readonly (readonly (readonly any[])[])[])[])[])[])[])[])[])[])[]
|
||||
|
||||
type T12 = (T12)[];
|
||||
>T12 : T12
|
||||
|
||||
type T13 = T13[] | string;
|
||||
>T13 : T13
|
||||
|
||||
type T14 = T14[] & { x: string };
|
||||
>T14 : T14
|
||||
>x : string
|
||||
|
||||
type T15<X> = X extends string ? T15<X>[] : never;
|
||||
>T15 : T15<X>
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
=== tests/cases/conformance/types/tuple/restTupleElements1.ts ===
|
||||
type T00 = [string?];
|
||||
>T00 : [(string | undefined)?]
|
||||
>T00 : T00
|
||||
|
||||
type T01 = [string, string?];
|
||||
>T01 : [string, (string | undefined)?]
|
||||
>T01 : T01
|
||||
|
||||
type T02 = [string?, string]; // Error
|
||||
>T02 : [string | undefined, string]
|
||||
>T02 : T02
|
||||
|
||||
type T03 = [...string[]];
|
||||
>T03 : string[]
|
||||
>T03 : T03
|
||||
|
||||
type T04 = [...[...string[]]];
|
||||
>T04 : string[]
|
||||
>T04 : T04
|
||||
|
||||
type T05 = [...[...[...string[]]]];
|
||||
>T05 : string[]
|
||||
>T05 : T05
|
||||
|
||||
type T06 = [string, ...string[]];
|
||||
>T06 : [string, ...string[]]
|
||||
>T06 : T06
|
||||
|
||||
type T07 = [...string[], string]; // Error
|
||||
>T07 : [string[], string]
|
||||
>T07 : T07
|
||||
|
||||
type T08 = [...string]; // Error
|
||||
>T08 : string[]
|
||||
>T08 : T08
|
||||
|
||||
type T09 = [...string?]; // Error
|
||||
>T09 : (string | null)[]
|
||||
>T09 : T09
|
||||
|
||||
type T10 = [string, ...[...string[]]];
|
||||
>T10 : [string, ...string[]]
|
||||
>T10 : T10
|
||||
|
||||
type T11 = [string, ...[...[...string[]]]];
|
||||
>T11 : [string, ...string[]]
|
||||
>T11 : T11
|
||||
|
||||
type T15 = [boolean, number, ...string[]];
|
||||
>T15 : [boolean, number, ...string[]]
|
||||
>T15 : T15
|
||||
|
||||
type L15 = T15["length"]; // number
|
||||
>L15 : number
|
||||
@@ -101,7 +101,7 @@ assign<[number, ...number[]], [number, number, number, string]>(); // Error
|
||||
>assign : <T, S extends T>() => void
|
||||
|
||||
type T20 = [number, string, ...boolean[]];
|
||||
>T20 : [number, string, ...boolean[]]
|
||||
>T20 : T20
|
||||
|
||||
type T21 = T20[0];
|
||||
>T21 : number
|
||||
@@ -128,7 +128,7 @@ type T28 = T20[number];
|
||||
>T28 : string | number | boolean
|
||||
|
||||
declare const t: T20;
|
||||
>t : [number, string, ...boolean[]]
|
||||
>t : T20
|
||||
|
||||
declare const x: number;
|
||||
>x : number
|
||||
@@ -136,31 +136,31 @@ declare const x: number;
|
||||
let e0 = t[0]; // number
|
||||
>e0 : number
|
||||
>t[0] : number
|
||||
>t : [number, string, ...boolean[]]
|
||||
>t : T20
|
||||
>0 : 0
|
||||
|
||||
let e1 = t[1]; // string
|
||||
>e1 : string
|
||||
>t[1] : string
|
||||
>t : [number, string, ...boolean[]]
|
||||
>t : T20
|
||||
>1 : 1
|
||||
|
||||
let e2 = t[2]; // boolean
|
||||
>e2 : boolean
|
||||
>t[2] : boolean
|
||||
>t : [number, string, ...boolean[]]
|
||||
>t : T20
|
||||
>2 : 2
|
||||
|
||||
let e3 = t[3]; // boolean
|
||||
>e3 : boolean
|
||||
>t[3] : boolean
|
||||
>t : [number, string, ...boolean[]]
|
||||
>t : T20
|
||||
>3 : 3
|
||||
|
||||
let ex = t[x]; // number | string | boolean
|
||||
>ex : string | number | boolean
|
||||
>t[x] : string | number | boolean
|
||||
>t : [number, string, ...boolean[]]
|
||||
>t : T20
|
||||
>x : number
|
||||
|
||||
declare function f0<T, U>(x: [T, ...U[]]): [T, U];
|
||||
|
||||
+33
-33
@@ -7,27 +7,27 @@ declare var console: {
|
||||
>msg : any
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
>Robot : [number, string, string]
|
||||
>Robot : Robot
|
||||
|
||||
type MultiSkilledRobot = [string, [string, string]];
|
||||
>MultiSkilledRobot : [string, [string, string]]
|
||||
>MultiSkilledRobot : MultiSkilledRobot
|
||||
|
||||
let robotA: Robot = [1, "mower", "mowing"];
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>[1, "mower", "mowing"] : [number, string, string]
|
||||
>1 : 1
|
||||
>"mower" : "mower"
|
||||
>"mowing" : "mowing"
|
||||
|
||||
function getRobot() {
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot : () => Robot
|
||||
|
||||
return robotA;
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
}
|
||||
|
||||
let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>["mower", ["mowing", ""]] : [string, [string, string]]
|
||||
>"mower" : "mower"
|
||||
>["mowing", ""] : [string, string]
|
||||
@@ -35,7 +35,7 @@ let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>"" : ""
|
||||
|
||||
let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
>["trimmer", ["trimming", "edging"]] : [string, [string, string]]
|
||||
>"trimmer" : "trimmer"
|
||||
>["trimming", "edging"] : [string, string]
|
||||
@@ -43,16 +43,16 @@ let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>"edging" : "edging"
|
||||
|
||||
function getMultiRobot() {
|
||||
>getMultiRobot : () => [string, [string, string]]
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
|
||||
return multiRobotA;
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
}
|
||||
|
||||
for (let [, nameA] = robotA, i = 0; i < 1; i++) {
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -71,8 +71,8 @@ for (let [, nameA] = robotA, i = 0; i < 1; i++) {
|
||||
for (let [, nameA] = getRobot(), i = 0; i < 1; i++) {
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>getRobot() : [number, string, string]
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot() : Robot
|
||||
>getRobot : () => Robot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -114,7 +114,7 @@ for (let [, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++)
|
||||
> : undefined
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -134,8 +134,8 @@ for (let [, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i
|
||||
> : undefined
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>getMultiRobot() : [string, [string, string]]
|
||||
>getMultiRobot : () => [string, [string, string]]
|
||||
>getMultiRobot() : MultiSkilledRobot
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -178,7 +178,7 @@ for (let [, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging
|
||||
|
||||
for (let [numberB] = robotA, i = 0; i < 1; i++) {
|
||||
>numberB : number
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -196,8 +196,8 @@ for (let [numberB] = robotA, i = 0; i < 1; i++) {
|
||||
}
|
||||
for (let [numberB] = getRobot(), i = 0; i < 1; i++) {
|
||||
>numberB : number
|
||||
>getRobot() : [number, string, string]
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot() : Robot
|
||||
>getRobot : () => Robot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -236,7 +236,7 @@ for (let [numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) {
|
||||
}
|
||||
for (let [nameB] = multiRobotA, i = 0; i < 1; i++) {
|
||||
>nameB : string
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -254,8 +254,8 @@ for (let [nameB] = multiRobotA, i = 0; i < 1; i++) {
|
||||
}
|
||||
for (let [nameB] = getMultiRobot(), i = 0; i < 1; i++) {
|
||||
>nameB : string
|
||||
>getMultiRobot() : [string, [string, string]]
|
||||
>getMultiRobot : () => [string, [string, string]]
|
||||
>getMultiRobot() : MultiSkilledRobot
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -298,7 +298,7 @@ for (let [numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) {
|
||||
>numberA2 : number
|
||||
>nameA2 : string
|
||||
>skillA2 : string
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -318,8 +318,8 @@ for (let [numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) {
|
||||
>numberA2 : number
|
||||
>nameA2 : string
|
||||
>skillA2 : string
|
||||
>getRobot() : [number, string, string]
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot() : Robot
|
||||
>getRobot : () => Robot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -362,7 +362,7 @@ for (let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1;
|
||||
>nameMA : string
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -382,8 +382,8 @@ for (let [nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i
|
||||
>nameMA : string
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>getMultiRobot() : [string, [string, string]]
|
||||
>getMultiRobot : () => [string, [string, string]]
|
||||
>getMultiRobot() : MultiSkilledRobot
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -427,7 +427,7 @@ for (let [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "
|
||||
for (let [numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) {
|
||||
>numberA3 : number
|
||||
>robotAInfo : [string, string]
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -446,8 +446,8 @@ for (let [numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) {
|
||||
for (let [numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) {
|
||||
>numberA3 : number
|
||||
>robotAInfo : [string, string]
|
||||
>getRobot() : [number, string, string]
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot() : Robot
|
||||
>getRobot : () => Robot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -487,7 +487,7 @@ for (let [numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i
|
||||
}
|
||||
for (let [...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) {
|
||||
>multiRobotAInfo : [string, [string, string]]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -505,8 +505,8 @@ for (let [...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) {
|
||||
}
|
||||
for (let [...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) {
|
||||
>multiRobotAInfo : [string, [string, string]]
|
||||
>getMultiRobot() : [string, [string, string]]
|
||||
>getMultiRobot : () => [string, [string, string]]
|
||||
>getMultiRobot() : MultiSkilledRobot
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
|
||||
+53
-53
@@ -7,27 +7,27 @@ declare var console: {
|
||||
>msg : any
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
>Robot : [number, string, string]
|
||||
>Robot : Robot
|
||||
|
||||
type MultiSkilledRobot = [string, [string, string]];
|
||||
>MultiSkilledRobot : [string, [string, string]]
|
||||
>MultiSkilledRobot : MultiSkilledRobot
|
||||
|
||||
let robotA: Robot = [1, "mower", "mowing"];
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>[1, "mower", "mowing"] : [number, string, string]
|
||||
>1 : 1
|
||||
>"mower" : "mower"
|
||||
>"mowing" : "mowing"
|
||||
|
||||
function getRobot() {
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot : () => Robot
|
||||
|
||||
return robotA;
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
}
|
||||
|
||||
let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>["mower", ["mowing", ""]] : [string, [string, string]]
|
||||
>"mower" : "mower"
|
||||
>["mowing", ""] : [string, string]
|
||||
@@ -35,7 +35,7 @@ let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>"" : ""
|
||||
|
||||
let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
>["trimmer", ["trimming", "edging"]] : [string, [string, string]]
|
||||
>"trimmer" : "trimmer"
|
||||
>["trimming", "edging"] : [string, string]
|
||||
@@ -43,10 +43,10 @@ let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>"edging" : "edging"
|
||||
|
||||
function getMultiRobot() {
|
||||
>getMultiRobot : () => [string, [string, string]]
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
|
||||
return multiRobotA;
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
}
|
||||
|
||||
let nameA: string, primarySkillA: string, secondarySkillA: string;
|
||||
@@ -74,11 +74,11 @@ let i: number;
|
||||
|
||||
for ([, nameA] = robotA, i = 0; i < 1; i++) {
|
||||
>[, nameA] = robotA, i = 0 : 0
|
||||
>[, nameA] = robotA : [number, string, string]
|
||||
>[, nameA] = robotA : Robot
|
||||
>[, nameA] : [undefined, string]
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -97,12 +97,12 @@ for ([, nameA] = robotA, i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([, nameA] = getRobot(), i = 0; i < 1; i++) {
|
||||
>[, nameA] = getRobot(), i = 0 : 0
|
||||
>[, nameA] = getRobot() : [number, string, string]
|
||||
>[, nameA] = getRobot() : Robot
|
||||
>[, nameA] : [undefined, string]
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>getRobot() : [number, string, string]
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot() : Robot
|
||||
>getRobot : () => Robot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -147,13 +147,13 @@ for ([, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) {
|
||||
>[, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0 : 0
|
||||
>[, [primarySkillA, secondarySkillA]] = multiRobotA : [string, [string, string]]
|
||||
>[, [primarySkillA, secondarySkillA]] = multiRobotA : MultiSkilledRobot
|
||||
>[, [primarySkillA, secondarySkillA]] : [undefined, [string, string]]
|
||||
> : undefined
|
||||
>[primarySkillA, secondarySkillA] : [string, string]
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -172,14 +172,14 @@ for ([, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) {
|
||||
>[, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0 : 0
|
||||
>[, [primarySkillA, secondarySkillA]] = getMultiRobot() : [string, [string, string]]
|
||||
>[, [primarySkillA, secondarySkillA]] = getMultiRobot() : MultiSkilledRobot
|
||||
>[, [primarySkillA, secondarySkillA]] : [undefined, [string, string]]
|
||||
> : undefined
|
||||
>[primarySkillA, secondarySkillA] : [string, string]
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>getMultiRobot() : [string, [string, string]]
|
||||
>getMultiRobot : () => [string, [string, string]]
|
||||
>getMultiRobot() : MultiSkilledRobot
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -228,10 +228,10 @@ for ([, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]],
|
||||
|
||||
for ([numberB] = robotA, i = 0; i < 1; i++) {
|
||||
>[numberB] = robotA, i = 0 : 0
|
||||
>[numberB] = robotA : [number, string, string]
|
||||
>[numberB] = robotA : Robot
|
||||
>[numberB] : [number]
|
||||
>numberB : number
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -250,11 +250,11 @@ for ([numberB] = robotA, i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([numberB] = getRobot(), i = 0; i < 1; i++) {
|
||||
>[numberB] = getRobot(), i = 0 : 0
|
||||
>[numberB] = getRobot() : [number, string, string]
|
||||
>[numberB] = getRobot() : Robot
|
||||
>[numberB] : [number]
|
||||
>numberB : number
|
||||
>getRobot() : [number, string, string]
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot() : Robot
|
||||
>getRobot : () => Robot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -298,10 +298,10 @@ for ([numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([nameB] = multiRobotA, i = 0; i < 1; i++) {
|
||||
>[nameB] = multiRobotA, i = 0 : 0
|
||||
>[nameB] = multiRobotA : [string, [string, string]]
|
||||
>[nameB] = multiRobotA : MultiSkilledRobot
|
||||
>[nameB] : [string]
|
||||
>nameB : string
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -320,11 +320,11 @@ for ([nameB] = multiRobotA, i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([nameB] = getMultiRobot(), i = 0; i < 1; i++) {
|
||||
>[nameB] = getMultiRobot(), i = 0 : 0
|
||||
>[nameB] = getMultiRobot() : [string, [string, string]]
|
||||
>[nameB] = getMultiRobot() : MultiSkilledRobot
|
||||
>[nameB] : [string]
|
||||
>nameB : string
|
||||
>getMultiRobot() : [string, [string, string]]
|
||||
>getMultiRobot : () => [string, [string, string]]
|
||||
>getMultiRobot() : MultiSkilledRobot
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -370,12 +370,12 @@ for ([nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) {
|
||||
|
||||
for ([numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) {
|
||||
>[numberA2, nameA2, skillA2] = robotA, i = 0 : 0
|
||||
>[numberA2, nameA2, skillA2] = robotA : [number, string, string]
|
||||
>[numberA2, nameA2, skillA2] = robotA : Robot
|
||||
>[numberA2, nameA2, skillA2] : [number, string, string]
|
||||
>numberA2 : number
|
||||
>nameA2 : string
|
||||
>skillA2 : string
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -394,13 +394,13 @@ for ([numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) {
|
||||
>[numberA2, nameA2, skillA2] = getRobot(), i = 0 : 0
|
||||
>[numberA2, nameA2, skillA2] = getRobot() : [number, string, string]
|
||||
>[numberA2, nameA2, skillA2] = getRobot() : Robot
|
||||
>[numberA2, nameA2, skillA2] : [number, string, string]
|
||||
>numberA2 : number
|
||||
>nameA2 : string
|
||||
>skillA2 : string
|
||||
>getRobot() : [number, string, string]
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot() : Robot
|
||||
>getRobot : () => Robot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -446,13 +446,13 @@ for ([numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++
|
||||
}
|
||||
for ([nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) {
|
||||
>[nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0 : 0
|
||||
>[nameMA, [primarySkillA, secondarySkillA]] = multiRobotA : [string, [string, string]]
|
||||
>[nameMA, [primarySkillA, secondarySkillA]] = multiRobotA : MultiSkilledRobot
|
||||
>[nameMA, [primarySkillA, secondarySkillA]] : [string, [string, string]]
|
||||
>nameMA : string
|
||||
>[primarySkillA, secondarySkillA] : [string, string]
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -471,14 +471,14 @@ for ([nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++
|
||||
}
|
||||
for ([nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) {
|
||||
>[nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0 : 0
|
||||
>[nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot() : [string, [string, string]]
|
||||
>[nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot() : MultiSkilledRobot
|
||||
>[nameMA, [primarySkillA, secondarySkillA]] : [string, [string, string]]
|
||||
>nameMA : string
|
||||
>[primarySkillA, secondarySkillA] : [string, string]
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>getMultiRobot() : [string, [string, string]]
|
||||
>getMultiRobot : () => [string, [string, string]]
|
||||
>getMultiRobot() : MultiSkilledRobot
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -527,12 +527,12 @@ for ([nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edgi
|
||||
|
||||
for ([numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) {
|
||||
>[numberA3, ...robotAInfo] = robotA, i = 0 : 0
|
||||
>[numberA3, ...robotAInfo] = robotA : [number, string, string]
|
||||
>[numberA3, ...robotAInfo] = robotA : Robot
|
||||
>[numberA3, ...robotAInfo] : [number, ...(string | number)[]]
|
||||
>numberA3 : number
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -551,13 +551,13 @@ for ([numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) {
|
||||
>[numberA3, ...robotAInfo] = getRobot(), i = 0 : 0
|
||||
>[numberA3, ...robotAInfo] = getRobot() : [number, string, string]
|
||||
>[numberA3, ...robotAInfo] = getRobot() : Robot
|
||||
>[numberA3, ...robotAInfo] : [number, ...(string | number)[]]
|
||||
>numberA3 : number
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
>getRobot() : [number, string, string]
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot() : Robot
|
||||
>getRobot : () => Robot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -576,12 +576,12 @@ for ([numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([numberA3, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"], i = 0; i < 1; i++) {
|
||||
>[numberA3, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"], i = 0 : 0
|
||||
>[numberA3, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>[numberA3, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"] : Robot
|
||||
>[numberA3, ...robotAInfo] : [number, ...(string | number)[]]
|
||||
>numberA3 : number
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
><Robot>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
><Robot>[2, "trimmer", "trimming"] : Robot
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
@@ -604,11 +604,11 @@ for ([numberA3, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"], i = 0; i < 1
|
||||
}
|
||||
for ([...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) {
|
||||
>[...multiRobotAInfo] = multiRobotA, i = 0 : 0
|
||||
>[...multiRobotAInfo] = multiRobotA : [string, [string, string]]
|
||||
>[...multiRobotAInfo] = multiRobotA : MultiSkilledRobot
|
||||
>[...multiRobotAInfo] : (string | [string, string])[]
|
||||
>...multiRobotAInfo : string | [string, string]
|
||||
>multiRobotAInfo : (string | [string, string])[]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -627,12 +627,12 @@ for ([...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) {
|
||||
>[...multiRobotAInfo] = getMultiRobot(), i = 0 : 0
|
||||
>[...multiRobotAInfo] = getMultiRobot() : [string, [string, string]]
|
||||
>[...multiRobotAInfo] = getMultiRobot() : MultiSkilledRobot
|
||||
>[...multiRobotAInfo] : (string | [string, string])[]
|
||||
>...multiRobotAInfo : string | [string, string]
|
||||
>multiRobotAInfo : (string | [string, string])[]
|
||||
>getMultiRobot() : [string, [string, string]]
|
||||
>getMultiRobot : () => [string, [string, string]]
|
||||
>getMultiRobot() : MultiSkilledRobot
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -651,11 +651,11 @@ for ([...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([...multiRobotAInfo] = <MultiSkilledRobot>["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) {
|
||||
>[...multiRobotAInfo] = <MultiSkilledRobot>["trimmer", ["trimming", "edging"]], i = 0 : 0
|
||||
>[...multiRobotAInfo] = <MultiSkilledRobot>["trimmer", ["trimming", "edging"]] : [string, [string, string]]
|
||||
>[...multiRobotAInfo] = <MultiSkilledRobot>["trimmer", ["trimming", "edging"]] : MultiSkilledRobot
|
||||
>[...multiRobotAInfo] : (string | [string, string])[]
|
||||
>...multiRobotAInfo : string | [string, string]
|
||||
>multiRobotAInfo : (string | [string, string])[]
|
||||
><MultiSkilledRobot>["trimmer", ["trimming", "edging"]] : [string, [string, string]]
|
||||
><MultiSkilledRobot>["trimmer", ["trimming", "edging"]] : MultiSkilledRobot
|
||||
>["trimmer", ["trimming", "edging"]] : [string, [string, string]]
|
||||
>"trimmer" : "trimmer"
|
||||
>["trimming", "edging"] : [string, string]
|
||||
|
||||
+30
-30
@@ -7,27 +7,27 @@ declare var console: {
|
||||
>msg : any
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
>Robot : [number, string, string]
|
||||
>Robot : Robot
|
||||
|
||||
type MultiSkilledRobot = [string, string[]];
|
||||
>MultiSkilledRobot : [string, string[]]
|
||||
>MultiSkilledRobot : MultiSkilledRobot
|
||||
|
||||
let robotA: Robot = [1, "mower", "mowing"];
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>[1, "mower", "mowing"] : [number, string, string]
|
||||
>1 : 1
|
||||
>"mower" : "mower"
|
||||
>"mowing" : "mowing"
|
||||
|
||||
function getRobot() {
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot : () => Robot
|
||||
|
||||
return robotA;
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
}
|
||||
|
||||
let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>multiRobotA : [string, string[]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>["mower", ["mowing", ""]] : [string, string[]]
|
||||
>"mower" : "mower"
|
||||
>["mowing", ""] : string[]
|
||||
@@ -35,7 +35,7 @@ let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>"" : ""
|
||||
|
||||
let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>multiRobotB : [string, string[]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
>["trimmer", ["trimming", "edging"]] : [string, string[]]
|
||||
>"trimmer" : "trimmer"
|
||||
>["trimming", "edging"] : string[]
|
||||
@@ -43,17 +43,17 @@ let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>"edging" : "edging"
|
||||
|
||||
function getMultiRobot() {
|
||||
>getMultiRobot : () => [string, string[]]
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
|
||||
return multiRobotA;
|
||||
>multiRobotA : [string, string[]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
}
|
||||
|
||||
for (let [, nameA ="name"] = robotA, i = 0; i < 1; i++) {
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>"name" : "name"
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -73,8 +73,8 @@ for (let [, nameA = "name"] = getRobot(), i = 0; i < 1; i++) {
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>"name" : "name"
|
||||
>getRobot() : [number, string, string]
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot() : Robot
|
||||
>getRobot : () => Robot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -128,7 +128,7 @@ for (let [, [
|
||||
>["none", "none"] : [string, string]
|
||||
>"none" : "none"
|
||||
>"none" : "none"
|
||||
>multiRobotA : [string, string[]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -159,8 +159,8 @@ for (let [, [
|
||||
>["none", "none"] : [string, string]
|
||||
>"none" : "none"
|
||||
>"none" : "none"
|
||||
>getMultiRobot() : [string, string[]]
|
||||
>getMultiRobot : () => [string, string[]]
|
||||
>getMultiRobot() : MultiSkilledRobot
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -216,7 +216,7 @@ for (let [numberB = -1] = robotA, i = 0; i < 1; i++) {
|
||||
>numberB : number
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -236,8 +236,8 @@ for (let [numberB = -1] = getRobot(), i = 0; i < 1; i++) {
|
||||
>numberB : number
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>getRobot() : [number, string, string]
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot() : Robot
|
||||
>getRobot : () => Robot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -279,7 +279,7 @@ for (let [numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) {
|
||||
for (let [nameB = "name"] = multiRobotA, i = 0; i < 1; i++) {
|
||||
>nameB : string
|
||||
>"name" : "name"
|
||||
>multiRobotA : [string, string[]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -298,8 +298,8 @@ for (let [nameB = "name"] = multiRobotA, i = 0; i < 1; i++) {
|
||||
for (let [nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) {
|
||||
>nameB : string
|
||||
>"name" : "name"
|
||||
>getMultiRobot() : [string, string[]]
|
||||
>getMultiRobot : () => [string, string[]]
|
||||
>getMultiRobot() : MultiSkilledRobot
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -347,7 +347,7 @@ for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i
|
||||
>"name" : "name"
|
||||
>skillA2 : string
|
||||
>"skill" : "skill"
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -371,8 +371,8 @@ for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0
|
||||
>"name" : "name"
|
||||
>skillA2 : string
|
||||
>"skill" : "skill"
|
||||
>getRobot() : [number, string, string]
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot() : Robot
|
||||
>getRobot : () => Robot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -435,7 +435,7 @@ for (let
|
||||
>"none" : "none"
|
||||
|
||||
] = multiRobotA, i = 0; i < 1; i++) {
|
||||
>multiRobotA : [string, string[]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -470,8 +470,8 @@ for (let [nameMA = "noName",
|
||||
>"none" : "none"
|
||||
|
||||
] = getMultiRobot(), i = 0; i < 1; i++) {
|
||||
>getMultiRobot() : [string, string[]]
|
||||
>getMultiRobot : () => [string, string[]]
|
||||
>getMultiRobot() : MultiSkilledRobot
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -532,7 +532,7 @@ for (let [numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) {
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>robotAInfo : [string, string]
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -553,8 +553,8 @@ for (let [numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) {
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>robotAInfo : [string, string]
|
||||
>getRobot() : [number, string, string]
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot() : Robot
|
||||
>getRobot : () => Robot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
|
||||
+45
-45
@@ -7,27 +7,27 @@ declare var console: {
|
||||
>msg : any
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
>Robot : [number, string, string]
|
||||
>Robot : Robot
|
||||
|
||||
type MultiSkilledRobot = [string, [string, string]];
|
||||
>MultiSkilledRobot : [string, [string, string]]
|
||||
>MultiSkilledRobot : MultiSkilledRobot
|
||||
|
||||
let robotA: Robot = [1, "mower", "mowing"];
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>[1, "mower", "mowing"] : [number, string, string]
|
||||
>1 : 1
|
||||
>"mower" : "mower"
|
||||
>"mowing" : "mowing"
|
||||
|
||||
function getRobot() {
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot : () => Robot
|
||||
|
||||
return robotA;
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
}
|
||||
|
||||
let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>["mower", ["mowing", ""]] : [string, [string, string]]
|
||||
>"mower" : "mower"
|
||||
>["mowing", ""] : [string, string]
|
||||
@@ -35,7 +35,7 @@ let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>"" : ""
|
||||
|
||||
let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
>["trimmer", ["trimming", "edging"]] : [string, [string, string]]
|
||||
>"trimmer" : "trimmer"
|
||||
>["trimming", "edging"] : [string, string]
|
||||
@@ -43,10 +43,10 @@ let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>"edging" : "edging"
|
||||
|
||||
function getMultiRobot() {
|
||||
>getMultiRobot : () => [string, [string, string]]
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
|
||||
return multiRobotA;
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
}
|
||||
|
||||
let nameA: string, primarySkillA: string, secondarySkillA: string;
|
||||
@@ -74,13 +74,13 @@ let i: number;
|
||||
|
||||
for ([, nameA = "name"] = robotA, i = 0; i < 1; i++) {
|
||||
>[, nameA = "name"] = robotA, i = 0 : 0
|
||||
>[, nameA = "name"] = robotA : [number, string, string]
|
||||
>[, nameA = "name"] = robotA : Robot
|
||||
>[, nameA = "name"] : [undefined, string]
|
||||
> : undefined
|
||||
>nameA = "name" : "name"
|
||||
>nameA : string
|
||||
>"name" : "name"
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -99,14 +99,14 @@ for ([, nameA = "name"] = robotA, i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([, nameA = "name"] = getRobot(), i = 0; i < 1; i++) {
|
||||
>[, nameA = "name"] = getRobot(), i = 0 : 0
|
||||
>[, nameA = "name"] = getRobot() : [number, string, string]
|
||||
>[, nameA = "name"] = getRobot() : Robot
|
||||
>[, nameA = "name"] : [undefined, string]
|
||||
> : undefined
|
||||
>nameA = "name" : "name"
|
||||
>nameA : string
|
||||
>"name" : "name"
|
||||
>getRobot() : [number, string, string]
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot() : Robot
|
||||
>getRobot : () => Robot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -153,7 +153,7 @@ for ([, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([, [
|
||||
>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"]] = multiRobotA, i = 0 : 0
|
||||
>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"]] = multiRobotA : [string, [string, string]]
|
||||
>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"]] = multiRobotA : MultiSkilledRobot
|
||||
>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"]] : [undefined, [string, string]]
|
||||
> : undefined
|
||||
>[ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"] : [string, string]
|
||||
@@ -173,7 +173,7 @@ for ([, [
|
||||
>["none", "none"] : [string, string]
|
||||
>"none" : "none"
|
||||
>"none" : "none"
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -192,7 +192,7 @@ for ([, [
|
||||
}
|
||||
for ([, [
|
||||
>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"]] = getMultiRobot(), i = 0 : 0
|
||||
>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"]] = getMultiRobot() : [string, [string, string]]
|
||||
>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"]] = getMultiRobot() : MultiSkilledRobot
|
||||
>[, [ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"]] : [undefined, [string, string]]
|
||||
> : undefined
|
||||
>[ primarySkillA = "primary", secondarySkillA = "secondary"] = ["none", "none"] : [string, string]
|
||||
@@ -212,8 +212,8 @@ for ([, [
|
||||
>["none", "none"] : [string, string]
|
||||
>"none" : "none"
|
||||
>"none" : "none"
|
||||
>getMultiRobot() : [string, [string, string]]
|
||||
>getMultiRobot : () => [string, [string, string]]
|
||||
>getMultiRobot() : MultiSkilledRobot
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -276,13 +276,13 @@ for ([, [
|
||||
|
||||
for ([numberB = -1] = robotA, i = 0; i < 1; i++) {
|
||||
>[numberB = -1] = robotA, i = 0 : 0
|
||||
>[numberB = -1] = robotA : [number, string, string]
|
||||
>[numberB = -1] = robotA : Robot
|
||||
>[numberB = -1] : [number]
|
||||
>numberB = -1 : -1
|
||||
>numberB : number
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -301,14 +301,14 @@ for ([numberB = -1] = robotA, i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([numberB = -1] = getRobot(), i = 0; i < 1; i++) {
|
||||
>[numberB = -1] = getRobot(), i = 0 : 0
|
||||
>[numberB = -1] = getRobot() : [number, string, string]
|
||||
>[numberB = -1] = getRobot() : Robot
|
||||
>[numberB = -1] : [number]
|
||||
>numberB = -1 : -1
|
||||
>numberB : number
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>getRobot() : [number, string, string]
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot() : Robot
|
||||
>getRobot : () => Robot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -355,12 +355,12 @@ for ([numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([nameB = "name"] = multiRobotA, i = 0; i < 1; i++) {
|
||||
>[nameB = "name"] = multiRobotA, i = 0 : 0
|
||||
>[nameB = "name"] = multiRobotA : [string, [string, string]]
|
||||
>[nameB = "name"] = multiRobotA : MultiSkilledRobot
|
||||
>[nameB = "name"] : [string]
|
||||
>nameB = "name" : "name"
|
||||
>nameB : string
|
||||
>"name" : "name"
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -379,13 +379,13 @@ for ([nameB = "name"] = multiRobotA, i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) {
|
||||
>[nameB = "name"] = getMultiRobot(), i = 0 : 0
|
||||
>[nameB = "name"] = getMultiRobot() : [string, [string, string]]
|
||||
>[nameB = "name"] = getMultiRobot() : MultiSkilledRobot
|
||||
>[nameB = "name"] : [string]
|
||||
>nameB = "name" : "name"
|
||||
>nameB : string
|
||||
>"name" : "name"
|
||||
>getMultiRobot() : [string, [string, string]]
|
||||
>getMultiRobot : () => [string, [string, string]]
|
||||
>getMultiRobot() : MultiSkilledRobot
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -433,7 +433,7 @@ for ([nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++)
|
||||
|
||||
for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) {
|
||||
>[numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0 : 0
|
||||
>[numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA : [number, string, string]
|
||||
>[numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA : Robot
|
||||
>[numberA2 = -1, nameA2 = "name", skillA2 = "skill"] : [number, string, string]
|
||||
>numberA2 = -1 : -1
|
||||
>numberA2 : number
|
||||
@@ -445,7 +445,7 @@ for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1;
|
||||
>skillA2 = "skill" : "skill"
|
||||
>skillA2 : string
|
||||
>"skill" : "skill"
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -464,7 +464,7 @@ for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1;
|
||||
}
|
||||
for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) {
|
||||
>[numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0 : 0
|
||||
>[numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot() : [number, string, string]
|
||||
>[numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot() : Robot
|
||||
>[numberA2 = -1, nameA2 = "name", skillA2 = "skill"] : [number, string, string]
|
||||
>numberA2 = -1 : -1
|
||||
>numberA2 : number
|
||||
@@ -476,8 +476,8 @@ for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i
|
||||
>skillA2 = "skill" : "skill"
|
||||
>skillA2 : string
|
||||
>"skill" : "skill"
|
||||
>getRobot() : [number, string, string]
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot() : Robot
|
||||
>getRobot : () => Robot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -548,7 +548,7 @@ for (let
|
||||
>"none" : "none"
|
||||
|
||||
] = multiRobotA, i = 0; i < 1; i++) {
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < 1 : boolean
|
||||
@@ -566,7 +566,7 @@ for (let
|
||||
}
|
||||
for ([nameMA = "noName",
|
||||
>[nameMA = "noName", [ primarySkillA = "primary", secondarySkillA = "secondary" ] = ["none", "none"]] = getMultiRobot(), i = 0 : 0
|
||||
>[nameMA = "noName", [ primarySkillA = "primary", secondarySkillA = "secondary" ] = ["none", "none"]] = getMultiRobot() : [string, [string, string]]
|
||||
>[nameMA = "noName", [ primarySkillA = "primary", secondarySkillA = "secondary" ] = ["none", "none"]] = getMultiRobot() : MultiSkilledRobot
|
||||
>[nameMA = "noName", [ primarySkillA = "primary", secondarySkillA = "secondary" ] = ["none", "none"]] : [string, [string, string]]
|
||||
>nameMA = "noName" : "noName"
|
||||
>nameMA : string
|
||||
@@ -592,8 +592,8 @@ for ([nameMA = "noName",
|
||||
>"none" : "none"
|
||||
|
||||
] = getMultiRobot(), i = 0; i < 1; i++) {
|
||||
>getMultiRobot() : [string, [string, string]]
|
||||
>getMultiRobot : () => [string, [string, string]]
|
||||
>getMultiRobot() : MultiSkilledRobot
|
||||
>getMultiRobot : () => MultiSkilledRobot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -662,7 +662,7 @@ for ([nameMA = "noName",
|
||||
|
||||
for ([numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) {
|
||||
>[numberA3 = -1, ...robotAInfo] = robotA, i = 0 : 0
|
||||
>[numberA3 = -1, ...robotAInfo] = robotA : [number, string, string]
|
||||
>[numberA3 = -1, ...robotAInfo] = robotA : Robot
|
||||
>[numberA3 = -1, ...robotAInfo] : [number, ...(string | number)[]]
|
||||
>numberA3 = -1 : -1
|
||||
>numberA3 : number
|
||||
@@ -670,7 +670,7 @@ for ([numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) {
|
||||
>1 : 1
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -689,7 +689,7 @@ for ([numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) {
|
||||
>[numberA3 = -1, ...robotAInfo] = getRobot(), i = 0 : 0
|
||||
>[numberA3 = -1, ...robotAInfo] = getRobot() : [number, string, string]
|
||||
>[numberA3 = -1, ...robotAInfo] = getRobot() : Robot
|
||||
>[numberA3 = -1, ...robotAInfo] : [number, ...(string | number)[]]
|
||||
>numberA3 = -1 : -1
|
||||
>numberA3 : number
|
||||
@@ -697,8 +697,8 @@ for ([numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) {
|
||||
>1 : 1
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
>getRobot() : [number, string, string]
|
||||
>getRobot : () => [number, string, string]
|
||||
>getRobot() : Robot
|
||||
>getRobot : () => Robot
|
||||
>i = 0 : 0
|
||||
>i : number
|
||||
>0 : 0
|
||||
@@ -717,7 +717,7 @@ for ([numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) {
|
||||
}
|
||||
for ([numberA3 = -1, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"], i = 0; i < 1; i++) {
|
||||
>[numberA3 = -1, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"], i = 0 : 0
|
||||
>[numberA3 = -1, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>[numberA3 = -1, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"] : Robot
|
||||
>[numberA3 = -1, ...robotAInfo] : [number, ...(string | number)[]]
|
||||
>numberA3 = -1 : -1
|
||||
>numberA3 : number
|
||||
@@ -725,7 +725,7 @@ for ([numberA3 = -1, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"], i = 0;
|
||||
>1 : 1
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
><Robot>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
><Robot>[2, "trimmer", "trimming"] : Robot
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
|
||||
+66
-66
@@ -7,40 +7,40 @@ declare var console: {
|
||||
>msg : any
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
>Robot : [number, string, string]
|
||||
>Robot : Robot
|
||||
|
||||
type MultiSkilledRobot = [string, [string, string]];
|
||||
>MultiSkilledRobot : [string, [string, string]]
|
||||
>MultiSkilledRobot : MultiSkilledRobot
|
||||
|
||||
let robotA: Robot = [1, "mower", "mowing"];
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>[1, "mower", "mowing"] : [number, string, string]
|
||||
>1 : 1
|
||||
>"mower" : "mower"
|
||||
>"mowing" : "mowing"
|
||||
|
||||
let robotB: Robot = [2, "trimmer", "trimming"];
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
>"trimming" : "trimming"
|
||||
|
||||
let robots = [robotA, robotB];
|
||||
>robots : [number, string, string][]
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>robots : Robot[]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
function getRobots() {
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
return robots;
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
}
|
||||
|
||||
let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>["mower", ["mowing", ""]] : [string, [string, string]]
|
||||
>"mower" : "mower"
|
||||
>["mowing", ""] : [string, string]
|
||||
@@ -48,7 +48,7 @@ let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>"" : ""
|
||||
|
||||
let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
>["trimmer", ["trimming", "edging"]] : [string, [string, string]]
|
||||
>"trimmer" : "trimmer"
|
||||
>["trimming", "edging"] : [string, string]
|
||||
@@ -56,22 +56,22 @@ let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>"edging" : "edging"
|
||||
|
||||
let multiRobots = [multiRobotA, multiRobotB];
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
function getMultiRobots() {
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
return multiRobots;
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
}
|
||||
|
||||
for (let [, nameA] of robots) {
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
|
||||
console.log(nameA);
|
||||
>console.log(nameA) : void
|
||||
@@ -83,8 +83,8 @@ for (let [, nameA] of robots) {
|
||||
for (let [, nameA] of getRobots()) {
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>getRobots() : [number, string, string][]
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots() : Robot[]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
console.log(nameA);
|
||||
>console.log(nameA) : void
|
||||
@@ -96,9 +96,9 @@ for (let [, nameA] of getRobots()) {
|
||||
for (let [, nameA] of [robotA, robotB]) {
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
console.log(nameA);
|
||||
>console.log(nameA) : void
|
||||
@@ -111,7 +111,7 @@ for (let [, [primarySkillA, secondarySkillA]] of multiRobots) {
|
||||
> : undefined
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
|
||||
console.log(primarySkillA);
|
||||
>console.log(primarySkillA) : void
|
||||
@@ -124,8 +124,8 @@ for (let [, [primarySkillA, secondarySkillA]] of getMultiRobots()) {
|
||||
> : undefined
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>getMultiRobots() : [string, [string, string]][]
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots() : MultiSkilledRobot[]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
console.log(primarySkillA);
|
||||
>console.log(primarySkillA) : void
|
||||
@@ -138,9 +138,9 @@ for (let [, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) {
|
||||
> : undefined
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
console.log(primarySkillA);
|
||||
>console.log(primarySkillA) : void
|
||||
@@ -152,7 +152,7 @@ for (let [, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) {
|
||||
|
||||
for (let [numberB] of robots) {
|
||||
>numberB : number
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
|
||||
console.log(numberB);
|
||||
>console.log(numberB) : void
|
||||
@@ -163,8 +163,8 @@ for (let [numberB] of robots) {
|
||||
}
|
||||
for (let [numberB] of getRobots()) {
|
||||
>numberB : number
|
||||
>getRobots() : [number, string, string][]
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots() : Robot[]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
console.log(numberB);
|
||||
>console.log(numberB) : void
|
||||
@@ -175,9 +175,9 @@ for (let [numberB] of getRobots()) {
|
||||
}
|
||||
for (let [numberB] of [robotA, robotB]) {
|
||||
>numberB : number
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
console.log(numberB);
|
||||
>console.log(numberB) : void
|
||||
@@ -188,7 +188,7 @@ for (let [numberB] of [robotA, robotB]) {
|
||||
}
|
||||
for (let [nameB] of multiRobots) {
|
||||
>nameB : string
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
|
||||
console.log(nameB);
|
||||
>console.log(nameB) : void
|
||||
@@ -199,8 +199,8 @@ for (let [nameB] of multiRobots) {
|
||||
}
|
||||
for (let [nameB] of getMultiRobots()) {
|
||||
>nameB : string
|
||||
>getMultiRobots() : [string, [string, string]][]
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots() : MultiSkilledRobot[]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
console.log(nameB);
|
||||
>console.log(nameB) : void
|
||||
@@ -211,9 +211,9 @@ for (let [nameB] of getMultiRobots()) {
|
||||
}
|
||||
for (let [nameB] of [multiRobotA, multiRobotB]) {
|
||||
>nameB : string
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
console.log(nameB);
|
||||
>console.log(nameB) : void
|
||||
@@ -227,7 +227,7 @@ for (let [numberA2, nameA2, skillA2] of robots) {
|
||||
>numberA2 : number
|
||||
>nameA2 : string
|
||||
>skillA2 : string
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
|
||||
console.log(nameA2);
|
||||
>console.log(nameA2) : void
|
||||
@@ -240,8 +240,8 @@ for (let [numberA2, nameA2, skillA2] of getRobots()) {
|
||||
>numberA2 : number
|
||||
>nameA2 : string
|
||||
>skillA2 : string
|
||||
>getRobots() : [number, string, string][]
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots() : Robot[]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
console.log(nameA2);
|
||||
>console.log(nameA2) : void
|
||||
@@ -254,9 +254,9 @@ for (let [numberA2, nameA2, skillA2] of [robotA, robotB]) {
|
||||
>numberA2 : number
|
||||
>nameA2 : string
|
||||
>skillA2 : string
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
console.log(nameA2);
|
||||
>console.log(nameA2) : void
|
||||
@@ -269,7 +269,7 @@ for (let [nameMA, [primarySkillA, secondarySkillA]] of multiRobots) {
|
||||
>nameMA : string
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
|
||||
console.log(nameMA);
|
||||
>console.log(nameMA) : void
|
||||
@@ -282,8 +282,8 @@ for (let [nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) {
|
||||
>nameMA : string
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>getMultiRobots() : [string, [string, string]][]
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots() : MultiSkilledRobot[]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
console.log(nameMA);
|
||||
>console.log(nameMA) : void
|
||||
@@ -296,9 +296,9 @@ for (let [nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB
|
||||
>nameMA : string
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
console.log(nameMA);
|
||||
>console.log(nameMA) : void
|
||||
@@ -311,7 +311,7 @@ for (let [nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB
|
||||
for (let [numberA3, ...robotAInfo] of robots) {
|
||||
>numberA3 : number
|
||||
>robotAInfo : [string, string]
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
|
||||
console.log(numberA3);
|
||||
>console.log(numberA3) : void
|
||||
@@ -323,8 +323,8 @@ for (let [numberA3, ...robotAInfo] of robots) {
|
||||
for (let [numberA3, ...robotAInfo] of getRobots()) {
|
||||
>numberA3 : number
|
||||
>robotAInfo : [string, string]
|
||||
>getRobots() : [number, string, string][]
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots() : Robot[]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
console.log(numberA3);
|
||||
>console.log(numberA3) : void
|
||||
@@ -336,9 +336,9 @@ for (let [numberA3, ...robotAInfo] of getRobots()) {
|
||||
for (let [numberA3, ...robotAInfo] of [robotA, robotB]) {
|
||||
>numberA3 : number
|
||||
>robotAInfo : [string, string]
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
console.log(numberA3);
|
||||
>console.log(numberA3) : void
|
||||
@@ -349,7 +349,7 @@ for (let [numberA3, ...robotAInfo] of [robotA, robotB]) {
|
||||
}
|
||||
for (let [...multiRobotAInfo] of multiRobots) {
|
||||
>multiRobotAInfo : [string, [string, string]]
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
|
||||
console.log(multiRobotAInfo);
|
||||
>console.log(multiRobotAInfo) : void
|
||||
@@ -360,8 +360,8 @@ for (let [...multiRobotAInfo] of multiRobots) {
|
||||
}
|
||||
for (let [...multiRobotAInfo] of getMultiRobots()) {
|
||||
>multiRobotAInfo : [string, [string, string]]
|
||||
>getMultiRobots() : [string, [string, string]][]
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots() : MultiSkilledRobot[]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
console.log(multiRobotAInfo);
|
||||
>console.log(multiRobotAInfo) : void
|
||||
@@ -372,9 +372,9 @@ for (let [...multiRobotAInfo] of getMultiRobots()) {
|
||||
}
|
||||
for (let [...multiRobotAInfo] of [multiRobotA, multiRobotB]) {
|
||||
>multiRobotAInfo : [string, [string, string]]
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
console.log(multiRobotAInfo);
|
||||
>console.log(multiRobotAInfo) : void
|
||||
|
||||
+66
-66
@@ -7,40 +7,40 @@ declare var console: {
|
||||
>msg : any
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
>Robot : [number, string, string]
|
||||
>Robot : Robot
|
||||
|
||||
type MultiSkilledRobot = [string, [string, string]];
|
||||
>MultiSkilledRobot : [string, [string, string]]
|
||||
>MultiSkilledRobot : MultiSkilledRobot
|
||||
|
||||
let robotA: Robot = [1, "mower", "mowing"];
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>[1, "mower", "mowing"] : [number, string, string]
|
||||
>1 : 1
|
||||
>"mower" : "mower"
|
||||
>"mowing" : "mowing"
|
||||
|
||||
let robotB: Robot = [2, "trimmer", "trimming"];
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
>"trimming" : "trimming"
|
||||
|
||||
let robots = [robotA, robotB];
|
||||
>robots : [number, string, string][]
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>robots : Robot[]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
function getRobots() {
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
return robots;
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
}
|
||||
|
||||
let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>["mower", ["mowing", ""]] : [string, [string, string]]
|
||||
>"mower" : "mower"
|
||||
>["mowing", ""] : [string, string]
|
||||
@@ -48,7 +48,7 @@ let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>"" : ""
|
||||
|
||||
let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
>["trimmer", ["trimming", "edging"]] : [string, [string, string]]
|
||||
>"trimmer" : "trimmer"
|
||||
>["trimming", "edging"] : [string, string]
|
||||
@@ -56,16 +56,16 @@ let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>"edging" : "edging"
|
||||
|
||||
let multiRobots = [multiRobotA, multiRobotB];
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
function getMultiRobots() {
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
return multiRobots;
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
}
|
||||
|
||||
let nameA: string, primarySkillA: string, secondarySkillA: string;
|
||||
@@ -92,7 +92,7 @@ for ([, nameA] of robots) {
|
||||
>[, nameA] : [undefined, string]
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
|
||||
console.log(nameA);
|
||||
>console.log(nameA) : void
|
||||
@@ -105,8 +105,8 @@ for ([, nameA] of getRobots()) {
|
||||
>[, nameA] : [undefined, string]
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>getRobots() : [number, string, string][]
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots() : Robot[]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
console.log(nameA);
|
||||
>console.log(nameA) : void
|
||||
@@ -119,9 +119,9 @@ for ([, nameA] of [robotA, robotB]) {
|
||||
>[, nameA] : [undefined, string]
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
console.log(nameA);
|
||||
>console.log(nameA) : void
|
||||
@@ -136,7 +136,7 @@ for ([, [primarySkillA, secondarySkillA]] of multiRobots) {
|
||||
>[primarySkillA, secondarySkillA] : [string, string]
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
|
||||
console.log(primarySkillA);
|
||||
>console.log(primarySkillA) : void
|
||||
@@ -151,8 +151,8 @@ for ([, [primarySkillA, secondarySkillA]] of getMultiRobots()) {
|
||||
>[primarySkillA, secondarySkillA] : [string, string]
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>getMultiRobots() : [string, [string, string]][]
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots() : MultiSkilledRobot[]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
console.log(primarySkillA);
|
||||
>console.log(primarySkillA) : void
|
||||
@@ -167,9 +167,9 @@ for ([, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) {
|
||||
>[primarySkillA, secondarySkillA] : [string, string]
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
console.log(primarySkillA);
|
||||
>console.log(primarySkillA) : void
|
||||
@@ -182,7 +182,7 @@ for ([, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) {
|
||||
for ([numberB] of robots) {
|
||||
>[numberB] : [number]
|
||||
>numberB : number
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
|
||||
console.log(numberB);
|
||||
>console.log(numberB) : void
|
||||
@@ -194,8 +194,8 @@ for ([numberB] of robots) {
|
||||
for ([numberB] of getRobots()) {
|
||||
>[numberB] : [number]
|
||||
>numberB : number
|
||||
>getRobots() : [number, string, string][]
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots() : Robot[]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
console.log(numberB);
|
||||
>console.log(numberB) : void
|
||||
@@ -207,9 +207,9 @@ for ([numberB] of getRobots()) {
|
||||
for ([numberB] of [robotA, robotB]) {
|
||||
>[numberB] : [number]
|
||||
>numberB : number
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
console.log(numberB);
|
||||
>console.log(numberB) : void
|
||||
@@ -221,7 +221,7 @@ for ([numberB] of [robotA, robotB]) {
|
||||
for ([nameB] of multiRobots) {
|
||||
>[nameB] : [string]
|
||||
>nameB : string
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
|
||||
console.log(nameB);
|
||||
>console.log(nameB) : void
|
||||
@@ -233,8 +233,8 @@ for ([nameB] of multiRobots) {
|
||||
for ([nameB] of getMultiRobots()) {
|
||||
>[nameB] : [string]
|
||||
>nameB : string
|
||||
>getMultiRobots() : [string, [string, string]][]
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots() : MultiSkilledRobot[]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
console.log(nameB);
|
||||
>console.log(nameB) : void
|
||||
@@ -246,9 +246,9 @@ for ([nameB] of getMultiRobots()) {
|
||||
for ([nameB] of [multiRobotA, multiRobotB]) {
|
||||
>[nameB] : [string]
|
||||
>nameB : string
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
console.log(nameB);
|
||||
>console.log(nameB) : void
|
||||
@@ -263,7 +263,7 @@ for ([numberA2, nameA2, skillA2] of robots) {
|
||||
>numberA2 : number
|
||||
>nameA2 : string
|
||||
>skillA2 : string
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
|
||||
console.log(nameA2);
|
||||
>console.log(nameA2) : void
|
||||
@@ -277,8 +277,8 @@ for ([numberA2, nameA2, skillA2] of getRobots()) {
|
||||
>numberA2 : number
|
||||
>nameA2 : string
|
||||
>skillA2 : string
|
||||
>getRobots() : [number, string, string][]
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots() : Robot[]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
console.log(nameA2);
|
||||
>console.log(nameA2) : void
|
||||
@@ -292,9 +292,9 @@ for ([numberA2, nameA2, skillA2] of [robotA, robotB]) {
|
||||
>numberA2 : number
|
||||
>nameA2 : string
|
||||
>skillA2 : string
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
console.log(nameA2);
|
||||
>console.log(nameA2) : void
|
||||
@@ -309,7 +309,7 @@ for ([nameMA, [primarySkillA, secondarySkillA]] of multiRobots) {
|
||||
>[primarySkillA, secondarySkillA] : [string, string]
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
|
||||
console.log(nameMA);
|
||||
>console.log(nameMA) : void
|
||||
@@ -324,8 +324,8 @@ for ([nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) {
|
||||
>[primarySkillA, secondarySkillA] : [string, string]
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>getMultiRobots() : [string, [string, string]][]
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots() : MultiSkilledRobot[]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
console.log(nameMA);
|
||||
>console.log(nameMA) : void
|
||||
@@ -340,9 +340,9 @@ for ([nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) {
|
||||
>[primarySkillA, secondarySkillA] : [string, string]
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
console.log(nameMA);
|
||||
>console.log(nameMA) : void
|
||||
@@ -357,7 +357,7 @@ for ([numberA3, ...robotAInfo] of robots) {
|
||||
>numberA3 : number
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
|
||||
console.log(numberA3);
|
||||
>console.log(numberA3) : void
|
||||
@@ -371,8 +371,8 @@ for ([numberA3, ...robotAInfo] of getRobots()) {
|
||||
>numberA3 : number
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
>getRobots() : [number, string, string][]
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots() : Robot[]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
console.log(numberA3);
|
||||
>console.log(numberA3) : void
|
||||
@@ -386,9 +386,9 @@ for ([numberA3, ...robotAInfo] of [robotA, robotB]) {
|
||||
>numberA3 : number
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
console.log(numberA3);
|
||||
>console.log(numberA3) : void
|
||||
@@ -401,7 +401,7 @@ for ([...multiRobotAInfo] of multiRobots) {
|
||||
>[...multiRobotAInfo] : (string | [string, string])[]
|
||||
>...multiRobotAInfo : string | [string, string]
|
||||
>multiRobotAInfo : (string | [string, string])[]
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
|
||||
console.log(multiRobotAInfo);
|
||||
>console.log(multiRobotAInfo) : void
|
||||
@@ -414,8 +414,8 @@ for ([...multiRobotAInfo] of getMultiRobots()) {
|
||||
>[...multiRobotAInfo] : (string | [string, string])[]
|
||||
>...multiRobotAInfo : string | [string, string]
|
||||
>multiRobotAInfo : (string | [string, string])[]
|
||||
>getMultiRobots() : [string, [string, string]][]
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots() : MultiSkilledRobot[]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
console.log(multiRobotAInfo);
|
||||
>console.log(multiRobotAInfo) : void
|
||||
@@ -428,9 +428,9 @@ for ([...multiRobotAInfo] of [multiRobotA, multiRobotB]) {
|
||||
>[...multiRobotAInfo] : (string | [string, string])[]
|
||||
>...multiRobotAInfo : string | [string, string]
|
||||
>multiRobotAInfo : (string | [string, string])[]
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
console.log(multiRobotAInfo);
|
||||
>console.log(multiRobotAInfo) : void
|
||||
|
||||
+60
-60
@@ -7,40 +7,40 @@ declare var console: {
|
||||
>msg : any
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
>Robot : [number, string, string]
|
||||
>Robot : Robot
|
||||
|
||||
type MultiSkilledRobot = [string, [string, string]];
|
||||
>MultiSkilledRobot : [string, [string, string]]
|
||||
>MultiSkilledRobot : MultiSkilledRobot
|
||||
|
||||
let robotA: Robot = [1, "mower", "mowing"];
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>[1, "mower", "mowing"] : [number, string, string]
|
||||
>1 : 1
|
||||
>"mower" : "mower"
|
||||
>"mowing" : "mowing"
|
||||
|
||||
let robotB: Robot = [2, "trimmer", "trimming"];
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
>"trimming" : "trimming"
|
||||
|
||||
let robots = [robotA, robotB];
|
||||
>robots : [number, string, string][]
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>robots : Robot[]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
function getRobots() {
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
return robots;
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
}
|
||||
|
||||
let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>["mower", ["mowing", ""]] : [string, [string, string]]
|
||||
>"mower" : "mower"
|
||||
>["mowing", ""] : [string, string]
|
||||
@@ -48,7 +48,7 @@ let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>"" : ""
|
||||
|
||||
let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
>["trimmer", ["trimming", "edging"]] : [string, [string, string]]
|
||||
>"trimmer" : "trimmer"
|
||||
>["trimming", "edging"] : [string, string]
|
||||
@@ -56,23 +56,23 @@ let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>"edging" : "edging"
|
||||
|
||||
let multiRobots = [multiRobotA, multiRobotB];
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
function getMultiRobots() {
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
return multiRobots;
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
}
|
||||
|
||||
for (let [, nameA = "noName"] of robots) {
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>"noName" : "noName"
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
|
||||
console.log(nameA);
|
||||
>console.log(nameA) : void
|
||||
@@ -85,8 +85,8 @@ for (let [, nameA = "noName"] of getRobots()) {
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>"noName" : "noName"
|
||||
>getRobots() : [number, string, string][]
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots() : Robot[]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
console.log(nameA);
|
||||
>console.log(nameA) : void
|
||||
@@ -99,9 +99,9 @@ for (let [, nameA = "noName"] of [robotA, robotB]) {
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>"noName" : "noName"
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
console.log(nameA);
|
||||
>console.log(nameA) : void
|
||||
@@ -125,7 +125,7 @@ for (let [, [
|
||||
>["skill1", "skill2"] : [string, string]
|
||||
>"skill1" : "skill1"
|
||||
>"skill2" : "skill2"
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
|
||||
console.log(primarySkillA);
|
||||
>console.log(primarySkillA) : void
|
||||
@@ -149,8 +149,8 @@ for (let [, [
|
||||
>["skill1", "skill2"] : [string, string]
|
||||
>"skill1" : "skill1"
|
||||
>"skill2" : "skill2"
|
||||
>getMultiRobots() : [string, [string, string]][]
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots() : MultiSkilledRobot[]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
console.log(primarySkillA);
|
||||
>console.log(primarySkillA) : void
|
||||
@@ -174,9 +174,9 @@ for (let [, [
|
||||
>["skill1", "skill2"] : [string, string]
|
||||
>"skill1" : "skill1"
|
||||
>"skill2" : "skill2"
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
console.log(primarySkillA);
|
||||
>console.log(primarySkillA) : void
|
||||
@@ -190,7 +190,7 @@ for (let [numberB = -1] of robots) {
|
||||
>numberB : number
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
|
||||
console.log(numberB);
|
||||
>console.log(numberB) : void
|
||||
@@ -203,8 +203,8 @@ for (let [numberB = -1] of getRobots()) {
|
||||
>numberB : number
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>getRobots() : [number, string, string][]
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots() : Robot[]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
console.log(numberB);
|
||||
>console.log(numberB) : void
|
||||
@@ -217,9 +217,9 @@ for (let [numberB = -1] of [robotA, robotB]) {
|
||||
>numberB : number
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
console.log(numberB);
|
||||
>console.log(numberB) : void
|
||||
@@ -231,7 +231,7 @@ for (let [numberB = -1] of [robotA, robotB]) {
|
||||
for (let [nameB = "noName"] of multiRobots) {
|
||||
>nameB : string
|
||||
>"noName" : "noName"
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
|
||||
console.log(nameB);
|
||||
>console.log(nameB) : void
|
||||
@@ -243,8 +243,8 @@ for (let [nameB = "noName"] of multiRobots) {
|
||||
for (let [nameB = "noName"] of getMultiRobots()) {
|
||||
>nameB : string
|
||||
>"noName" : "noName"
|
||||
>getMultiRobots() : [string, [string, string]][]
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots() : MultiSkilledRobot[]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
console.log(nameB);
|
||||
>console.log(nameB) : void
|
||||
@@ -256,9 +256,9 @@ for (let [nameB = "noName"] of getMultiRobots()) {
|
||||
for (let [nameB = "noName"] of [multiRobotA, multiRobotB]) {
|
||||
>nameB : string
|
||||
>"noName" : "noName"
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
console.log(nameB);
|
||||
>console.log(nameB) : void
|
||||
@@ -276,7 +276,7 @@ for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) {
|
||||
>"noName" : "noName"
|
||||
>skillA2 : string
|
||||
>"skill" : "skill"
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
|
||||
console.log(nameA2);
|
||||
>console.log(nameA2) : void
|
||||
@@ -293,8 +293,8 @@ for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) {
|
||||
>"noName" : "noName"
|
||||
>skillA2 : string
|
||||
>"skill" : "skill"
|
||||
>getRobots() : [number, string, string][]
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots() : Robot[]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
console.log(nameA2);
|
||||
>console.log(nameA2) : void
|
||||
@@ -311,9 +311,9 @@ for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robot
|
||||
>"noName" : "noName"
|
||||
>skillA2 : string
|
||||
>"skill" : "skill"
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
console.log(nameA2);
|
||||
>console.log(nameA2) : void
|
||||
@@ -338,7 +338,7 @@ for (let [nameMA = "noName", [
|
||||
>["skill1", "skill2"] : [string, string]
|
||||
>"skill1" : "skill1"
|
||||
>"skill2" : "skill2"
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
|
||||
console.log(nameMA);
|
||||
>console.log(nameMA) : void
|
||||
@@ -363,8 +363,8 @@ for (let [nameMA = "noName", [
|
||||
>["skill1", "skill2"] : [string, string]
|
||||
>"skill1" : "skill1"
|
||||
>"skill2" : "skill2"
|
||||
>getMultiRobots() : [string, [string, string]][]
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots() : MultiSkilledRobot[]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
console.log(nameMA);
|
||||
>console.log(nameMA) : void
|
||||
@@ -389,9 +389,9 @@ for (let [nameMA = "noName", [
|
||||
>["skill1", "skill2"] : [string, string]
|
||||
>"skill1" : "skill1"
|
||||
>"skill2" : "skill2"
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
console.log(nameMA);
|
||||
>console.log(nameMA) : void
|
||||
@@ -406,7 +406,7 @@ for (let [numberA3 = -1, ...robotAInfo] of robots) {
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>robotAInfo : [string, string]
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
|
||||
console.log(numberA3);
|
||||
>console.log(numberA3) : void
|
||||
@@ -420,8 +420,8 @@ for (let [numberA3 = -1, ...robotAInfo] of getRobots()) {
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>robotAInfo : [string, string]
|
||||
>getRobots() : [number, string, string][]
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots() : Robot[]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
console.log(numberA3);
|
||||
>console.log(numberA3) : void
|
||||
@@ -435,9 +435,9 @@ for (let [numberA3 = -1, ...robotAInfo] of [robotA, robotB]) {
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>robotAInfo : [string, string]
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
console.log(numberA3);
|
||||
>console.log(numberA3) : void
|
||||
|
||||
+60
-60
@@ -7,40 +7,40 @@ declare var console: {
|
||||
>msg : any
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
>Robot : [number, string, string]
|
||||
>Robot : Robot
|
||||
|
||||
type MultiSkilledRobot = [string, [string, string]];
|
||||
>MultiSkilledRobot : [string, [string, string]]
|
||||
>MultiSkilledRobot : MultiSkilledRobot
|
||||
|
||||
let robotA: Robot = [1, "mower", "mowing"];
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>[1, "mower", "mowing"] : [number, string, string]
|
||||
>1 : 1
|
||||
>"mower" : "mower"
|
||||
>"mowing" : "mowing"
|
||||
|
||||
let robotB: Robot = [2, "trimmer", "trimming"];
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
>"trimming" : "trimming"
|
||||
|
||||
let robots = [robotA, robotB];
|
||||
>robots : [number, string, string][]
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>robots : Robot[]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
function getRobots() {
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
return robots;
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
}
|
||||
|
||||
let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>["mower", ["mowing", ""]] : [string, [string, string]]
|
||||
>"mower" : "mower"
|
||||
>["mowing", ""] : [string, string]
|
||||
@@ -48,7 +48,7 @@ let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>"" : ""
|
||||
|
||||
let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
>["trimmer", ["trimming", "edging"]] : [string, [string, string]]
|
||||
>"trimmer" : "trimmer"
|
||||
>["trimming", "edging"] : [string, string]
|
||||
@@ -56,16 +56,16 @@ let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>"edging" : "edging"
|
||||
|
||||
let multiRobots = [multiRobotA, multiRobotB];
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
function getMultiRobots() {
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
return multiRobots;
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
}
|
||||
|
||||
let nameA: string, primarySkillA: string, secondarySkillA: string;
|
||||
@@ -94,7 +94,7 @@ for ([, nameA = "noName"] of robots) {
|
||||
>nameA = "noName" : "noName"
|
||||
>nameA : string
|
||||
>"noName" : "noName"
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
|
||||
console.log(nameA);
|
||||
>console.log(nameA) : void
|
||||
@@ -109,8 +109,8 @@ for ([, nameA = "noName"] of getRobots()) {
|
||||
>nameA = "noName" : "noName"
|
||||
>nameA : string
|
||||
>"noName" : "noName"
|
||||
>getRobots() : [number, string, string][]
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots() : Robot[]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
console.log(nameA);
|
||||
>console.log(nameA) : void
|
||||
@@ -125,9 +125,9 @@ for ([, nameA = "noName"] of [robotA, robotB]) {
|
||||
>nameA = "noName" : "noName"
|
||||
>nameA : string
|
||||
>"noName" : "noName"
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
console.log(nameA);
|
||||
>console.log(nameA) : void
|
||||
@@ -156,7 +156,7 @@ for ([, [
|
||||
>["skill1", "skill2"] : [string, string]
|
||||
>"skill1" : "skill1"
|
||||
>"skill2" : "skill2"
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
|
||||
console.log(primarySkillA);
|
||||
>console.log(primarySkillA) : void
|
||||
@@ -185,8 +185,8 @@ for ([, [
|
||||
>["skill1", "skill2"] : [string, string]
|
||||
>"skill1" : "skill1"
|
||||
>"skill2" : "skill2"
|
||||
>getMultiRobots() : [string, [string, string]][]
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots() : MultiSkilledRobot[]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
console.log(primarySkillA);
|
||||
>console.log(primarySkillA) : void
|
||||
@@ -215,9 +215,9 @@ for ([, [
|
||||
>["skill1", "skill2"] : [string, string]
|
||||
>"skill1" : "skill1"
|
||||
>"skill2" : "skill2"
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
console.log(primarySkillA);
|
||||
>console.log(primarySkillA) : void
|
||||
@@ -233,7 +233,7 @@ for ([numberB = -1] of robots) {
|
||||
>numberB : number
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
|
||||
console.log(numberB);
|
||||
>console.log(numberB) : void
|
||||
@@ -248,8 +248,8 @@ for ([numberB = -1] of getRobots()) {
|
||||
>numberB : number
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>getRobots() : [number, string, string][]
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots() : Robot[]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
console.log(numberB);
|
||||
>console.log(numberB) : void
|
||||
@@ -264,9 +264,9 @@ for ([numberB = -1] of [robotA, robotB]) {
|
||||
>numberB : number
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
console.log(numberB);
|
||||
>console.log(numberB) : void
|
||||
@@ -280,7 +280,7 @@ for ([nameB = "noName"] of multiRobots) {
|
||||
>nameB = "noName" : "noName"
|
||||
>nameB : string
|
||||
>"noName" : "noName"
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
|
||||
console.log(nameB);
|
||||
>console.log(nameB) : void
|
||||
@@ -294,8 +294,8 @@ for ([nameB = "noName"] of getMultiRobots()) {
|
||||
>nameB = "noName" : "noName"
|
||||
>nameB : string
|
||||
>"noName" : "noName"
|
||||
>getMultiRobots() : [string, [string, string]][]
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots() : MultiSkilledRobot[]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
console.log(nameB);
|
||||
>console.log(nameB) : void
|
||||
@@ -309,9 +309,9 @@ for ([nameB = "noName"] of [multiRobotA, multiRobotB]) {
|
||||
>nameB = "noName" : "noName"
|
||||
>nameB : string
|
||||
>"noName" : "noName"
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
console.log(nameB);
|
||||
>console.log(nameB) : void
|
||||
@@ -333,7 +333,7 @@ for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) {
|
||||
>skillA2 = "skill" : "skill"
|
||||
>skillA2 : string
|
||||
>"skill" : "skill"
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
|
||||
console.log(nameA2);
|
||||
>console.log(nameA2) : void
|
||||
@@ -354,8 +354,8 @@ for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) {
|
||||
>skillA2 = "skill" : "skill"
|
||||
>skillA2 : string
|
||||
>"skill" : "skill"
|
||||
>getRobots() : [number, string, string][]
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots() : Robot[]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
console.log(nameA2);
|
||||
>console.log(nameA2) : void
|
||||
@@ -376,9 +376,9 @@ for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB])
|
||||
>skillA2 = "skill" : "skill"
|
||||
>skillA2 : string
|
||||
>"skill" : "skill"
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
console.log(nameA2);
|
||||
>console.log(nameA2) : void
|
||||
@@ -409,7 +409,7 @@ for ([nameMA = "noName", [
|
||||
>["skill1", "skill2"] : [string, string]
|
||||
>"skill1" : "skill1"
|
||||
>"skill2" : "skill2"
|
||||
>multiRobots : [string, [string, string]][]
|
||||
>multiRobots : MultiSkilledRobot[]
|
||||
|
||||
console.log(nameMA);
|
||||
>console.log(nameMA) : void
|
||||
@@ -440,8 +440,8 @@ for ([nameMA = "noName", [
|
||||
>["skill1", "skill2"] : [string, string]
|
||||
>"skill1" : "skill1"
|
||||
>"skill2" : "skill2"
|
||||
>getMultiRobots() : [string, [string, string]][]
|
||||
>getMultiRobots : () => [string, [string, string]][]
|
||||
>getMultiRobots() : MultiSkilledRobot[]
|
||||
>getMultiRobots : () => MultiSkilledRobot[]
|
||||
|
||||
console.log(nameMA);
|
||||
>console.log(nameMA) : void
|
||||
@@ -472,9 +472,9 @@ for ([nameMA = "noName", [
|
||||
>["skill1", "skill2"] : [string, string]
|
||||
>"skill1" : "skill1"
|
||||
>"skill2" : "skill2"
|
||||
>[multiRobotA, multiRobotB] : [string, [string, string]][]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>[multiRobotA, multiRobotB] : MultiSkilledRobot[]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
console.log(nameMA);
|
||||
>console.log(nameMA) : void
|
||||
@@ -492,7 +492,7 @@ for ([numberA3 = -1, ...robotAInfo] of robots) {
|
||||
>1 : 1
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
>robots : [number, string, string][]
|
||||
>robots : Robot[]
|
||||
|
||||
console.log(numberA3);
|
||||
>console.log(numberA3) : void
|
||||
@@ -509,8 +509,8 @@ for ([numberA3 = -1, ...robotAInfo] of getRobots()) {
|
||||
>1 : 1
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
>getRobots() : [number, string, string][]
|
||||
>getRobots : () => [number, string, string][]
|
||||
>getRobots() : Robot[]
|
||||
>getRobots : () => Robot[]
|
||||
|
||||
console.log(numberA3);
|
||||
>console.log(numberA3) : void
|
||||
@@ -527,9 +527,9 @@ for ([numberA3 = -1, ...robotAInfo] of [robotA, robotB]) {
|
||||
>1 : 1
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
>[robotA, robotB] : [number, string, string][]
|
||||
>robotA : [number, string, string]
|
||||
>robotB : [number, string, string]
|
||||
>[robotA, robotB] : Robot[]
|
||||
>robotA : Robot
|
||||
>robotB : Robot
|
||||
|
||||
console.log(numberA3);
|
||||
>console.log(numberA3) : void
|
||||
|
||||
+18
-18
@@ -7,17 +7,17 @@ declare var console: {
|
||||
>msg : any
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
>Robot : [number, string, string]
|
||||
>Robot : Robot
|
||||
|
||||
var robotA: Robot = [1, "mower", "mowing"];
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>[1, "mower", "mowing"] : [number, string, string]
|
||||
>1 : 1
|
||||
>"mower" : "mower"
|
||||
>"mowing" : "mowing"
|
||||
|
||||
function foo1([, nameA]: Robot) {
|
||||
>foo1 : ([, nameA]: [number, string, string]) => void
|
||||
>foo1 : ([, nameA]: Robot) => void
|
||||
> : undefined
|
||||
>nameA : string
|
||||
|
||||
@@ -30,7 +30,7 @@ function foo1([, nameA]: Robot) {
|
||||
}
|
||||
|
||||
function foo2([numberB]: Robot) {
|
||||
>foo2 : ([numberB]: [number, string, string]) => void
|
||||
>foo2 : ([numberB]: Robot) => void
|
||||
>numberB : number
|
||||
|
||||
console.log(numberB);
|
||||
@@ -42,7 +42,7 @@ function foo2([numberB]: Robot) {
|
||||
}
|
||||
|
||||
function foo3([numberA2, nameA2, skillA2]: Robot) {
|
||||
>foo3 : ([numberA2, nameA2, skillA2]: [number, string, string]) => void
|
||||
>foo3 : ([numberA2, nameA2, skillA2]: Robot) => void
|
||||
>numberA2 : number
|
||||
>nameA2 : string
|
||||
>skillA2 : string
|
||||
@@ -56,7 +56,7 @@ function foo3([numberA2, nameA2, skillA2]: Robot) {
|
||||
}
|
||||
|
||||
function foo4([numberA3, ...robotAInfo]: Robot) {
|
||||
>foo4 : ([numberA3, ...robotAInfo]: [number, string, string]) => void
|
||||
>foo4 : ([numberA3, ...robotAInfo]: Robot) => void
|
||||
>numberA3 : number
|
||||
>robotAInfo : [string, string]
|
||||
|
||||
@@ -70,12 +70,12 @@ function foo4([numberA3, ...robotAInfo]: Robot) {
|
||||
|
||||
foo1(robotA);
|
||||
>foo1(robotA) : void
|
||||
>foo1 : ([, nameA]: [number, string, string]) => void
|
||||
>robotA : [number, string, string]
|
||||
>foo1 : ([, nameA]: Robot) => void
|
||||
>robotA : Robot
|
||||
|
||||
foo1([2, "trimmer", "trimming"]);
|
||||
>foo1([2, "trimmer", "trimming"]) : void
|
||||
>foo1 : ([, nameA]: [number, string, string]) => void
|
||||
>foo1 : ([, nameA]: Robot) => void
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
@@ -83,12 +83,12 @@ foo1([2, "trimmer", "trimming"]);
|
||||
|
||||
foo2(robotA);
|
||||
>foo2(robotA) : void
|
||||
>foo2 : ([numberB]: [number, string, string]) => void
|
||||
>robotA : [number, string, string]
|
||||
>foo2 : ([numberB]: Robot) => void
|
||||
>robotA : Robot
|
||||
|
||||
foo2([2, "trimmer", "trimming"]);
|
||||
>foo2([2, "trimmer", "trimming"]) : void
|
||||
>foo2 : ([numberB]: [number, string, string]) => void
|
||||
>foo2 : ([numberB]: Robot) => void
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
@@ -96,12 +96,12 @@ foo2([2, "trimmer", "trimming"]);
|
||||
|
||||
foo3(robotA);
|
||||
>foo3(robotA) : void
|
||||
>foo3 : ([numberA2, nameA2, skillA2]: [number, string, string]) => void
|
||||
>robotA : [number, string, string]
|
||||
>foo3 : ([numberA2, nameA2, skillA2]: Robot) => void
|
||||
>robotA : Robot
|
||||
|
||||
foo3([2, "trimmer", "trimming"]);
|
||||
>foo3([2, "trimmer", "trimming"]) : void
|
||||
>foo3 : ([numberA2, nameA2, skillA2]: [number, string, string]) => void
|
||||
>foo3 : ([numberA2, nameA2, skillA2]: Robot) => void
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
@@ -109,12 +109,12 @@ foo3([2, "trimmer", "trimming"]);
|
||||
|
||||
foo4(robotA);
|
||||
>foo4(robotA) : void
|
||||
>foo4 : ([numberA3, ...robotAInfo]: [number, string, string]) => void
|
||||
>robotA : [number, string, string]
|
||||
>foo4 : ([numberA3, ...robotAInfo]: Robot) => void
|
||||
>robotA : Robot
|
||||
|
||||
foo4([2, "trimmer", "trimming"]);
|
||||
>foo4([2, "trimmer", "trimming"]) : void
|
||||
>foo4 : ([numberA3, ...robotAInfo]: [number, string, string]) => void
|
||||
>foo4 : ([numberA3, ...robotAInfo]: Robot) => void
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
|
||||
+18
-18
@@ -7,10 +7,10 @@ declare var console: {
|
||||
>msg : any
|
||||
}
|
||||
type Robot = [string, [string, string]];
|
||||
>Robot : [string, [string, string]]
|
||||
>Robot : Robot
|
||||
|
||||
var robotA: Robot = ["trimmer", ["trimming", "edging"]];
|
||||
>robotA : [string, [string, string]]
|
||||
>robotA : Robot
|
||||
>["trimmer", ["trimming", "edging"]] : [string, [string, string]]
|
||||
>"trimmer" : "trimmer"
|
||||
>["trimming", "edging"] : [string, string]
|
||||
@@ -18,7 +18,7 @@ var robotA: Robot = ["trimmer", ["trimming", "edging"]];
|
||||
>"edging" : "edging"
|
||||
|
||||
function foo1([, skillA]: Robot) {
|
||||
>foo1 : ([, skillA]: [string, [string, string]]) => void
|
||||
>foo1 : ([, skillA]: Robot) => void
|
||||
> : undefined
|
||||
>skillA : [string, string]
|
||||
|
||||
@@ -31,7 +31,7 @@ function foo1([, skillA]: Robot) {
|
||||
}
|
||||
|
||||
function foo2([nameMB]: Robot) {
|
||||
>foo2 : ([nameMB]: [string, [string, string]]) => void
|
||||
>foo2 : ([nameMB]: Robot) => void
|
||||
>nameMB : string
|
||||
|
||||
console.log(nameMB);
|
||||
@@ -43,7 +43,7 @@ function foo2([nameMB]: Robot) {
|
||||
}
|
||||
|
||||
function foo3([nameMA, [primarySkillA, secondarySkillA]]: Robot) {
|
||||
>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: [string, [string, string]]) => void
|
||||
>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: Robot) => void
|
||||
>nameMA : string
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
@@ -57,7 +57,7 @@ function foo3([nameMA, [primarySkillA, secondarySkillA]]: Robot) {
|
||||
}
|
||||
|
||||
function foo4([...multiRobotAInfo]: Robot) {
|
||||
>foo4 : ([...multiRobotAInfo]: [string, [string, string]]) => void
|
||||
>foo4 : ([...multiRobotAInfo]: Robot) => void
|
||||
>multiRobotAInfo : [string, [string, string]]
|
||||
|
||||
console.log(multiRobotAInfo);
|
||||
@@ -70,12 +70,12 @@ function foo4([...multiRobotAInfo]: Robot) {
|
||||
|
||||
foo1(robotA);
|
||||
>foo1(robotA) : void
|
||||
>foo1 : ([, skillA]: [string, [string, string]]) => void
|
||||
>robotA : [string, [string, string]]
|
||||
>foo1 : ([, skillA]: Robot) => void
|
||||
>robotA : Robot
|
||||
|
||||
foo1(["roomba", ["vaccum", "mopping"]]);
|
||||
>foo1(["roomba", ["vaccum", "mopping"]]) : void
|
||||
>foo1 : ([, skillA]: [string, [string, string]]) => void
|
||||
>foo1 : ([, skillA]: Robot) => void
|
||||
>["roomba", ["vaccum", "mopping"]] : [string, [string, string]]
|
||||
>"roomba" : "roomba"
|
||||
>["vaccum", "mopping"] : [string, string]
|
||||
@@ -84,12 +84,12 @@ foo1(["roomba", ["vaccum", "mopping"]]);
|
||||
|
||||
foo2(robotA);
|
||||
>foo2(robotA) : void
|
||||
>foo2 : ([nameMB]: [string, [string, string]]) => void
|
||||
>robotA : [string, [string, string]]
|
||||
>foo2 : ([nameMB]: Robot) => void
|
||||
>robotA : Robot
|
||||
|
||||
foo2(["roomba", ["vaccum", "mopping"]]);
|
||||
>foo2(["roomba", ["vaccum", "mopping"]]) : void
|
||||
>foo2 : ([nameMB]: [string, [string, string]]) => void
|
||||
>foo2 : ([nameMB]: Robot) => void
|
||||
>["roomba", ["vaccum", "mopping"]] : [string, [string, string]]
|
||||
>"roomba" : "roomba"
|
||||
>["vaccum", "mopping"] : [string, string]
|
||||
@@ -98,12 +98,12 @@ foo2(["roomba", ["vaccum", "mopping"]]);
|
||||
|
||||
foo3(robotA);
|
||||
>foo3(robotA) : void
|
||||
>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: [string, [string, string]]) => void
|
||||
>robotA : [string, [string, string]]
|
||||
>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: Robot) => void
|
||||
>robotA : Robot
|
||||
|
||||
foo3(["roomba", ["vaccum", "mopping"]]);
|
||||
>foo3(["roomba", ["vaccum", "mopping"]]) : void
|
||||
>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: [string, [string, string]]) => void
|
||||
>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: Robot) => void
|
||||
>["roomba", ["vaccum", "mopping"]] : [string, [string, string]]
|
||||
>"roomba" : "roomba"
|
||||
>["vaccum", "mopping"] : [string, string]
|
||||
@@ -112,12 +112,12 @@ foo3(["roomba", ["vaccum", "mopping"]]);
|
||||
|
||||
foo4(robotA);
|
||||
>foo4(robotA) : void
|
||||
>foo4 : ([...multiRobotAInfo]: [string, [string, string]]) => void
|
||||
>robotA : [string, [string, string]]
|
||||
>foo4 : ([...multiRobotAInfo]: Robot) => void
|
||||
>robotA : Robot
|
||||
|
||||
foo4(["roomba", ["vaccum", "mopping"]]);
|
||||
>foo4(["roomba", ["vaccum", "mopping"]]) : void
|
||||
>foo4 : ([...multiRobotAInfo]: [string, [string, string]]) => void
|
||||
>foo4 : ([...multiRobotAInfo]: Robot) => void
|
||||
>["roomba", ["vaccum", "mopping"]] : [string, [string, string]]
|
||||
>"roomba" : "roomba"
|
||||
>["vaccum", "mopping"] : [string, string]
|
||||
|
||||
+18
-18
@@ -7,17 +7,17 @@ declare var console: {
|
||||
>msg : any
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
>Robot : [number, string, string]
|
||||
>Robot : Robot
|
||||
|
||||
var robotA: Robot = [1, "mower", "mowing"];
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>[1, "mower", "mowing"] : [number, string, string]
|
||||
>1 : 1
|
||||
>"mower" : "mower"
|
||||
>"mowing" : "mowing"
|
||||
|
||||
function foo1([, nameA = "noName"]: Robot = [-1, "name", "skill"]) {
|
||||
>foo1 : ([, nameA]?: [number, string, string]) => void
|
||||
>foo1 : ([, nameA]?: Robot) => void
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>"noName" : "noName"
|
||||
@@ -36,7 +36,7 @@ function foo1([, nameA = "noName"]: Robot = [-1, "name", "skill"]) {
|
||||
}
|
||||
|
||||
function foo2([numberB = -1]: Robot = [-1, "name", "skill"]) {
|
||||
>foo2 : ([numberB]?: [number, string, string]) => void
|
||||
>foo2 : ([numberB]?: Robot) => void
|
||||
>numberB : number
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
@@ -55,7 +55,7 @@ function foo2([numberB = -1]: Robot = [-1, "name", "skill"]) {
|
||||
}
|
||||
|
||||
function foo3([numberA2 = -1, nameA2 = "name", skillA2 = "skill"]: Robot = [-1, "name", "skill"]) {
|
||||
>foo3 : ([numberA2, nameA2, skillA2]?: [number, string, string]) => void
|
||||
>foo3 : ([numberA2, nameA2, skillA2]?: Robot) => void
|
||||
>numberA2 : number
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
@@ -78,7 +78,7 @@ function foo3([numberA2 = -1, nameA2 = "name", skillA2 = "skill"]: Robot = [-1,
|
||||
}
|
||||
|
||||
function foo4([numberA3 = -1, ...robotAInfo]: Robot = [-1, "name", "skill"]) {
|
||||
>foo4 : ([numberA3, ...robotAInfo]?: [number, string, string]) => void
|
||||
>foo4 : ([numberA3, ...robotAInfo]?: Robot) => void
|
||||
>numberA3 : number
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
@@ -99,12 +99,12 @@ function foo4([numberA3 = -1, ...robotAInfo]: Robot = [-1, "name", "skill"]) {
|
||||
|
||||
foo1(robotA);
|
||||
>foo1(robotA) : void
|
||||
>foo1 : ([, nameA]?: [number, string, string]) => void
|
||||
>robotA : [number, string, string]
|
||||
>foo1 : ([, nameA]?: Robot) => void
|
||||
>robotA : Robot
|
||||
|
||||
foo1([2, "trimmer", "trimming"]);
|
||||
>foo1([2, "trimmer", "trimming"]) : void
|
||||
>foo1 : ([, nameA]?: [number, string, string]) => void
|
||||
>foo1 : ([, nameA]?: Robot) => void
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
@@ -112,12 +112,12 @@ foo1([2, "trimmer", "trimming"]);
|
||||
|
||||
foo2(robotA);
|
||||
>foo2(robotA) : void
|
||||
>foo2 : ([numberB]?: [number, string, string]) => void
|
||||
>robotA : [number, string, string]
|
||||
>foo2 : ([numberB]?: Robot) => void
|
||||
>robotA : Robot
|
||||
|
||||
foo2([2, "trimmer", "trimming"]);
|
||||
>foo2([2, "trimmer", "trimming"]) : void
|
||||
>foo2 : ([numberB]?: [number, string, string]) => void
|
||||
>foo2 : ([numberB]?: Robot) => void
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
@@ -125,12 +125,12 @@ foo2([2, "trimmer", "trimming"]);
|
||||
|
||||
foo3(robotA);
|
||||
>foo3(robotA) : void
|
||||
>foo3 : ([numberA2, nameA2, skillA2]?: [number, string, string]) => void
|
||||
>robotA : [number, string, string]
|
||||
>foo3 : ([numberA2, nameA2, skillA2]?: Robot) => void
|
||||
>robotA : Robot
|
||||
|
||||
foo3([2, "trimmer", "trimming"]);
|
||||
>foo3([2, "trimmer", "trimming"]) : void
|
||||
>foo3 : ([numberA2, nameA2, skillA2]?: [number, string, string]) => void
|
||||
>foo3 : ([numberA2, nameA2, skillA2]?: Robot) => void
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
@@ -138,12 +138,12 @@ foo3([2, "trimmer", "trimming"]);
|
||||
|
||||
foo4(robotA);
|
||||
>foo4(robotA) : void
|
||||
>foo4 : ([numberA3, ...robotAInfo]?: [number, string, string]) => void
|
||||
>robotA : [number, string, string]
|
||||
>foo4 : ([numberA3, ...robotAInfo]?: Robot) => void
|
||||
>robotA : Robot
|
||||
|
||||
foo4([2, "trimmer", "trimming"]);
|
||||
>foo4([2, "trimmer", "trimming"]) : void
|
||||
>foo4 : ([numberA3, ...robotAInfo]?: [number, string, string]) => void
|
||||
>foo4 : ([numberA3, ...robotAInfo]?: Robot) => void
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
|
||||
+14
-14
@@ -7,10 +7,10 @@ declare var console: {
|
||||
>msg : any
|
||||
}
|
||||
type Robot = [string, string[]];
|
||||
>Robot : [string, string[]]
|
||||
>Robot : Robot
|
||||
|
||||
var robotA: Robot = ["trimmer", ["trimming", "edging"]];
|
||||
>robotA : [string, string[]]
|
||||
>robotA : Robot
|
||||
>["trimmer", ["trimming", "edging"]] : [string, string[]]
|
||||
>"trimmer" : "trimmer"
|
||||
>["trimming", "edging"] : string[]
|
||||
@@ -18,7 +18,7 @@ var robotA: Robot = ["trimmer", ["trimming", "edging"]];
|
||||
>"edging" : "edging"
|
||||
|
||||
function foo1([, skillA = ["noSkill", "noSkill"]]: Robot= ["name", ["skill1", "skill2"]]) {
|
||||
>foo1 : ([, skillA]?: [string, string[]]) => void
|
||||
>foo1 : ([, skillA]?: Robot) => void
|
||||
> : undefined
|
||||
>skillA : string[]
|
||||
>["noSkill", "noSkill"] : string[]
|
||||
@@ -39,7 +39,7 @@ function foo1([, skillA = ["noSkill", "noSkill"]]: Robot= ["name", ["skill1", "s
|
||||
}
|
||||
|
||||
function foo2([nameMB = "noName"]: Robot = ["name", ["skill1", "skill2"]]) {
|
||||
>foo2 : ([nameMB]?: [string, string[]]) => void
|
||||
>foo2 : ([nameMB]?: Robot) => void
|
||||
>nameMB : string
|
||||
>"noName" : "noName"
|
||||
>["name", ["skill1", "skill2"]] : [string, string[]]
|
||||
@@ -57,7 +57,7 @@ function foo2([nameMB = "noName"]: Robot = ["name", ["skill1", "skill2"]]) {
|
||||
}
|
||||
|
||||
function foo3([nameMA = "noName", [
|
||||
>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: [string, string[]]) => void
|
||||
>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: Robot) => void
|
||||
>nameMA : string
|
||||
>"noName" : "noName"
|
||||
|
||||
@@ -84,12 +84,12 @@ function foo3([nameMA = "noName", [
|
||||
|
||||
foo1(robotA);
|
||||
>foo1(robotA) : void
|
||||
>foo1 : ([, skillA]?: [string, string[]]) => void
|
||||
>robotA : [string, string[]]
|
||||
>foo1 : ([, skillA]?: Robot) => void
|
||||
>robotA : Robot
|
||||
|
||||
foo1(["roomba", ["vaccum", "mopping"]]);
|
||||
>foo1(["roomba", ["vaccum", "mopping"]]) : void
|
||||
>foo1 : ([, skillA]?: [string, string[]]) => void
|
||||
>foo1 : ([, skillA]?: Robot) => void
|
||||
>["roomba", ["vaccum", "mopping"]] : [string, string[]]
|
||||
>"roomba" : "roomba"
|
||||
>["vaccum", "mopping"] : string[]
|
||||
@@ -98,12 +98,12 @@ foo1(["roomba", ["vaccum", "mopping"]]);
|
||||
|
||||
foo2(robotA);
|
||||
>foo2(robotA) : void
|
||||
>foo2 : ([nameMB]?: [string, string[]]) => void
|
||||
>robotA : [string, string[]]
|
||||
>foo2 : ([nameMB]?: Robot) => void
|
||||
>robotA : Robot
|
||||
|
||||
foo2(["roomba", ["vaccum", "mopping"]]);
|
||||
>foo2(["roomba", ["vaccum", "mopping"]]) : void
|
||||
>foo2 : ([nameMB]?: [string, string[]]) => void
|
||||
>foo2 : ([nameMB]?: Robot) => void
|
||||
>["roomba", ["vaccum", "mopping"]] : [string, string[]]
|
||||
>"roomba" : "roomba"
|
||||
>["vaccum", "mopping"] : string[]
|
||||
@@ -112,12 +112,12 @@ foo2(["roomba", ["vaccum", "mopping"]]);
|
||||
|
||||
foo3(robotA);
|
||||
>foo3(robotA) : void
|
||||
>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: [string, string[]]) => void
|
||||
>robotA : [string, string[]]
|
||||
>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: Robot) => void
|
||||
>robotA : Robot
|
||||
|
||||
foo3(["roomba", ["vaccum", "mopping"]]);
|
||||
>foo3(["roomba", ["vaccum", "mopping"]]) : void
|
||||
>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: [string, string[]]) => void
|
||||
>foo3 : ([nameMA, [primarySkillA, secondarySkillA]]: Robot) => void
|
||||
>["roomba", ["vaccum", "mopping"]] : [string, string[]]
|
||||
>"roomba" : "roomba"
|
||||
>["vaccum", "mopping"] : string[]
|
||||
|
||||
+7
-7
@@ -7,17 +7,17 @@ declare var console: {
|
||||
>msg : string
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
>Robot : [number, string, string]
|
||||
>Robot : Robot
|
||||
|
||||
var robotA: Robot = [1, "mower", "mowing"];
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>[1, "mower", "mowing"] : [number, string, string]
|
||||
>1 : 1
|
||||
>"mower" : "mower"
|
||||
>"mowing" : "mowing"
|
||||
|
||||
var robotB: Robot = [2, "trimmer", "trimming"];
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
@@ -27,17 +27,17 @@ var robotB: Robot = [2, "trimmer", "trimming"];
|
||||
let [, nameA] = robotA;
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
|
||||
let [numberB] = robotB;
|
||||
>numberB : number
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
|
||||
let [numberA2, nameA2, skillA2] = robotA;
|
||||
>numberA2 : number
|
||||
>nameA2 : string
|
||||
>skillA2 : string
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
|
||||
let [numberC2] = [3, "edging", "Trimming edges"];
|
||||
>numberC2 : number
|
||||
@@ -58,7 +58,7 @@ let [numberC, nameC, skillC] = [3, "edging", "Trimming edges"];
|
||||
let [numberA3, ...robotAInfo] = robotA;
|
||||
>numberA3 : number
|
||||
>robotAInfo : [string, string]
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
|
||||
if (nameA == nameA2) {
|
||||
>nameA == nameA2 : boolean
|
||||
|
||||
+7
-7
@@ -7,10 +7,10 @@ declare var console: {
|
||||
>msg : string
|
||||
}
|
||||
type MultiSkilledRobot = [string, [string, string]];
|
||||
>MultiSkilledRobot : [string, [string, string]]
|
||||
>MultiSkilledRobot : MultiSkilledRobot
|
||||
|
||||
var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>["mower", ["mowing", ""]] : [string, [string, string]]
|
||||
>"mower" : "mower"
|
||||
>["mowing", ""] : [string, string]
|
||||
@@ -18,7 +18,7 @@ var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>"" : ""
|
||||
|
||||
var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
>["trimmer", ["trimming", "edging"]] : [string, [string, string]]
|
||||
>"trimmer" : "trimmer"
|
||||
>["trimming", "edging"] : [string, string]
|
||||
@@ -28,17 +28,17 @@ var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
let [, skillA] = multiRobotA;
|
||||
> : undefined
|
||||
>skillA : [string, string]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
|
||||
let [nameMB] = multiRobotB;
|
||||
>nameMB : string
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA;
|
||||
>nameMA : string
|
||||
>primarySkillA : string
|
||||
>secondarySkillA : string
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
|
||||
let [nameMC] = ["roomba", ["vaccum", "mopping"]];
|
||||
>nameMC : string
|
||||
@@ -60,7 +60,7 @@ let [nameMC2, [primarySkillC, secondarySkillC]] = ["roomba", ["vaccum", "mopping
|
||||
|
||||
let [...multiRobotAInfo] = multiRobotA;
|
||||
>multiRobotAInfo : [string, [string, string]]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
|
||||
if (nameMB == nameMA) {
|
||||
>nameMB == nameMA : boolean
|
||||
|
||||
+52
-52
@@ -7,27 +7,27 @@ declare var console: {
|
||||
>msg : any
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
>Robot : [number, string, string]
|
||||
>Robot : Robot
|
||||
|
||||
type MultiSkilledRobot = [string, [string, string]];
|
||||
>MultiSkilledRobot : [string, [string, string]]
|
||||
>MultiSkilledRobot : MultiSkilledRobot
|
||||
|
||||
var robotA: Robot = [1, "mower", "mowing"];
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>[1, "mower", "mowing"] : [number, string, string]
|
||||
>1 : 1
|
||||
>"mower" : "mower"
|
||||
>"mowing" : "mowing"
|
||||
|
||||
var robotB: Robot = [2, "trimmer", "trimming"];
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
>"trimming" : "trimming"
|
||||
|
||||
var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>["mower", ["mowing", ""]] : [string, [string, string]]
|
||||
>"mower" : "mower"
|
||||
>["mowing", ""] : [string, string]
|
||||
@@ -35,7 +35,7 @@ var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>"" : ""
|
||||
|
||||
var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
>["trimmer", ["trimming", "edging"]] : [string, [string, string]]
|
||||
>"trimmer" : "trimmer"
|
||||
>["trimming", "edging"] : [string, string]
|
||||
@@ -61,19 +61,19 @@ let multiRobotAInfo: (string | [string, string])[];
|
||||
>multiRobotAInfo : (string | [string, string])[]
|
||||
|
||||
[, nameA] = robotA;
|
||||
>[, nameA] = robotA : [number, string, string]
|
||||
>[, nameA] = robotA : Robot
|
||||
>[, nameA] : [undefined, string]
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
|
||||
[, nameB] = getRobotB();
|
||||
>[, nameB] = getRobotB() : [number, string, string]
|
||||
>[, nameB] = getRobotB() : Robot
|
||||
>[, nameB] : [undefined, string]
|
||||
> : undefined
|
||||
>nameB : string
|
||||
>getRobotB() : [number, string, string]
|
||||
>getRobotB : () => [number, string, string]
|
||||
>getRobotB() : Robot
|
||||
>getRobotB : () => Robot
|
||||
|
||||
[, nameB] = [2, "trimmer", "trimming"];
|
||||
>[, nameB] = [2, "trimmer", "trimming"] : [number, string, string]
|
||||
@@ -86,19 +86,19 @@ let multiRobotAInfo: (string | [string, string])[];
|
||||
>"trimming" : "trimming"
|
||||
|
||||
[, multiSkillB] = multiRobotB;
|
||||
>[, multiSkillB] = multiRobotB : [string, [string, string]]
|
||||
>[, multiSkillB] = multiRobotB : MultiSkilledRobot
|
||||
>[, multiSkillB] : [undefined, [string, string]]
|
||||
> : undefined
|
||||
>multiSkillB : [string, string]
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
[, multiSkillB] = getMultiRobotB();
|
||||
>[, multiSkillB] = getMultiRobotB() : [string, [string, string]]
|
||||
>[, multiSkillB] = getMultiRobotB() : MultiSkilledRobot
|
||||
>[, multiSkillB] : [undefined, [string, string]]
|
||||
> : undefined
|
||||
>multiSkillB : [string, string]
|
||||
>getMultiRobotB() : [string, [string, string]]
|
||||
>getMultiRobotB : () => [string, [string, string]]
|
||||
>getMultiRobotB() : MultiSkilledRobot
|
||||
>getMultiRobotB : () => MultiSkilledRobot
|
||||
|
||||
[, multiSkillB] = ["roomba", ["vaccum", "mopping"]];
|
||||
>[, multiSkillB] = ["roomba", ["vaccum", "mopping"]] : [string, [string, string]]
|
||||
@@ -112,17 +112,17 @@ let multiRobotAInfo: (string | [string, string])[];
|
||||
>"mopping" : "mopping"
|
||||
|
||||
[numberB] = robotB;
|
||||
>[numberB] = robotB : [number, string, string]
|
||||
>[numberB] = robotB : Robot
|
||||
>[numberB] : [number]
|
||||
>numberB : number
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
|
||||
[numberB] = getRobotB();
|
||||
>[numberB] = getRobotB() : [number, string, string]
|
||||
>[numberB] = getRobotB() : Robot
|
||||
>[numberB] : [number]
|
||||
>numberB : number
|
||||
>getRobotB() : [number, string, string]
|
||||
>getRobotB : () => [number, string, string]
|
||||
>getRobotB() : Robot
|
||||
>getRobotB : () => Robot
|
||||
|
||||
[numberB] = [2, "trimmer", "trimming"];
|
||||
>[numberB] = [2, "trimmer", "trimming"] : [number, string, string]
|
||||
@@ -134,17 +134,17 @@ let multiRobotAInfo: (string | [string, string])[];
|
||||
>"trimming" : "trimming"
|
||||
|
||||
[nameMB] = multiRobotB;
|
||||
>[nameMB] = multiRobotB : [string, [string, string]]
|
||||
>[nameMB] = multiRobotB : MultiSkilledRobot
|
||||
>[nameMB] : [string]
|
||||
>nameMB : string
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
[nameMB] = getMultiRobotB();
|
||||
>[nameMB] = getMultiRobotB() : [string, [string, string]]
|
||||
>[nameMB] = getMultiRobotB() : MultiSkilledRobot
|
||||
>[nameMB] : [string]
|
||||
>nameMB : string
|
||||
>getMultiRobotB() : [string, [string, string]]
|
||||
>getMultiRobotB : () => [string, [string, string]]
|
||||
>getMultiRobotB() : MultiSkilledRobot
|
||||
>getMultiRobotB : () => MultiSkilledRobot
|
||||
|
||||
[nameMB] = ["trimmer", ["trimming", "edging"]];
|
||||
>[nameMB] = ["trimmer", ["trimming", "edging"]] : [string, string[]]
|
||||
@@ -157,21 +157,21 @@ let multiRobotAInfo: (string | [string, string])[];
|
||||
>"edging" : "edging"
|
||||
|
||||
[numberB, nameB, skillB] = robotB;
|
||||
>[numberB, nameB, skillB] = robotB : [number, string, string]
|
||||
>[numberB, nameB, skillB] = robotB : Robot
|
||||
>[numberB, nameB, skillB] : [number, string, string]
|
||||
>numberB : number
|
||||
>nameB : string
|
||||
>skillB : string
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
|
||||
[numberB, nameB, skillB] = getRobotB();
|
||||
>[numberB, nameB, skillB] = getRobotB() : [number, string, string]
|
||||
>[numberB, nameB, skillB] = getRobotB() : Robot
|
||||
>[numberB, nameB, skillB] : [number, string, string]
|
||||
>numberB : number
|
||||
>nameB : string
|
||||
>skillB : string
|
||||
>getRobotB() : [number, string, string]
|
||||
>getRobotB : () => [number, string, string]
|
||||
>getRobotB() : Robot
|
||||
>getRobotB : () => Robot
|
||||
|
||||
[numberB, nameB, skillB] = [2, "trimmer", "trimming"];
|
||||
>[numberB, nameB, skillB] = [2, "trimmer", "trimming"] : [number, string, string]
|
||||
@@ -185,23 +185,23 @@ let multiRobotAInfo: (string | [string, string])[];
|
||||
>"trimming" : "trimming"
|
||||
|
||||
[nameMB, [primarySkillB, secondarySkillB]] = multiRobotB;
|
||||
>[nameMB, [primarySkillB, secondarySkillB]] = multiRobotB : [string, [string, string]]
|
||||
>[nameMB, [primarySkillB, secondarySkillB]] = multiRobotB : MultiSkilledRobot
|
||||
>[nameMB, [primarySkillB, secondarySkillB]] : [string, [string, string]]
|
||||
>nameMB : string
|
||||
>[primarySkillB, secondarySkillB] : [string, string]
|
||||
>primarySkillB : string
|
||||
>secondarySkillB : string
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
[nameMB, [primarySkillB, secondarySkillB]] = getMultiRobotB();
|
||||
>[nameMB, [primarySkillB, secondarySkillB]] = getMultiRobotB() : [string, [string, string]]
|
||||
>[nameMB, [primarySkillB, secondarySkillB]] = getMultiRobotB() : MultiSkilledRobot
|
||||
>[nameMB, [primarySkillB, secondarySkillB]] : [string, [string, string]]
|
||||
>nameMB : string
|
||||
>[primarySkillB, secondarySkillB] : [string, string]
|
||||
>primarySkillB : string
|
||||
>secondarySkillB : string
|
||||
>getMultiRobotB() : [string, [string, string]]
|
||||
>getMultiRobotB : () => [string, [string, string]]
|
||||
>getMultiRobotB() : MultiSkilledRobot
|
||||
>getMultiRobotB : () => MultiSkilledRobot
|
||||
|
||||
[nameMB, [primarySkillB, secondarySkillB]] = ["trimmer", ["trimming", "edging"]];
|
||||
>[nameMB, [primarySkillB, secondarySkillB]] = ["trimmer", ["trimming", "edging"]] : [string, [string, string]]
|
||||
@@ -217,48 +217,48 @@ let multiRobotAInfo: (string | [string, string])[];
|
||||
>"edging" : "edging"
|
||||
|
||||
[numberB, ...robotAInfo] = robotB;
|
||||
>[numberB, ...robotAInfo] = robotB : [number, string, string]
|
||||
>[numberB, ...robotAInfo] = robotB : Robot
|
||||
>[numberB, ...robotAInfo] : [number, ...(string | number)[]]
|
||||
>numberB : number
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
|
||||
[numberB, ...robotAInfo] = getRobotB();
|
||||
>[numberB, ...robotAInfo] = getRobotB() : [number, string, string]
|
||||
>[numberB, ...robotAInfo] = getRobotB() : Robot
|
||||
>[numberB, ...robotAInfo] : [number, ...(string | number)[]]
|
||||
>numberB : number
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
>getRobotB() : [number, string, string]
|
||||
>getRobotB : () => [number, string, string]
|
||||
>getRobotB() : Robot
|
||||
>getRobotB : () => Robot
|
||||
|
||||
[numberB, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"];
|
||||
>[numberB, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>[numberB, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"] : Robot
|
||||
>[numberB, ...robotAInfo] : [number, ...(string | number)[]]
|
||||
>numberB : number
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
><Robot>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
><Robot>[2, "trimmer", "trimming"] : Robot
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
>"trimming" : "trimming"
|
||||
|
||||
[...multiRobotAInfo] = multiRobotA;
|
||||
>[...multiRobotAInfo] = multiRobotA : [string, [string, string]]
|
||||
>[...multiRobotAInfo] = multiRobotA : MultiSkilledRobot
|
||||
>[...multiRobotAInfo] : (string | [string, string])[]
|
||||
>...multiRobotAInfo : string | [string, string]
|
||||
>multiRobotAInfo : (string | [string, string])[]
|
||||
>multiRobotA : [string, [string, string]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
|
||||
[...multiRobotAInfo] = getMultiRobotB();
|
||||
>[...multiRobotAInfo] = getMultiRobotB() : [string, [string, string]]
|
||||
>[...multiRobotAInfo] = getMultiRobotB() : MultiSkilledRobot
|
||||
>[...multiRobotAInfo] : (string | [string, string])[]
|
||||
>...multiRobotAInfo : string | [string, string]
|
||||
>multiRobotAInfo : (string | [string, string])[]
|
||||
>getMultiRobotB() : [string, [string, string]]
|
||||
>getMultiRobotB : () => [string, [string, string]]
|
||||
>getMultiRobotB() : MultiSkilledRobot
|
||||
>getMultiRobotB : () => MultiSkilledRobot
|
||||
|
||||
[...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]];
|
||||
>[...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]] : (string | [string, string])[]
|
||||
@@ -285,15 +285,15 @@ if (nameA == nameB) {
|
||||
}
|
||||
|
||||
function getRobotB() {
|
||||
>getRobotB : () => [number, string, string]
|
||||
>getRobotB : () => Robot
|
||||
|
||||
return robotB;
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
}
|
||||
|
||||
function getMultiRobotB() {
|
||||
>getMultiRobotB : () => [string, [string, string]]
|
||||
>getMultiRobotB : () => MultiSkilledRobot
|
||||
|
||||
return multiRobotB;
|
||||
>multiRobotB : [string, [string, string]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
}
|
||||
|
||||
+7
-7
@@ -7,17 +7,17 @@ declare var console: {
|
||||
>msg : string
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
>Robot : [number, string, string]
|
||||
>Robot : Robot
|
||||
|
||||
var robotA: Robot = [1, "mower", "mowing"];
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>[1, "mower", "mowing"] : [number, string, string]
|
||||
>1 : 1
|
||||
>"mower" : "mower"
|
||||
>"mowing" : "mowing"
|
||||
|
||||
var robotB: Robot = [2, "trimmer", "trimming"];
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
@@ -27,13 +27,13 @@ let [, nameA = "noName"] = robotA;
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>"noName" : "noName"
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
|
||||
let [numberB = -1] = robotB;
|
||||
>numberB : number
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
|
||||
let [numberA2 = -1, nameA2 = "noName", skillA2 = "noSkill"] = robotA;
|
||||
>numberA2 : number
|
||||
@@ -43,7 +43,7 @@ let [numberA2 = -1, nameA2 = "noName", skillA2 = "noSkill"] = robotA;
|
||||
>"noName" : "noName"
|
||||
>skillA2 : string
|
||||
>"noSkill" : "noSkill"
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
|
||||
let [numberC2 = -1] = [3, "edging", "Trimming edges"];
|
||||
>numberC2 : number
|
||||
@@ -72,7 +72,7 @@ let [numberA3 = -1, ...robotAInfo] = robotA;
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>robotAInfo : [string, string]
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
|
||||
if (nameA == nameA2) {
|
||||
>nameA == nameA2 : boolean
|
||||
|
||||
+6
-6
@@ -7,10 +7,10 @@ declare var console: {
|
||||
>msg : string
|
||||
}
|
||||
type MultiSkilledRobot = [string, string[]];
|
||||
>MultiSkilledRobot : [string, string[]]
|
||||
>MultiSkilledRobot : MultiSkilledRobot
|
||||
|
||||
var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>multiRobotA : [string, string[]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>["mower", ["mowing", ""]] : [string, string[]]
|
||||
>"mower" : "mower"
|
||||
>["mowing", ""] : string[]
|
||||
@@ -18,7 +18,7 @@ var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>"" : ""
|
||||
|
||||
var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>multiRobotB : [string, string[]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
>["trimmer", ["trimming", "edging"]] : [string, string[]]
|
||||
>"trimmer" : "trimmer"
|
||||
>["trimming", "edging"] : string[]
|
||||
@@ -31,12 +31,12 @@ let [, skillA = ["noSkill", "noSkill"]] = multiRobotA;
|
||||
>["noSkill", "noSkill"] : string[]
|
||||
>"noSkill" : "noSkill"
|
||||
>"noSkill" : "noSkill"
|
||||
>multiRobotA : [string, string[]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
|
||||
let [nameMB = "noName" ] = multiRobotB;
|
||||
>nameMB : string
|
||||
>"noName" : "noName"
|
||||
>multiRobotB : [string, string[]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
let [nameMA = "noName", [primarySkillA = "noSkill", secondarySkillA = "noSkill"] = ["noSkill", "noSkill"]] = multiRobotA;
|
||||
>nameMA : string
|
||||
@@ -48,7 +48,7 @@ let [nameMA = "noName", [primarySkillA = "noSkill", secondarySkillA = "noSkill"]
|
||||
>["noSkill", "noSkill"] : [string, string]
|
||||
>"noSkill" : "noSkill"
|
||||
>"noSkill" : "noSkill"
|
||||
>multiRobotA : [string, string[]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
|
||||
let [nameMC = "noName" ] = ["roomba", ["vaccum", "mopping"]];
|
||||
>nameMC : string
|
||||
|
||||
+47
-47
@@ -7,27 +7,27 @@ declare var console: {
|
||||
>msg : any
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
>Robot : [number, string, string]
|
||||
>Robot : Robot
|
||||
|
||||
type MultiSkilledRobot = [string, string[]];
|
||||
>MultiSkilledRobot : [string, string[]]
|
||||
>MultiSkilledRobot : MultiSkilledRobot
|
||||
|
||||
var robotA: Robot = [1, "mower", "mowing"];
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
>[1, "mower", "mowing"] : [number, string, string]
|
||||
>1 : 1
|
||||
>"mower" : "mower"
|
||||
>"mowing" : "mowing"
|
||||
|
||||
var robotB: Robot = [2, "trimmer", "trimming"];
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
>"trimming" : "trimming"
|
||||
|
||||
var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>multiRobotA : [string, string[]]
|
||||
>multiRobotA : MultiSkilledRobot
|
||||
>["mower", ["mowing", ""]] : [string, string[]]
|
||||
>"mower" : "mower"
|
||||
>["mowing", ""] : string[]
|
||||
@@ -35,7 +35,7 @@ var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
||||
>"" : ""
|
||||
|
||||
var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
||||
>multiRobotB : [string, string[]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
>["trimmer", ["trimming", "edging"]] : [string, string[]]
|
||||
>"trimmer" : "trimmer"
|
||||
>["trimming", "edging"] : string[]
|
||||
@@ -61,23 +61,23 @@ let multiRobotAInfo: (string | string[])[];
|
||||
>multiRobotAInfo : (string | string[])[]
|
||||
|
||||
[, nameA = "helloNoName"] = robotA;
|
||||
>[, nameA = "helloNoName"] = robotA : [number, string, string]
|
||||
>[, nameA = "helloNoName"] = robotA : Robot
|
||||
>[, nameA = "helloNoName"] : [undefined, string]
|
||||
> : undefined
|
||||
>nameA = "helloNoName" : "helloNoName"
|
||||
>nameA : string
|
||||
>"helloNoName" : "helloNoName"
|
||||
>robotA : [number, string, string]
|
||||
>robotA : Robot
|
||||
|
||||
[, nameB = "helloNoName"] = getRobotB();
|
||||
>[, nameB = "helloNoName"] = getRobotB() : [number, string, string]
|
||||
>[, nameB = "helloNoName"] = getRobotB() : Robot
|
||||
>[, nameB = "helloNoName"] : [undefined, string]
|
||||
> : undefined
|
||||
>nameB = "helloNoName" : "helloNoName"
|
||||
>nameB : string
|
||||
>"helloNoName" : "helloNoName"
|
||||
>getRobotB() : [number, string, string]
|
||||
>getRobotB : () => [number, string, string]
|
||||
>getRobotB() : Robot
|
||||
>getRobotB : () => Robot
|
||||
|
||||
[, nameB = "helloNoName"] = [2, "trimmer", "trimming"];
|
||||
>[, nameB = "helloNoName"] = [2, "trimmer", "trimming"] : [number, string, string]
|
||||
@@ -92,23 +92,23 @@ let multiRobotAInfo: (string | string[])[];
|
||||
>"trimming" : "trimming"
|
||||
|
||||
[, multiSkillB = []] = multiRobotB;
|
||||
>[, multiSkillB = []] = multiRobotB : [string, string[]]
|
||||
>[, multiSkillB = []] = multiRobotB : MultiSkilledRobot
|
||||
>[, multiSkillB = []] : [undefined, undefined[]]
|
||||
> : undefined
|
||||
>multiSkillB = [] : undefined[]
|
||||
>multiSkillB : string[]
|
||||
>[] : undefined[]
|
||||
>multiRobotB : [string, string[]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
[, multiSkillB = []] = getMultiRobotB();
|
||||
>[, multiSkillB = []] = getMultiRobotB() : [string, string[]]
|
||||
>[, multiSkillB = []] = getMultiRobotB() : MultiSkilledRobot
|
||||
>[, multiSkillB = []] : [undefined, undefined[]]
|
||||
> : undefined
|
||||
>multiSkillB = [] : undefined[]
|
||||
>multiSkillB : string[]
|
||||
>[] : undefined[]
|
||||
>getMultiRobotB() : [string, string[]]
|
||||
>getMultiRobotB : () => [string, string[]]
|
||||
>getMultiRobotB() : MultiSkilledRobot
|
||||
>getMultiRobotB : () => MultiSkilledRobot
|
||||
|
||||
[, multiSkillB = []] = ["roomba", ["vaccum", "mopping"]];
|
||||
>[, multiSkillB = []] = ["roomba", ["vaccum", "mopping"]] : [string, string[]]
|
||||
@@ -124,23 +124,23 @@ let multiRobotAInfo: (string | string[])[];
|
||||
>"mopping" : "mopping"
|
||||
|
||||
[numberB = -1] = robotB;
|
||||
>[numberB = -1] = robotB : [number, string, string]
|
||||
>[numberB = -1] = robotB : Robot
|
||||
>[numberB = -1] : [number]
|
||||
>numberB = -1 : -1
|
||||
>numberB : number
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
|
||||
[numberB = -1] = getRobotB();
|
||||
>[numberB = -1] = getRobotB() : [number, string, string]
|
||||
>[numberB = -1] = getRobotB() : Robot
|
||||
>[numberB = -1] : [number]
|
||||
>numberB = -1 : -1
|
||||
>numberB : number
|
||||
>-1 : -1
|
||||
>1 : 1
|
||||
>getRobotB() : [number, string, string]
|
||||
>getRobotB : () => [number, string, string]
|
||||
>getRobotB() : Robot
|
||||
>getRobotB : () => Robot
|
||||
|
||||
[numberB = -1] = [2, "trimmer", "trimming"];
|
||||
>[numberB = -1] = [2, "trimmer", "trimming"] : [number, string, string]
|
||||
@@ -155,21 +155,21 @@ let multiRobotAInfo: (string | string[])[];
|
||||
>"trimming" : "trimming"
|
||||
|
||||
[nameMB = "helloNoName"] = multiRobotB;
|
||||
>[nameMB = "helloNoName"] = multiRobotB : [string, string[]]
|
||||
>[nameMB = "helloNoName"] = multiRobotB : MultiSkilledRobot
|
||||
>[nameMB = "helloNoName"] : [string]
|
||||
>nameMB = "helloNoName" : "helloNoName"
|
||||
>nameMB : string
|
||||
>"helloNoName" : "helloNoName"
|
||||
>multiRobotB : [string, string[]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
[nameMB = "helloNoName"] = getMultiRobotB();
|
||||
>[nameMB = "helloNoName"] = getMultiRobotB() : [string, string[]]
|
||||
>[nameMB = "helloNoName"] = getMultiRobotB() : MultiSkilledRobot
|
||||
>[nameMB = "helloNoName"] : [string]
|
||||
>nameMB = "helloNoName" : "helloNoName"
|
||||
>nameMB : string
|
||||
>"helloNoName" : "helloNoName"
|
||||
>getMultiRobotB() : [string, string[]]
|
||||
>getMultiRobotB : () => [string, string[]]
|
||||
>getMultiRobotB() : MultiSkilledRobot
|
||||
>getMultiRobotB : () => MultiSkilledRobot
|
||||
|
||||
[nameMB = "helloNoName"] = ["trimmer", ["trimming", "edging"]];
|
||||
>[nameMB = "helloNoName"] = ["trimmer", ["trimming", "edging"]] : [string, string[]]
|
||||
@@ -184,7 +184,7 @@ let multiRobotAInfo: (string | string[])[];
|
||||
>"edging" : "edging"
|
||||
|
||||
[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = robotB;
|
||||
>[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = robotB : [number, string, string]
|
||||
>[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = robotB : Robot
|
||||
>[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] : [number, string, string]
|
||||
>numberB = -1 : -1
|
||||
>numberB : number
|
||||
@@ -196,10 +196,10 @@ let multiRobotAInfo: (string | string[])[];
|
||||
>skillB = "noSkill" : "noSkill"
|
||||
>skillB : string
|
||||
>"noSkill" : "noSkill"
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
|
||||
[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = getRobotB();
|
||||
>[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = getRobotB() : [number, string, string]
|
||||
>[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = getRobotB() : Robot
|
||||
>[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] : [number, string, string]
|
||||
>numberB = -1 : -1
|
||||
>numberB : number
|
||||
@@ -211,8 +211,8 @@ let multiRobotAInfo: (string | string[])[];
|
||||
>skillB = "noSkill" : "noSkill"
|
||||
>skillB : string
|
||||
>"noSkill" : "noSkill"
|
||||
>getRobotB() : [number, string, string]
|
||||
>getRobotB : () => [number, string, string]
|
||||
>getRobotB() : Robot
|
||||
>getRobotB : () => Robot
|
||||
|
||||
[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = [2, "trimmer", "trimming"];
|
||||
>[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = [2, "trimmer", "trimming"] : [number, string, string]
|
||||
@@ -233,7 +233,7 @@ let multiRobotAInfo: (string | string[])[];
|
||||
>"trimming" : "trimming"
|
||||
|
||||
[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = multiRobotB;
|
||||
>[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = multiRobotB : [string, string[]]
|
||||
>[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = multiRobotB : MultiSkilledRobot
|
||||
>[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] : [string, []]
|
||||
>nameMB = "helloNoName" : "helloNoName"
|
||||
>nameMB : string
|
||||
@@ -247,10 +247,10 @@ let multiRobotAInfo: (string | string[])[];
|
||||
>secondarySkillB : string
|
||||
>"noSkill" : "noSkill"
|
||||
>[] : []
|
||||
>multiRobotB : [string, string[]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
|
||||
[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = getMultiRobotB();
|
||||
>[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = getMultiRobotB() : [string, string[]]
|
||||
>[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = getMultiRobotB() : MultiSkilledRobot
|
||||
>[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] : [string, []]
|
||||
>nameMB = "helloNoName" : "helloNoName"
|
||||
>nameMB : string
|
||||
@@ -264,8 +264,8 @@ let multiRobotAInfo: (string | string[])[];
|
||||
>secondarySkillB : string
|
||||
>"noSkill" : "noSkill"
|
||||
>[] : []
|
||||
>getMultiRobotB() : [string, string[]]
|
||||
>getMultiRobotB : () => [string, string[]]
|
||||
>getMultiRobotB() : MultiSkilledRobot
|
||||
>getMultiRobotB : () => MultiSkilledRobot
|
||||
|
||||
[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] =
|
||||
>[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = ["trimmer", ["trimming", "edging"]] : [string, [string, string]]
|
||||
@@ -291,7 +291,7 @@ let multiRobotAInfo: (string | string[])[];
|
||||
>"edging" : "edging"
|
||||
|
||||
[numberB = -1, ...robotAInfo] = robotB;
|
||||
>[numberB = -1, ...robotAInfo] = robotB : [number, string, string]
|
||||
>[numberB = -1, ...robotAInfo] = robotB : Robot
|
||||
>[numberB = -1, ...robotAInfo] : [number, ...(string | number)[]]
|
||||
>numberB = -1 : -1
|
||||
>numberB : number
|
||||
@@ -299,10 +299,10 @@ let multiRobotAInfo: (string | string[])[];
|
||||
>1 : 1
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
|
||||
[numberB = -1, ...robotAInfo] = getRobotB();
|
||||
>[numberB = -1, ...robotAInfo] = getRobotB() : [number, string, string]
|
||||
>[numberB = -1, ...robotAInfo] = getRobotB() : Robot
|
||||
>[numberB = -1, ...robotAInfo] : [number, ...(string | number)[]]
|
||||
>numberB = -1 : -1
|
||||
>numberB : number
|
||||
@@ -310,11 +310,11 @@ let multiRobotAInfo: (string | string[])[];
|
||||
>1 : 1
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
>getRobotB() : [number, string, string]
|
||||
>getRobotB : () => [number, string, string]
|
||||
>getRobotB() : Robot
|
||||
>getRobotB : () => Robot
|
||||
|
||||
[numberB = -1, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"];
|
||||
>[numberB = -1, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>[numberB = -1, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"] : Robot
|
||||
>[numberB = -1, ...robotAInfo] : [number, ...(string | number)[]]
|
||||
>numberB = -1 : -1
|
||||
>numberB : number
|
||||
@@ -322,7 +322,7 @@ let multiRobotAInfo: (string | string[])[];
|
||||
>1 : 1
|
||||
>...robotAInfo : string | number
|
||||
>robotAInfo : (string | number)[]
|
||||
><Robot>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
><Robot>[2, "trimmer", "trimming"] : Robot
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : 2
|
||||
>"trimmer" : "trimmer"
|
||||
@@ -342,15 +342,15 @@ if (nameA == nameB) {
|
||||
}
|
||||
|
||||
function getRobotB() {
|
||||
>getRobotB : () => [number, string, string]
|
||||
>getRobotB : () => Robot
|
||||
|
||||
return robotB;
|
||||
>robotB : [number, string, string]
|
||||
>robotB : Robot
|
||||
}
|
||||
|
||||
function getMultiRobotB() {
|
||||
>getMultiRobotB : () => [string, string[]]
|
||||
>getMultiRobotB : () => MultiSkilledRobot
|
||||
|
||||
return multiRobotB;
|
||||
>multiRobotB : [string, string[]]
|
||||
>multiRobotB : MultiSkilledRobot
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@ type ErrorMsg<INPUT> =
|
||||
>field : string
|
||||
|
||||
export type Spec<INPUT, ROOTINPUT = any> = [Predicate<INPUT, ROOTINPUT>, ErrorMsg<INPUT>];
|
||||
>Spec : [Predicate<INPUT, ROOTINPUT>, ErrorMsg<INPUT>]
|
||||
>Spec : Spec<INPUT, ROOTINPUT>
|
||||
|
||||
export type SpecArray<INPUT, ROOTINPUT = any> = Array<Spec<INPUT, ROOTINPUT>>;
|
||||
>SpecArray : [Predicate<INPUT, ROOTINPUT>, ErrorMsg<INPUT>][]
|
||||
>SpecArray : SpecArray<INPUT, ROOTINPUT>
|
||||
|
||||
export type SpecFunction<INPUT, ROOTINPUT = any> = [INPUT] extends [ReadonlyArray<infer U>]
|
||||
>SpecFunction : SpecFunction<INPUT, ROOTINPUT>
|
||||
|
||||
@@ -7,7 +7,7 @@ type FooBase = string | false;
|
||||
>false : false
|
||||
|
||||
type FooArray = FooBase[];
|
||||
>FooArray : FooBase[]
|
||||
>FooArray : FooArray
|
||||
|
||||
declare let foo1: Foo;
|
||||
>foo1 : Foo
|
||||
@@ -20,13 +20,13 @@ foo1 = [...Array.isArray(foo2) ? foo2 : [foo2]];
|
||||
>foo1 : Foo
|
||||
>[...Array.isArray(foo2) ? foo2 : [foo2]] : FooBase[]
|
||||
>...Array.isArray(foo2) ? foo2 : [foo2] : FooBase
|
||||
>Array.isArray(foo2) ? foo2 : [foo2] : FooBase[]
|
||||
>Array.isArray(foo2) ? foo2 : [foo2] : FooArray
|
||||
>Array.isArray(foo2) : boolean
|
||||
>Array.isArray : (arg: any) => arg is any[]
|
||||
>Array : ArrayConstructor
|
||||
>isArray : (arg: any) => arg is any[]
|
||||
>foo2 : Foo
|
||||
>foo2 : FooBase[]
|
||||
>foo2 : FooArray
|
||||
>[foo2] : FooBase[]
|
||||
>foo2 : FooBase
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ interface CoachMarkAnchorProps<C> {
|
||||
>anchor : C
|
||||
}
|
||||
type AnchorType<P> = Component<P>;
|
||||
>AnchorType : Component<P, {}>
|
||||
>AnchorType : AnchorType<P>
|
||||
|
||||
class CoachMarkAnchorDecorator {
|
||||
>CoachMarkAnchorDecorator : CoachMarkAnchorDecorator
|
||||
@@ -27,28 +27,28 @@ class CoachMarkAnchorDecorator {
|
||||
return class CoachMarkAnchor extends Component<CoachMarkAnchorProps<AnchorType<P>> & P, {}> {
|
||||
>class CoachMarkAnchor extends Component<CoachMarkAnchorProps<AnchorType<P>> & P, {}> { private _onAnchorRef = (anchor: AnchorType<P>) => { const anchorRef = this.props.anchorRef; if (anchorRef) { anchorRef(anchor); } } } : typeof CoachMarkAnchor
|
||||
>CoachMarkAnchor : typeof CoachMarkAnchor
|
||||
>Component : Component<CoachMarkAnchorProps<Component<P, {}>> & P, {}>
|
||||
>Component : Component<CoachMarkAnchorProps<AnchorType<P>> & P, {}>
|
||||
|
||||
private _onAnchorRef = (anchor: AnchorType<P>) => {
|
||||
>_onAnchorRef : (anchor: Component<P, {}>) => void
|
||||
>(anchor: AnchorType<P>) => { const anchorRef = this.props.anchorRef; if (anchorRef) { anchorRef(anchor); } } : (anchor: Component<P, {}>) => void
|
||||
>anchor : Component<P, {}>
|
||||
>_onAnchorRef : (anchor: AnchorType<P>) => void
|
||||
>(anchor: AnchorType<P>) => { const anchorRef = this.props.anchorRef; if (anchorRef) { anchorRef(anchor); } } : (anchor: AnchorType<P>) => void
|
||||
>anchor : AnchorType<P>
|
||||
|
||||
const anchorRef = this.props.anchorRef;
|
||||
>anchorRef : (CoachMarkAnchorProps<Component<P, {}>> & P)["anchorRef"] | undefined
|
||||
>this.props.anchorRef : (CoachMarkAnchorProps<Component<P, {}>> & P)["anchorRef"] | undefined
|
||||
>this.props : Readonly<{ children?: unknown; }> & Readonly<CoachMarkAnchorProps<Component<P, {}>> & P>
|
||||
>anchorRef : (CoachMarkAnchorProps<AnchorType<P>> & P)["anchorRef"] | undefined
|
||||
>this.props.anchorRef : (CoachMarkAnchorProps<AnchorType<P>> & P)["anchorRef"] | undefined
|
||||
>this.props : Readonly<{ children?: unknown; }> & Readonly<CoachMarkAnchorProps<AnchorType<P>> & P>
|
||||
>this : this
|
||||
>props : Readonly<{ children?: unknown; }> & Readonly<CoachMarkAnchorProps<Component<P, {}>> & P>
|
||||
>anchorRef : (CoachMarkAnchorProps<Component<P, {}>> & P)["anchorRef"] | undefined
|
||||
>props : Readonly<{ children?: unknown; }> & Readonly<CoachMarkAnchorProps<AnchorType<P>> & P>
|
||||
>anchorRef : (CoachMarkAnchorProps<AnchorType<P>> & P)["anchorRef"] | undefined
|
||||
|
||||
if (anchorRef) {
|
||||
>anchorRef : (CoachMarkAnchorProps<Component<P, {}>> & P)["anchorRef"] | undefined
|
||||
>anchorRef : (CoachMarkAnchorProps<AnchorType<P>> & P)["anchorRef"] | undefined
|
||||
|
||||
anchorRef(anchor);
|
||||
>anchorRef(anchor) : void
|
||||
>anchorRef : (anchor: Component<P, {}>) => void
|
||||
>anchor : Component<P, {}>
|
||||
>anchorRef : (anchor: AnchorType<P>) => void
|
||||
>anchor : AnchorType<P>
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,13 +4,13 @@ import * as Bluebird from 'bluebird';
|
||||
>Bluebird : PromiseConstructor
|
||||
|
||||
async function a(): Bluebird<void> {
|
||||
>a : () => Promise<void>
|
||||
>a : () => Bluebird<void>
|
||||
|
||||
try {
|
||||
const b = async function b(): Bluebird<void> {
|
||||
>b : () => Promise<void>
|
||||
>async function b(): Bluebird<void> { try { await Bluebird.resolve(); // -- remove this and it compiles } catch (error) { } } : () => Promise<void>
|
||||
>b : () => Promise<void>
|
||||
>b : () => Bluebird<void>
|
||||
>async function b(): Bluebird<void> { try { await Bluebird.resolve(); // -- remove this and it compiles } catch (error) { } } : () => Bluebird<void>
|
||||
>b : () => Bluebird<void>
|
||||
|
||||
try {
|
||||
await Bluebird.resolve(); // -- remove this and it compiles
|
||||
@@ -27,8 +27,8 @@ async function a(): Bluebird<void> {
|
||||
|
||||
await b(); // -- or remove this and it compiles
|
||||
>await b() : void
|
||||
>b() : Promise<void>
|
||||
>b : () => Promise<void>
|
||||
>b() : Bluebird<void>
|
||||
>b : () => Bluebird<void>
|
||||
|
||||
} catch (error) { }
|
||||
>error : any
|
||||
@@ -39,12 +39,12 @@ declare module "bluebird" {
|
||||
>"bluebird" : typeof import("bluebird")
|
||||
|
||||
type Bluebird<T> = Promise<T>;
|
||||
>Bluebird : Promise<T>
|
||||
>Bluebird : Bluebird<T>
|
||||
|
||||
const Bluebird: typeof Promise;
|
||||
>Bluebird : PromiseConstructor
|
||||
>Promise : PromiseConstructor
|
||||
|
||||
export = Bluebird;
|
||||
>Bluebird : Promise<T>
|
||||
>Bluebird : Bluebird<T>
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ interface CustomButtonProps extends ButtonProps {
|
||||
}
|
||||
|
||||
const CustomButton: React.SFC<CustomButtonProps> = props => <Button {...props} />;
|
||||
>CustomButton : React.StatelessComponent<CustomButtonProps>
|
||||
>CustomButton : React.SFC<CustomButtonProps>
|
||||
>React : any
|
||||
>props => <Button {...props} /> : (props: CustomButtonProps & { children?: React.ReactNode; }) => JSX.Element
|
||||
>props : CustomButtonProps & { children?: React.ReactNode; }
|
||||
|
||||
@@ -12,7 +12,7 @@ export interface ClickableProps {
|
||||
|
||||
export interface ButtonProps extends ClickableProps {
|
||||
onClick: React.MouseEventHandler<any>;
|
||||
>onClick : React.EventHandler<React.MouseEvent<any>>
|
||||
>onClick : React.MouseEventHandler<any>
|
||||
>React : any
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ export interface ClickableProps {
|
||||
|
||||
export interface ButtonProps extends ClickableProps {
|
||||
onClick: React.MouseEventHandler<any>;
|
||||
>onClick : React.EventHandler<React.MouseEvent<any>>
|
||||
>onClick : React.MouseEventHandler<any>
|
||||
>React : any
|
||||
}
|
||||
|
||||
|
||||
@@ -183,22 +183,22 @@ f15(E.x).toLowerCase();
|
||||
>toLowerCase : () => string
|
||||
|
||||
type StringAndBoolean = [string, boolean]
|
||||
>StringAndBoolean : [string, boolean]
|
||||
>StringAndBoolean : StringAndBoolean
|
||||
|
||||
declare function f16(s: StringAndBoolean): string;
|
||||
>f16 : (s: [string, boolean]) => string
|
||||
>s : [string, boolean]
|
||||
>f16 : (s: StringAndBoolean) => string
|
||||
>s : StringAndBoolean
|
||||
|
||||
var x: [string, boolean];
|
||||
>x : [string, boolean]
|
||||
|
||||
f16(x);
|
||||
>f16(x) : string
|
||||
>f16 : (s: [string, boolean]) => string
|
||||
>f16 : (s: StringAndBoolean) => string
|
||||
>x : [string, boolean]
|
||||
|
||||
var y: StringAndBoolean = ["1", false];
|
||||
>y : [string, boolean]
|
||||
>y : StringAndBoolean
|
||||
>["1", false] : [string, false]
|
||||
>"1" : "1"
|
||||
>false : false
|
||||
@@ -207,7 +207,7 @@ y[0].toLowerCase();
|
||||
>y[0].toLowerCase() : string
|
||||
>y[0].toLowerCase : () => string
|
||||
>y[0] : string
|
||||
>y : [string, boolean]
|
||||
>y : StringAndBoolean
|
||||
>0 : 0
|
||||
>toLowerCase : () => string
|
||||
|
||||
|
||||
@@ -208,10 +208,10 @@ interface Y {
|
||||
}
|
||||
|
||||
type A = ["aa", number];
|
||||
>A : ["aa", number]
|
||||
>A : A
|
||||
|
||||
type B = ["bb", string];
|
||||
>B : ["bb", string]
|
||||
>B : B
|
||||
|
||||
type Z = X | Y;
|
||||
>Z : Z
|
||||
@@ -271,7 +271,7 @@ function check(z: Z, c: C) {
|
||||
var aa: number = c[1] // should be number
|
||||
>aa : number
|
||||
>c[1] : number
|
||||
>c : ["aa", number]
|
||||
>c : A
|
||||
>1 : 1
|
||||
|
||||
break;
|
||||
@@ -281,7 +281,7 @@ function check(z: Z, c: C) {
|
||||
var bb: string = c[1] // should be string
|
||||
>bb : string
|
||||
>c[1] : string
|
||||
>c : ["bb", string]
|
||||
>c : B
|
||||
>1 : 1
|
||||
|
||||
break;
|
||||
|
||||
+2
-2
@@ -42,8 +42,8 @@ let test1: Test1<number>;
|
||||
// not generic parameter default
|
||||
interface Test2Base<V, T extends Settable<T, V>> { };
|
||||
type Test2<V> = Test2Base<V, Identity<V>>;
|
||||
>Test2 : Test2Base<V, Identity<V>>
|
||||
>Test2 : Test2<V>
|
||||
|
||||
let test2: Test2<number>;
|
||||
>test2 : Test2Base<number, Identity<number>>
|
||||
>test2 : Test2<number>
|
||||
|
||||
|
||||
@@ -2,25 +2,25 @@
|
||||
// Repro from #12235
|
||||
|
||||
getResults1([]);
|
||||
>getResults1([]) : Result[]
|
||||
>getResults1 : (value: Result[] | { data: Result[]; }) => Result[]
|
||||
>getResults1([]) : Results
|
||||
>getResults1 : (value: Results | { data: Results; }) => Results
|
||||
>[] : undefined[]
|
||||
|
||||
getResults1({data: []});
|
||||
>getResults1({data: []}) : Result[]
|
||||
>getResults1 : (value: Result[] | { data: Result[]; }) => Result[]
|
||||
>getResults1({data: []}) : Results
|
||||
>getResults1 : (value: Results | { data: Results; }) => Results
|
||||
>{data: []} : { data: undefined[]; }
|
||||
>data : undefined[]
|
||||
>[] : undefined[]
|
||||
|
||||
getResults2([]);
|
||||
>getResults2([]) : Result[]
|
||||
>getResults2 : (value: Result[] | { data: Result[]; }) => Result[]
|
||||
>getResults2([]) : Results
|
||||
>getResults2 : (value: Results | { data: Results; }) => Results
|
||||
>[] : undefined[]
|
||||
|
||||
getResults2({data: []});
|
||||
>getResults2({data: []}) : Result[]
|
||||
>getResults2 : (value: Result[] | { data: Result[]; }) => Result[]
|
||||
>getResults2({data: []}) : Results
|
||||
>getResults2 : (value: Results | { data: Results; }) => Results
|
||||
>{data: []} : { data: undefined[]; }
|
||||
>data : undefined[]
|
||||
>[] : undefined[]
|
||||
@@ -30,7 +30,7 @@ type Result = { value: string };
|
||||
>value : string
|
||||
|
||||
type Results = Result[];
|
||||
>Results : Result[]
|
||||
>Results : Results
|
||||
|
||||
function isResponseInData<T>(value: T | { data: T}): value is { data: T } {
|
||||
>isResponseInData : <T>(value: T | { data: T; }) => value is { data: T; }
|
||||
@@ -47,19 +47,19 @@ function isResponseInData<T>(value: T | { data: T}): value is { data: T } {
|
||||
}
|
||||
|
||||
function getResults1(value: Results | { data: Results }): Results {
|
||||
>getResults1 : (value: Result[] | { data: Result[]; }) => Result[]
|
||||
>value : Result[] | { data: Result[]; }
|
||||
>data : Result[]
|
||||
>getResults1 : (value: Results | { data: Results; }) => Results
|
||||
>value : Results | { data: Results; }
|
||||
>data : Results
|
||||
|
||||
return isResponseInData(value) ? value.data : value;
|
||||
>isResponseInData(value) ? value.data : value : Result[]
|
||||
>isResponseInData(value) ? value.data : value : Results
|
||||
>isResponseInData(value) : boolean
|
||||
>isResponseInData : <T>(value: T | { data: T; }) => value is { data: T; }
|
||||
>value : Result[] | { data: Result[]; }
|
||||
>value.data : Result[]
|
||||
>value : { data: Result[]; }
|
||||
>data : Result[]
|
||||
>value : Result[]
|
||||
>value : Results | { data: Results; }
|
||||
>value.data : Results
|
||||
>value : { data: Results; }
|
||||
>data : Results
|
||||
>value : Results
|
||||
}
|
||||
|
||||
function isPlainResponse<T>(value: T | { data: T}): value is T {
|
||||
@@ -77,17 +77,17 @@ function isPlainResponse<T>(value: T | { data: T}): value is T {
|
||||
}
|
||||
|
||||
function getResults2(value: Results | { data: Results }): Results {
|
||||
>getResults2 : (value: Result[] | { data: Result[]; }) => Result[]
|
||||
>value : Result[] | { data: Result[]; }
|
||||
>data : Result[]
|
||||
>getResults2 : (value: Results | { data: Results; }) => Results
|
||||
>value : Results | { data: Results; }
|
||||
>data : Results
|
||||
|
||||
return isPlainResponse(value) ? value : value.data;
|
||||
>isPlainResponse(value) ? value : value.data : Result[]
|
||||
>isPlainResponse(value) ? value : value.data : Results
|
||||
>isPlainResponse(value) : boolean
|
||||
>isPlainResponse : <T>(value: T | { data: T; }) => value is T
|
||||
>value : Result[] | { data: Result[]; }
|
||||
>value : Result[]
|
||||
>value.data : Result[]
|
||||
>value : { data: Result[]; }
|
||||
>data : Result[]
|
||||
>value : Results | { data: Results; }
|
||||
>value : Results
|
||||
>value.data : Results
|
||||
>value : { data: Results; }
|
||||
>data : Results
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ type B =
|
||||
>type : "DECREMENT"
|
||||
|
||||
type C = [| 0 | 1, | "foo" | "bar"];
|
||||
>C : [0 | 1, "foo" | "bar"]
|
||||
>C : C
|
||||
|
||||
export type D =
|
||||
>D : D
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
tests/cases/conformance/types/tuple/unionsOfTupleTypes1.ts(8,15): error TS2493: Tuple type '[string, number]' of length '2' has no element at index '2'.
|
||||
tests/cases/conformance/types/tuple/unionsOfTupleTypes1.ts(8,15): error TS2493: Tuple type 'T1' of length '2' has no element at index '2'.
|
||||
tests/cases/conformance/types/tuple/unionsOfTupleTypes1.ts(13,15): error TS2339: Property '2' does not exist on type 'T2'.
|
||||
tests/cases/conformance/types/tuple/unionsOfTupleTypes1.ts(27,20): error TS2493: Tuple type '[string, number]' of length '2' has no element at index '2'.
|
||||
tests/cases/conformance/types/tuple/unionsOfTupleTypes1.ts(27,20): error TS2493: Tuple type 'T1' of length '2' has no element at index '2'.
|
||||
tests/cases/conformance/types/tuple/unionsOfTupleTypes1.ts(28,20): error TS2339: Property '2' does not exist on type 'T2'.
|
||||
tests/cases/conformance/types/tuple/unionsOfTupleTypes1.ts(31,16): error TS2493: Tuple type '[string, number]' of length '2' has no element at index '2'.
|
||||
tests/cases/conformance/types/tuple/unionsOfTupleTypes1.ts(31,16): error TS2493: Tuple type 'T1' of length '2' has no element at index '2'.
|
||||
tests/cases/conformance/types/tuple/unionsOfTupleTypes1.ts(32,16): error TS2339: Property '2' does not exist on type 'T2'.
|
||||
tests/cases/conformance/types/tuple/unionsOfTupleTypes1.ts(37,18): error TS2493: Tuple type '[string, number]' of length '2' has no element at index '2'.
|
||||
tests/cases/conformance/types/tuple/unionsOfTupleTypes1.ts(37,18): error TS2493: Tuple type 'T1' of length '2' has no element at index '2'.
|
||||
tests/cases/conformance/types/tuple/unionsOfTupleTypes1.ts(41,18): error TS2339: Property '2' does not exist on type 'T2'.
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ tests/cases/conformance/types/tuple/unionsOfTupleTypes1.ts(41,18): error TS2339:
|
||||
type T11 = T1[1]; // number
|
||||
type T12 = T1[2]; // undefined
|
||||
~
|
||||
!!! error TS2493: Tuple type '[string, number]' of length '2' has no element at index '2'.
|
||||
!!! error TS2493: Tuple type 'T1' of length '2' has no element at index '2'.
|
||||
type T1N = T1[number]; // string | number
|
||||
|
||||
type T20 = T2[0]; // string | boolean
|
||||
@@ -41,7 +41,7 @@ tests/cases/conformance/types/tuple/unionsOfTupleTypes1.ts(41,18): error TS2339:
|
||||
function f1(t1: T1, t2: T2, t3: T3, t4: T4, x: number) {
|
||||
let [d10, d11, d12] = t1; // string, number
|
||||
~~~
|
||||
!!! error TS2493: Tuple type '[string, number]' of length '2' has no element at index '2'.
|
||||
!!! error TS2493: Tuple type 'T1' of length '2' has no element at index '2'.
|
||||
let [d20, d21, d22] = t2; // string | boolean, number | undefined
|
||||
~~~
|
||||
!!! error TS2339: Property '2' does not exist on type 'T2'.
|
||||
@@ -49,7 +49,7 @@ tests/cases/conformance/types/tuple/unionsOfTupleTypes1.ts(41,18): error TS2339:
|
||||
let [d40, d41, d42] = t4; // string | boolean, number | undefined, number | undefined
|
||||
[d10, d11, d12] = t1;
|
||||
~~~
|
||||
!!! error TS2493: Tuple type '[string, number]' of length '2' has no element at index '2'.
|
||||
!!! error TS2493: Tuple type 'T1' of length '2' has no element at index '2'.
|
||||
[d20, d21, d22] = t2;
|
||||
~~~
|
||||
!!! error TS2339: Property '2' does not exist on type 'T2'.
|
||||
@@ -59,7 +59,7 @@ tests/cases/conformance/types/tuple/unionsOfTupleTypes1.ts(41,18): error TS2339:
|
||||
let t11 = t1[1]; // number
|
||||
let t12 = t1[2]; // undefined
|
||||
~
|
||||
!!! error TS2493: Tuple type '[string, number]' of length '2' has no element at index '2'.
|
||||
!!! error TS2493: Tuple type 'T1' of length '2' has no element at index '2'.
|
||||
let t1x = t1[x]; // string | number
|
||||
let t20 = t2[0]; // string | boolean
|
||||
let t21 = t2[1]; // number | undefined
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
=== tests/cases/conformance/types/tuple/unionsOfTupleTypes1.ts ===
|
||||
type T1 = [string, number];
|
||||
>T1 : [string, number]
|
||||
>T1 : T1
|
||||
|
||||
type T2 = [boolean] | [string, number];
|
||||
>T2 : T2
|
||||
|
||||
type T3 = [string, ...number[]];
|
||||
>T3 : [string, ...number[]]
|
||||
>T3 : T3
|
||||
|
||||
type T4 = [boolean] | [string, ...number[]];
|
||||
>T4 : T4
|
||||
@@ -60,10 +60,10 @@ type T4N = T4[number]; // string | number | boolean
|
||||
>T4N : string | number | boolean
|
||||
|
||||
function f1(t1: T1, t2: T2, t3: T3, t4: T4, x: number) {
|
||||
>f1 : (t1: [string, number], t2: T2, t3: [string, ...number[]], t4: T4, x: number) => void
|
||||
>t1 : [string, number]
|
||||
>f1 : (t1: T1, t2: T2, t3: T3, t4: T4, x: number) => void
|
||||
>t1 : T1
|
||||
>t2 : T2
|
||||
>t3 : [string, ...number[]]
|
||||
>t3 : T3
|
||||
>t4 : T4
|
||||
>x : number
|
||||
|
||||
@@ -71,7 +71,7 @@ function f1(t1: T1, t2: T2, t3: T3, t4: T4, x: number) {
|
||||
>d10 : string
|
||||
>d11 : number
|
||||
>d12 : undefined
|
||||
>t1 : [string, number]
|
||||
>t1 : T1
|
||||
|
||||
let [d20, d21, d22] = t2; // string | boolean, number | undefined
|
||||
>d20 : string | boolean
|
||||
@@ -83,7 +83,7 @@ function f1(t1: T1, t2: T2, t3: T3, t4: T4, x: number) {
|
||||
>d30 : string
|
||||
>d31 : number
|
||||
>d32 : number
|
||||
>t3 : [string, ...number[]]
|
||||
>t3 : T3
|
||||
|
||||
let [d40, d41, d42] = t4; // string | boolean, number | undefined, number | undefined
|
||||
>d40 : string | boolean
|
||||
@@ -92,12 +92,12 @@ function f1(t1: T1, t2: T2, t3: T3, t4: T4, x: number) {
|
||||
>t4 : T4
|
||||
|
||||
[d10, d11, d12] = t1;
|
||||
>[d10, d11, d12] = t1 : [string, number]
|
||||
>[d10, d11, d12] = t1 : T1
|
||||
>[d10, d11, d12] : [string, number, undefined]
|
||||
>d10 : string
|
||||
>d11 : number
|
||||
>d12 : undefined
|
||||
>t1 : [string, number]
|
||||
>t1 : T1
|
||||
|
||||
[d20, d21, d22] = t2;
|
||||
>[d20, d21, d22] = t2 : T2
|
||||
@@ -108,12 +108,12 @@ function f1(t1: T1, t2: T2, t3: T3, t4: T4, x: number) {
|
||||
>t2 : T2
|
||||
|
||||
[d30, d31, d32] = t3;
|
||||
>[d30, d31, d32] = t3 : [string, ...number[]]
|
||||
>[d30, d31, d32] = t3 : T3
|
||||
>[d30, d31, d32] : [string, number, number]
|
||||
>d30 : string
|
||||
>d31 : number
|
||||
>d32 : number
|
||||
>t3 : [string, ...number[]]
|
||||
>t3 : T3
|
||||
|
||||
[d40, d41, d42] = t4;
|
||||
>[d40, d41, d42] = t4 : T4
|
||||
@@ -126,25 +126,25 @@ function f1(t1: T1, t2: T2, t3: T3, t4: T4, x: number) {
|
||||
let t10 = t1[0]; // string
|
||||
>t10 : string
|
||||
>t1[0] : string
|
||||
>t1 : [string, number]
|
||||
>t1 : T1
|
||||
>0 : 0
|
||||
|
||||
let t11 = t1[1]; // number
|
||||
>t11 : number
|
||||
>t1[1] : number
|
||||
>t1 : [string, number]
|
||||
>t1 : T1
|
||||
>1 : 1
|
||||
|
||||
let t12 = t1[2]; // undefined
|
||||
>t12 : undefined
|
||||
>t1[2] : undefined
|
||||
>t1 : [string, number]
|
||||
>t1 : T1
|
||||
>2 : 2
|
||||
|
||||
let t1x = t1[x]; // string | number
|
||||
>t1x : string | number
|
||||
>t1[x] : string | number
|
||||
>t1 : [string, number]
|
||||
>t1 : T1
|
||||
>x : number
|
||||
|
||||
let t20 = t2[0]; // string | boolean
|
||||
@@ -174,25 +174,25 @@ function f1(t1: T1, t2: T2, t3: T3, t4: T4, x: number) {
|
||||
let t30 = t3[0]; // string
|
||||
>t30 : string
|
||||
>t3[0] : string
|
||||
>t3 : [string, ...number[]]
|
||||
>t3 : T3
|
||||
>0 : 0
|
||||
|
||||
let t31 = t3[1]; // number
|
||||
>t31 : number
|
||||
>t3[1] : number
|
||||
>t3 : [string, ...number[]]
|
||||
>t3 : T3
|
||||
>1 : 1
|
||||
|
||||
let t32 = t3[2]; // number
|
||||
>t32 : number
|
||||
>t3[2] : number
|
||||
>t3 : [string, ...number[]]
|
||||
>t3 : T3
|
||||
>2 : 2
|
||||
|
||||
let t3x = t3[x]; // string | number
|
||||
>t3x : string | number
|
||||
>t3[x] : string | number
|
||||
>t3 : [string, ...number[]]
|
||||
>t3 : T3
|
||||
>x : number
|
||||
|
||||
let t40 = t4[0]; // string | boolean
|
||||
@@ -222,7 +222,7 @@ function f1(t1: T1, t2: T2, t3: T3, t4: T4, x: number) {
|
||||
t1[1] = 42;
|
||||
>t1[1] = 42 : 42
|
||||
>t1[1] : number
|
||||
>t1 : [string, number]
|
||||
>t1 : T1
|
||||
>1 : 1
|
||||
>42 : 42
|
||||
|
||||
@@ -236,7 +236,7 @@ function f1(t1: T1, t2: T2, t3: T3, t4: T4, x: number) {
|
||||
t3[1] = 42;
|
||||
>t3[1] = 42 : 42
|
||||
>t3[1] : number
|
||||
>t3 : [string, ...number[]]
|
||||
>t3 : T3
|
||||
>1 : 1
|
||||
>42 : 42
|
||||
|
||||
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
// @strict: true
|
||||
// @declaration: true
|
||||
|
||||
type ValueOrArray<T> = T | Array<ValueOrArray<T>>;
|
||||
|
||||
const a0: ValueOrArray<number> = 1;
|
||||
const a1: ValueOrArray<number> = [1, [2, 3], [4, [5, [6, 7]]]];
|
||||
|
||||
type HypertextNode = string | [string, { [key: string]: unknown }, ...HypertextNode[]];
|
||||
|
||||
const hypertextNode: HypertextNode =
|
||||
["div", { id: "parent" },
|
||||
["div", { id: "first-child" }, "I'm the first child"],
|
||||
["div", { id: "second-child" }, "I'm the second child"]
|
||||
];
|
||||
|
||||
type Json = string | number | boolean | null | Json[] | { [key: string]: Json };
|
||||
|
||||
let data: Json = {
|
||||
caption: "Test",
|
||||
location: { x: 10, y: 20 },
|
||||
values: [true, [10, 20], null]
|
||||
};
|
||||
|
||||
interface Box<T> { value: T };
|
||||
|
||||
type T1 = Box<T1>;
|
||||
type T2 = Box<Box<T2>>;
|
||||
type T3 = Box<Box<Box<T3>>>;
|
||||
|
||||
function f1(t1: T1, t2: T2, t3: T3) {
|
||||
t1 = t2;
|
||||
t1 = t3;
|
||||
t2 = t1;
|
||||
t2 = t3;
|
||||
t3 = t1;
|
||||
t3 = t2;
|
||||
}
|
||||
|
||||
type Box1 = Box<Box1> | number;
|
||||
|
||||
const b10: Box1 = 42;
|
||||
const b11: Box1 = { value: 42 };
|
||||
const b12: Box1 = { value: { value: { value: 42 }}};
|
||||
|
||||
type Box2 = Box<Box2 | number>;
|
||||
|
||||
const b20: Box2 = 42; // Error
|
||||
const b21: Box2 = { value: 42 };
|
||||
const b22: Box2 = { value: { value: { value: 42 }}};
|
||||
|
||||
type RecArray<T> = Array<T | RecArray<T>>;
|
||||
|
||||
declare function flat<T>(a: RecArray<T>): Array<T>;
|
||||
declare function flat1<T>(a: Array<T | Array<T>>): Array<T>
|
||||
declare function flat2<T>(a: Array<T | Array<T | Array<T>>>): Array<T>;
|
||||
|
||||
flat([1, [2, [3]]]); // number[]
|
||||
flat([[[0]]]); // number[]
|
||||
flat([[[[[[[[[[[4]]]]]]]]]]]); // number[]
|
||||
flat([1, 'a', [2]]); // (string | number)[]
|
||||
flat([1, [2, 'a']]); // (string | number)[]
|
||||
flat([1, ['a']]); // Error
|
||||
|
||||
flat1([1, [2, [3]]]); // (number | number[])[]
|
||||
flat1([[[0]]]); // number[][]
|
||||
flat1([1, 'a', [2]]); // (string | number)[]
|
||||
flat1([1, [2, 'a']]); // (string | number)[]
|
||||
flat1([1, ['a']]); // Error
|
||||
|
||||
flat2([1, [2, [3]]]); // number[]
|
||||
flat2([[[0]]]); // number[]
|
||||
flat2([1, 'a', [2]]); // (string | number)[]
|
||||
flat2([1, [2, 'a']]); // (string | number)[]
|
||||
flat2([1, ['a']]); // Error
|
||||
|
||||
type T10 = T10[];
|
||||
type T11 = readonly T11[];
|
||||
type T12 = (T12)[];
|
||||
type T13 = T13[] | string;
|
||||
type T14 = T14[] & { x: string };
|
||||
type T15<X> = X extends string ? T15<X>[] : never;
|
||||
@@ -10,8 +10,8 @@ verify.codeFix({
|
||||
`type MyType = [string, number];
|
||||
interface I { x: MyType; test(a: MyType): void; }
|
||||
class C implements I {
|
||||
x: [string, number];
|
||||
test(a: [string, number]): void {
|
||||
x: MyType;
|
||||
test(a: MyType): void {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}`,
|
||||
|
||||
Reference in New Issue
Block a user