diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 007edacadc958..265505bd68904 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1980,15 +1980,12 @@ namespace ts { } return _displayBuilder || (_displayBuilder = { - symbolToString: symbolToString, - typeToString: typeToString, buildSymbolDisplay: buildSymbolDisplay, buildTypeDisplay: buildTypeDisplay, buildTypeParameterDisplay: buildTypeParameterDisplay, buildParameterDisplay: buildParameterDisplay, buildDisplayForParametersAndDelimiters: buildDisplayForParametersAndDelimiters, buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, - buildDisplayForTypeArgumentsAndDelimiters: buildDisplayForTypeArgumentsAndDelimiters, buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol, buildSignatureDisplay: buildSignatureDisplay, buildReturnTypeDisplay: buildReturnTypeDisplay @@ -3068,42 +3065,55 @@ namespace ts { setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); } - function signatureListsIdentical(s: Signature[], t: Signature[]): boolean { - if (s.length !== t.length) { - return false; + function findMatchingSignature(signature: Signature, signatureList: Signature[]): Signature { + for (let s of signatureList) { + // Only signatures with no type parameters may differ in return types + if (compareSignatures(signature, s, /*compareReturnTypes*/ !!signature.typeParameters, compareTypes)) { + return s; + } } - for (let i = 0; i < s.length; i++) { - if (!compareSignatures(s[i], t[i], /*compareReturnTypes*/ false, compareTypes)) { - return false; + } + + function findMatchingSignatures(signature: Signature, signatureLists: Signature[][]): Signature[] { + let result: Signature[] = undefined; + for (let i = 1; i < signatureLists.length; i++) { + let match = findMatchingSignature(signature, signatureLists[i]); + if (!match) { + return undefined; + } + if (!result) { + result = [signature]; + } + if (match !== signature) { + result.push(match); } } - return true; + return result; } - // If the lists of call or construct signatures in the given types are all identical except for return types, - // and if none of the signatures are generic, return a list of signatures that has substitutes a union of the - // return types of the corresponding signatures in each resulting signature. + // The signatures of a union type are those signatures that are present and identical in each of the + // constituent types, except that non-generic signatures may differ in return types. When signatures + // differ in return types, the resulting return type is the union of the constituent return types. function getUnionSignatures(types: Type[], kind: SignatureKind): Signature[] { let signatureLists = map(types, t => getSignaturesOfType(t, kind)); - let signatures = signatureLists[0]; - for (let signature of signatures) { - if (signature.typeParameters) { - return emptyArray; - } - } - for (let i = 1; i < signatureLists.length; i++) { - if (!signatureListsIdentical(signatures, signatureLists[i])) { - return emptyArray; + let result: Signature[] = undefined; + for (let source of signatureLists[0]) { + let unionSignatures = findMatchingSignatures(source, signatureLists); + if (unionSignatures) { + let signature: Signature = undefined; + if (unionSignatures.length === 1 || source.typeParameters) { + signature = source; + } + else { + signature = cloneSignature(source); + // Clear resolved return type we possibly got from cloneSignature + signature.resolvedReturnType = undefined; + signature.unionSignatures = unionSignatures; + } + (result || (result = [])).push(signature); } } - let result = map(signatures, cloneSignature); - for (var i = 0; i < result.length; i++) { - let s = result[i]; - // Clear resolved return type we possibly got from cloneSignature - s.resolvedReturnType = undefined; - s.unionSignatures = map(signatureLists, signatures => signatures[i]); - } - return result; + return result || emptyArray; } function getUnionIndexType(types: Type[], kind: IndexKind): Type { @@ -3263,9 +3273,6 @@ namespace ts { * type itself. Note that the apparent type of a union type is the union type itself. */ function getApparentType(type: Type): Type { - if (type.flags & TypeFlags.Union) { - type = getReducedTypeOfUnionType(type); - } if (type.flags & TypeFlags.TypeParameter) { do { type = getConstraintOfTypeParameter(type); @@ -3370,6 +3377,29 @@ namespace ts { return undefined; } + // Check if a property with the given name is known anywhere in the given type. In an object + // type, a property is considered known if the object type is empty, if it has any index + // signatures, or if the property is actually declared in the type. In a union or intersection + // type, a property is considered known if it is known in any constituent type. + function isKnownProperty(type: Type, name: string): boolean { + if (type.flags & TypeFlags.ObjectType && type !== globalObjectType) { + var resolved = resolveStructuredTypeMembers(type); + return !!(resolved.properties.length === 0 || + resolved.stringIndexType || + resolved.numberIndexType || + getPropertyOfType(type, name)); + } + if (type.flags & TypeFlags.UnionOrIntersection) { + for (let t of (type).types) { + if (isKnownProperty(t, name)) { + return true; + } + } + return false; + } + return true; + } + function getSignaturesOfStructuredType(type: Type, kind: SignatureKind): Signature[] { if (type.flags & TypeFlags.StructuredType) { let resolved = resolveStructuredTypeMembers(type); @@ -3979,26 +4009,79 @@ namespace ts { } } - function isSubtypeOfAny(candidate: Type, types: Type[]): boolean { + function isObjectLiteralTypeDuplicateOf(source: ObjectType, target: ObjectType): boolean { + let sourceProperties = getPropertiesOfObjectType(source); + let targetProperties = getPropertiesOfObjectType(target); + if (sourceProperties.length !== targetProperties.length) { + return false; + } + for (let sourceProp of sourceProperties) { + let targetProp = getPropertyOfObjectType(target, sourceProp.name); + if (!targetProp || + getDeclarationFlagsFromSymbol(targetProp) & (NodeFlags.Private | NodeFlags.Protected) || + !isTypeDuplicateOf(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp))) { + return false; + } + } + return true; + } + + function isTupleTypeDuplicateOf(source: TupleType, target: TupleType): boolean { + let sourceTypes = source.elementTypes; + let targetTypes = target.elementTypes; + if (sourceTypes.length !== targetTypes.length) { + return false; + } + for (var i = 0; i < sourceTypes.length; i++) { + if (!isTypeDuplicateOf(sourceTypes[i], targetTypes[i])) { + return false; + } + } + return true; + } + + // Returns true if the source type is a duplicate of the target type. A source type is a duplicate of + // a target type if the the two are identical, with the exception that the source type may have null or + // undefined in places where the target type doesn't. This is by design an asymmetric relationship. + function isTypeDuplicateOf(source: Type, target: Type): boolean { + if (source === target) { + return true; + } + if (source.flags & TypeFlags.Undefined || source.flags & TypeFlags.Null && !(target.flags & TypeFlags.Undefined)) { + return true; + } + if (source.flags & TypeFlags.ObjectLiteral && target.flags & TypeFlags.ObjectType) { + return isObjectLiteralTypeDuplicateOf(source, target); + } + if (isArrayType(source) && isArrayType(target)) { + return isTypeDuplicateOf((source).typeArguments[0], (target).typeArguments[0]); + } + if (isTupleType(source) && isTupleType(target)) { + return isTupleTypeDuplicateOf(source, target); + } + return isTypeIdenticalTo(source, target); + } + + function isTypeDuplicateOfSomeType(candidate: Type, types: Type[]): boolean { for (let type of types) { - if (candidate !== type && isTypeSubtypeOf(candidate, type)) { + if (candidate !== type && isTypeDuplicateOf(candidate, type)) { return true; } } return false; } - function removeSubtypes(types: Type[]) { + function removeDuplicateTypes(types: Type[]) { let i = types.length; while (i > 0) { i--; - if (isSubtypeOfAny(types[i], types)) { + if (isTypeDuplicateOfSomeType(types[i], types)) { types.splice(i, 1); } } } - function containsTypeAny(types: Type[]) { + function containsTypeAny(types: Type[]): boolean { for (let type of types) { if (isTypeAny(type)) { return true; @@ -4017,30 +4100,26 @@ namespace ts { } } - function compareTypeIds(type1: Type, type2: Type): number { - return type1.id - type2.id; - } - - // The noSubtypeReduction flag is there because it isn't possible to always do subtype reduction. The flag - // is true when creating a union type from a type node and when instantiating a union type. In both of those - // cases subtype reduction has to be deferred to properly support recursive union types. For example, a - // type alias of the form "type Item = string | (() => Item)" cannot be reduced during its declaration. - function getUnionType(types: Type[], noSubtypeReduction?: boolean): Type { + // We always deduplicate the constituent type set based on object identity, but we'll also deduplicate + // based on the structure of the types unless the noDeduplication flag is true, which is the case when + // creating a union type from a type node and when instantiating a union type. In both of those cases, + // structural deduplication has to be deferred to properly support recursive union types. For example, + // a type of the form "type Item = string | (() => Item)" cannot be deduplicated during its declaration. + function getUnionType(types: Type[], noDeduplication?: boolean): Type { if (types.length === 0) { return emptyObjectType; } let typeSet: Type[] = []; addTypesToSet(typeSet, types, TypeFlags.Union); - typeSet.sort(compareTypeIds); - if (noSubtypeReduction) { - if (containsTypeAny(typeSet)) { - return anyType; - } + if (containsTypeAny(typeSet)) { + return anyType; + } + if (noDeduplication) { removeAllButLast(typeSet, undefinedType); removeAllButLast(typeSet, nullType); } else { - removeSubtypes(typeSet); + removeDuplicateTypes(typeSet); } if (typeSet.length === 1) { return typeSet[0]; @@ -4050,38 +4129,19 @@ namespace ts { if (!type) { type = unionTypes[id] = createObjectType(TypeFlags.Union | getWideningFlagsOfTypes(typeSet)); type.types = typeSet; - type.reducedType = noSubtypeReduction ? undefined : type; } return type; } - // Subtype reduction is basically an optimization we do to avoid excessively large union types, which take longer - // to process and look strange in quick info and error messages. Semantically there is no difference between the - // reduced type and the type itself. So, when we detect a circularity we simply say that the reduced type is the - // type itself. - function getReducedTypeOfUnionType(type: UnionType): Type { - if (!type.reducedType) { - type.reducedType = circularType; - let reducedType = getUnionType(type.types, /*noSubtypeReduction*/ false); - if (type.reducedType === circularType) { - type.reducedType = reducedType; - } - } - else if (type.reducedType === circularType) { - type.reducedType = type; - } - return type.reducedType; - } - function getTypeFromUnionTypeNode(node: UnionTypeNode): Type { let links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(map(node.types, getTypeFromTypeNode), /*noSubtypeReduction*/ true); + links.resolvedType = getUnionType(map(node.types, getTypeFromTypeNode), /*noDeduplication*/ true); } return links.resolvedType; } - // We do not perform supertype reduction on intersection types. Intersection types are created only by the & + // We do not perform structural deduplication on intersection types. Intersection types are created only by the & // type operator and we can't reduce those because we want to support recursive intersection types. For example, // a type alias of the form "type List = T & { next: List }" cannot be reduced during its declaration. // Also, unlike union types, the order of the constituent types is preserved in order that overload resolution @@ -4362,7 +4422,7 @@ namespace ts { return createTupleType(instantiateList((type).elementTypes, mapper, instantiateType)); } if (type.flags & TypeFlags.Union) { - return getUnionType(instantiateList((type).types, mapper, instantiateType), /*noSubtypeReduction*/ true); + return getUnionType(instantiateList((type).types, mapper, instantiateType), /*noDeduplication*/ true); } if (type.flags & TypeFlags.Intersection) { return getIntersectionType(instantiateList((type).types, mapper, instantiateType)); @@ -4507,6 +4567,16 @@ namespace ts { errorInfo = chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } + function reportRelationError(message: DiagnosticMessage, source: Type, target: Type) { + let sourceType = typeToString(source); + let targetType = typeToString(target); + if (sourceType === targetType) { + sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType); + targetType = typeToString(target, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType); + } + reportError(message || Diagnostics.Type_0_is_not_assignable_to_type_1, sourceType, targetType); + } + // Compare two types and return // Ternary.True if they are related with no assumptions, // Ternary.Maybe if they are related with assumptions of other relationships, or @@ -4526,7 +4596,23 @@ namespace ts { if (source === numberType && target.flags & TypeFlags.Enum) return Ternary.True; } } + + if (relation !== identityRelation && source.flags & TypeFlags.FreshObjectLiteral) { + if (hasExcessProperties(source, target, reportErrors)) { + if (reportErrors) { + reportRelationError(headMessage, source, target); + } + return Ternary.False; + } + // Above we check for excess properties with respect to the entire target type. When union + // and intersection types are further deconstructed on the target side, we don't want to + // make the check again (as it might fail for a partial target type). Therefore we obtain + // the regular source type and proceed with that. + source = getRegularTypeOfObjectLiteral(source); + } + let saveErrorInfo = errorInfo; + if (source.flags & TypeFlags.Reference && target.flags & TypeFlags.Reference && (source).target === (target).target) { // We have type references to same target type, see if relationship holds for all type arguments if (result = typesRelatedTo((source).typeArguments, (target).typeArguments, reportErrors)) { @@ -4603,18 +4689,22 @@ namespace ts { } if (reportErrors) { - headMessage = headMessage || Diagnostics.Type_0_is_not_assignable_to_type_1; - let sourceType = typeToString(source); - let targetType = typeToString(target); - if (sourceType === targetType) { - sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType); - targetType = typeToString(target, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType); - } - reportError(headMessage, sourceType, targetType); + reportRelationError(headMessage, source, target); } return Ternary.False; } + function hasExcessProperties(source: FreshObjectLiteralType, target: Type, reportErrors: boolean): boolean { + for (let prop of getPropertiesOfObjectType(source)) { + if (!isKnownProperty(target, prop.name)) { + if (reportErrors) { + reportError(Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); + } + return true; + } + } + } + function eachTypeRelatedToSomeType(source: UnionOrIntersectionType, target: UnionOrIntersectionType): Ternary { let result = Ternary.True; let sourceTypes = source.types; @@ -5311,6 +5401,24 @@ namespace ts { return !!(type.flags & TypeFlags.Tuple); } + function getRegularTypeOfObjectLiteral(type: Type): Type { + if (type.flags & TypeFlags.FreshObjectLiteral) { + let regularType = (type).regularType; + if (!regularType) { + regularType = createType((type).flags & ~TypeFlags.FreshObjectLiteral); + regularType.symbol = (type).symbol; + regularType.members = (type).members; + regularType.properties = (type).properties; + regularType.callSignatures = (type).callSignatures; + regularType.constructSignatures = (type).constructSignatures; + regularType.stringIndexType = (type).stringIndexType; + regularType.numberIndexType = (type).numberIndexType; + } + return regularType; + } + return type; + } + function getWidenedTypeOfObjectLiteral(type: Type): Type { let properties = getPropertiesOfObjectType(type); let members: SymbolTable = {}; @@ -6978,7 +7086,7 @@ namespace ts { let stringIndexType = getIndexType(IndexKind.String); let numberIndexType = getIndexType(IndexKind.Number); let result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); - result.flags |= TypeFlags.ObjectLiteral | TypeFlags.ContainsObjectLiteral | (typeFlags & TypeFlags.ContainsUndefinedOrNull); + result.flags |= TypeFlags.ObjectLiteral | TypeFlags.FreshObjectLiteral | TypeFlags.ContainsObjectLiteral | (typeFlags & TypeFlags.ContainsUndefinedOrNull); return result; function getIndexType(kind: IndexKind) { @@ -8858,7 +8966,7 @@ namespace ts { } function checkAssertion(node: AssertionExpression) { - let exprType = checkExpression(node.expression); + let exprType = getRegularTypeOfObjectLiteral(checkExpression(node.expression)); let targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { let widenedType = getWidenedType(exprType); @@ -9683,7 +9791,7 @@ namespace ts { return getUnionType([leftType, rightType]); case SyntaxKind.EqualsToken: checkAssignmentOperator(rightType); - return rightType; + return getRegularTypeOfObjectLiteral(rightType); case SyntaxKind.CommaToken: return rightType; } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index a0a95d47c8c53..b91399e8ee182 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -254,6 +254,7 @@ namespace ts { Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: DiagnosticCategory.Error, key: "Only a void function can be called with the 'new' keyword." }, Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: DiagnosticCategory.Error, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: DiagnosticCategory.Error, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: DiagnosticCategory.Error, key: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, No_best_common_type_exists_among_return_expressions: { code: 2354, category: DiagnosticCategory.Error, key: "No best common type exists among return expressions." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: DiagnosticCategory.Error, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: DiagnosticCategory.Error, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index acf4e74ae9fc6..9fda73740ba37 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1005,6 +1005,10 @@ "category": "Error", "code": 2352 }, + "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'.": { + "category": "Error", + "code": 2353 + }, "No best common type exists among return expressions.": { "category": "Error", "code": 2354 diff --git a/src/compiler/types.ts b/src/compiler/types.ts index f1b476d11b404..8d5596c6f6435 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1762,10 +1762,12 @@ namespace ts { FromSignature = 0x00040000, // Created for signature assignment check ObjectLiteral = 0x00080000, // Originates in an object literal /* @internal */ - ContainsUndefinedOrNull = 0x00100000, // Type is or contains Undefined or Null type + FreshObjectLiteral = 0x00100000, // Fresh object literal type /* @internal */ - ContainsObjectLiteral = 0x00200000, // Type is or contains object literal type - ESSymbol = 0x00400000, // Type of symbol primitive introduced in ES6 + ContainsUndefinedOrNull = 0x00200000, // Type is or contains Undefined or Null type + /* @internal */ + ContainsObjectLiteral = 0x00400000, // Type is or contains object literal type + ESSymbol = 0x00800000, // Type of symbol primitive introduced in ES6 /* @internal */ Intrinsic = Any | String | Number | Boolean | ESSymbol | Void | Undefined | Null, @@ -1858,6 +1860,14 @@ namespace ts { numberIndexType?: Type; // Numeric index type } + /* @internal */ + // Object literals are initially marked fresh. Freshness disappears following an assignment, + // before a type assertion, or when when an object literal's type is widened. The regular + // version of a fresh type is identical except for the TypeFlags.FreshObjectLiteral flag. + export interface FreshObjectLiteralType extends ResolvedType { + regularType: ResolvedType; // Regular version of fresh type + } + // Just a place to cache element types of iterables and iterators /* @internal */ export interface IterableOrIteratorType extends ObjectType, UnionType { @@ -2211,6 +2221,7 @@ namespace ts { export interface CompilerHost { getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getCancellationToken?(): CancellationToken; getDefaultLibFileName(options: CompilerOptions): string; writeFile: WriteFileCallback; getCurrentDirectory(): string; diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 5c8e6bc8981ae..02ca17cefd7ef 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -26,9 +26,8 @@ module FourSlash { export interface FourSlashFile { // The contents of the file (with markers, etc stripped out) content: string; - fileName: string; - + version: number; // File-specific options (name/value pairs) fileOptions: { [index: string]: string; }; } diff --git a/src/harness/loggedIO.ts b/src/harness/loggedIO.ts index 0ce567e95636a..c7b57a7d51f8b 100644 --- a/src/harness/loggedIO.ts +++ b/src/harness/loggedIO.ts @@ -12,6 +12,7 @@ interface FindFileResult { } interface IOLog { + timestamp: string; arguments: string[]; executingPath: string; currentDirectory: string; diff --git a/src/server/client.ts b/src/server/client.ts index e4a524dd21034..3ad7230cf3360 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -202,9 +202,7 @@ namespace ts.server { return { isMemberCompletion: false, isNewIdentifierLocation: false, - entries: response.body, - fileName: fileName, - position: position + entries: response.body }; } diff --git a/src/services/services.ts b/src/services/services.ts index c2432816f24b3..16f5b0b91fe92 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1105,6 +1105,7 @@ namespace ts { } export interface HighlightSpan { + fileName?: string; textSpan: TextSpan; kind: string; } @@ -1411,7 +1412,9 @@ namespace ts { * @param fileName The name of the file to be released * @param compilationSettings The compilation settings used to acquire the file */ - releaseDocument(fileName: string, compilationSettings: CompilerOptions): void + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; + + reportStats(): string; } // TODO: move these to enums diff --git a/src/services/shims.ts b/src/services/shims.ts index e2055b3de7794..ae853e1c72a94 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -454,11 +454,11 @@ namespace ts { } } - export function realizeDiagnostics(diagnostics: Diagnostic[], newLine: string): { message: string; start: number; length: number; category: string; } []{ + export function realizeDiagnostics(diagnostics: Diagnostic[], newLine: string): { message: string; start: number; length: number; category: string; code: number; } []{ return diagnostics.map(d => realizeDiagnostic(d, newLine)); } - function realizeDiagnostic(diagnostic: Diagnostic, newLine: string): { message: string; start: number; length: number; category: string; } { + function realizeDiagnostic(diagnostic: Diagnostic, newLine: string): { message: string; start: number; length: number; category: string; code: number; } { return { message: flattenDiagnosticMessageText(diagnostic.messageText, newLine), start: diagnostic.start, diff --git a/tests/baselines/reference/ES5For-of30.errors.txt b/tests/baselines/reference/ES5For-of30.errors.txt index e99b8284bf336..ee2d14a4f5809 100644 --- a/tests/baselines/reference/ES5For-of30.errors.txt +++ b/tests/baselines/reference/ES5For-of30.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,6): error TS2461: Type 'string | number' is not an array type. +tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,6): error TS2461: Type 'number | string' is not an array type. tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,7): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,14): error TS2322: Type 'string' is not assignable to type 'number'. @@ -8,7 +8,7 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,14): error var tuple: [number, string] = [2, "3"]; for ([a = 1, b = ""] of tuple) { ~~~~~~~~~~~~~~~ -!!! error TS2461: Type 'string | number' is not an array type. +!!! error TS2461: Type 'number | string' is not an array type. ~ !!! error TS2322: Type 'number' is not assignable to type 'string'. ~ diff --git a/tests/baselines/reference/ES5For-ofTypeCheck11.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck11.errors.txt index 635bb09616afa..57a28b6612c54 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck11.errors.txt +++ b/tests/baselines/reference/ES5For-ofTypeCheck11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts(3,6): error TS2322: Type 'string | number' is not assignable to type 'string'. +tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts(3,6): error TS2322: Type 'number | string' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. @@ -7,5 +7,5 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts(3,6) var v: string; for (v of union) { } ~ -!!! error TS2322: Type 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number | string' is not assignable to type 'string'. !!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-ofTypeCheck5.types b/tests/baselines/reference/ES5For-ofTypeCheck5.types index ed3d13f3918a7..f24aa54c7f323 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck5.types +++ b/tests/baselines/reference/ES5For-ofTypeCheck5.types @@ -3,6 +3,6 @@ var union: string | number[]; >union : string | number[] for (var v of union) { } ->v : string | number +>v : number | string >union : string | number[] diff --git a/tests/baselines/reference/ES5For-ofTypeCheck9.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck9.errors.txt index 156eb18880367..3f382d72a08d0 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck9.errors.txt +++ b/tests/baselines/reference/ES5For-ofTypeCheck9.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts(2,15): error TS2461: Type 'number | symbol | string[]' is not an array type. +tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts(2,15): error TS2461: Type 'string[] | number | symbol' is not an array type. ==== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts (1 errors) ==== var union: string | string[] | number | symbol; for (let v of union) { } ~~~~~ -!!! error TS2461: Type 'number | symbol | string[]' is not an array type. \ No newline at end of file +!!! error TS2461: Type 'string[] | number | symbol' is not an array type. \ No newline at end of file diff --git a/tests/baselines/reference/TypeGuardWithEnumUnion.types b/tests/baselines/reference/TypeGuardWithEnumUnion.types index 61cce562ba5fa..453ec220f021a 100644 --- a/tests/baselines/reference/TypeGuardWithEnumUnion.types +++ b/tests/baselines/reference/TypeGuardWithEnumUnion.types @@ -6,14 +6,14 @@ enum Color { R, G, B } >B : Color function f1(x: Color | string) { ->f1 : (x: string | Color) => void ->x : string | Color +>f1 : (x: Color | string) => void +>x : Color | string >Color : Color if (typeof x === "number") { >typeof x === "number" : boolean >typeof x : string ->x : string | Color +>x : Color | string >"number" : string var y = x; @@ -35,14 +35,14 @@ function f1(x: Color | string) { } function f2(x: Color | string | string[]) { ->f2 : (x: string | Color | string[]) => void ->x : string | Color | string[] +>f2 : (x: Color | string | string[]) => void +>x : Color | string | string[] >Color : Color if (typeof x === "object") { >typeof x === "object" : boolean >typeof x : string ->x : string | Color | string[] +>x : Color | string | string[] >"object" : string var y = x; @@ -55,7 +55,7 @@ function f2(x: Color | string | string[]) { if (typeof x === "number") { >typeof x === "number" : boolean >typeof x : string ->x : string | Color | string[] +>x : Color | string | string[] >"number" : string var z = x; @@ -77,7 +77,7 @@ function f2(x: Color | string | string[]) { if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : string | Color | string[] +>x : Color | string | string[] >"string" : string var a = x; diff --git a/tests/baselines/reference/aliasUsageInOrExpression.types b/tests/baselines/reference/aliasUsageInOrExpression.types index e7ca8639762cf..f009e7084eb6f 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.types +++ b/tests/baselines/reference/aliasUsageInOrExpression.types @@ -34,7 +34,7 @@ var d2: IHasVisualizationModel = i || moduleA; var d2: IHasVisualizationModel = moduleA || i; >d2 : IHasVisualizationModel >IHasVisualizationModel : IHasVisualizationModel ->moduleA || i : IHasVisualizationModel +>moduleA || i : typeof moduleA >moduleA : typeof moduleA >i : IHasVisualizationModel diff --git a/tests/baselines/reference/arrayBestCommonTypes.types b/tests/baselines/reference/arrayBestCommonTypes.types index 5650efc9ae77d..9b05aff5ac670 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.types +++ b/tests/baselines/reference/arrayBestCommonTypes.types @@ -294,8 +294,8 @@ module EmptyTypes { // Order matters here so test all the variants var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; ->a1 : { x: any; y: string; }[] ->[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : { x: any; y: string; }[] +>a1 : ({ x: number; y: string; } | { x: string; y: string; } | { x: any; y: string; })[] +>[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : ({ x: number; y: string; } | { x: string; y: string; } | { x: any; y: string; })[] >{ x: 0, y: 'a' } : { x: number; y: string; } >x : number >0 : number @@ -313,8 +313,8 @@ module EmptyTypes { >'a' : string var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }]; ->a2 : { x: any; y: string; }[] ->[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[] +>a2 : ({ x: any; y: string; } | { x: number; y: string; } | { x: string; y: string; })[] +>[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : ({ x: any; y: string; } | { x: number; y: string; } | { x: string; y: string; })[] >{ x: anyObj, y: 'a' } : { x: any; y: string; } >x : any >anyObj : any @@ -332,8 +332,8 @@ module EmptyTypes { >'a' : string var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }]; ->a3 : { x: any; y: string; }[] ->[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[] +>a3 : ({ x: number; y: string; } | { x: any; y: string; } | { x: string; y: string; })[] +>[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : ({ x: number; y: string; } | { x: any; y: string; } | { x: string; y: string; })[] >{ x: 0, y: 'a' } : { x: number; y: string; } >x : number >0 : number @@ -366,22 +366,22 @@ module EmptyTypes { >base2 : typeof base2 var b1 = [baseObj, base2Obj, ifaceObj]; ->b1 : iface[] ->[baseObj, base2Obj, ifaceObj] : iface[] +>b1 : base[] +>[baseObj, base2Obj, ifaceObj] : base[] >baseObj : base >base2Obj : base2 >ifaceObj : iface var b2 = [base2Obj, baseObj, ifaceObj]; ->b2 : iface[] ->[base2Obj, baseObj, ifaceObj] : iface[] +>b2 : base2[] +>[base2Obj, baseObj, ifaceObj] : base2[] >base2Obj : base2 >baseObj : base >ifaceObj : iface var b3 = [baseObj, ifaceObj, base2Obj]; ->b3 : iface[] ->[baseObj, ifaceObj, base2Obj] : iface[] +>b3 : base[] +>[baseObj, ifaceObj, base2Obj] : base[] >baseObj : base >ifaceObj : iface >base2Obj : base2 @@ -639,7 +639,7 @@ module NonEmptyTypes { >x : number >y : base >base : base ->[{ x: 7, y: new derived() }, { x: 5, y: new base() }] : { x: number; y: base; }[] +>[{ x: 7, y: new derived() }, { x: 5, y: new base() }] : ({ x: number; y: derived; } | { x: number; y: base; })[] >{ x: 7, y: new derived() } : { x: number; y: derived; } >x : number >7 : number @@ -658,7 +658,7 @@ module NonEmptyTypes { >x : boolean >y : base >base : base ->[{ x: true, y: new derived() }, { x: false, y: new base() }] : { x: boolean; y: base; }[] +>[{ x: true, y: new derived() }, { x: false, y: new base() }] : ({ x: boolean; y: derived; } | { x: boolean; y: base; })[] >{ x: true, y: new derived() } : { x: boolean; y: derived; } >x : boolean >true : boolean @@ -697,8 +697,8 @@ module NonEmptyTypes { // Order matters here so test all the variants var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; ->a1 : { x: any; y: string; }[] ->[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : { x: any; y: string; }[] +>a1 : ({ x: number; y: string; } | { x: string; y: string; } | { x: any; y: string; })[] +>[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : ({ x: number; y: string; } | { x: string; y: string; } | { x: any; y: string; })[] >{ x: 0, y: 'a' } : { x: number; y: string; } >x : number >0 : number @@ -716,8 +716,8 @@ module NonEmptyTypes { >'a' : string var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }]; ->a2 : { x: any; y: string; }[] ->[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[] +>a2 : ({ x: any; y: string; } | { x: number; y: string; } | { x: string; y: string; })[] +>[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : ({ x: any; y: string; } | { x: number; y: string; } | { x: string; y: string; })[] >{ x: anyObj, y: 'a' } : { x: any; y: string; } >x : any >anyObj : any @@ -735,8 +735,8 @@ module NonEmptyTypes { >'a' : string var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }]; ->a3 : { x: any; y: string; }[] ->[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[] +>a3 : ({ x: number; y: string; } | { x: any; y: string; } | { x: string; y: string; })[] +>[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : ({ x: number; y: string; } | { x: any; y: string; } | { x: string; y: string; })[] >{ x: 0, y: 'a' } : { x: number; y: string; } >x : number >0 : number @@ -769,29 +769,29 @@ module NonEmptyTypes { >base2 : typeof base2 var b1 = [baseObj, base2Obj, ifaceObj]; ->b1 : iface[] ->[baseObj, base2Obj, ifaceObj] : iface[] +>b1 : (base | base2 | iface)[] +>[baseObj, base2Obj, ifaceObj] : (base | base2 | iface)[] >baseObj : base >base2Obj : base2 >ifaceObj : iface var b2 = [base2Obj, baseObj, ifaceObj]; ->b2 : iface[] ->[base2Obj, baseObj, ifaceObj] : iface[] +>b2 : (base2 | base | iface)[] +>[base2Obj, baseObj, ifaceObj] : (base2 | base | iface)[] >base2Obj : base2 >baseObj : base >ifaceObj : iface var b3 = [baseObj, ifaceObj, base2Obj]; ->b3 : iface[] ->[baseObj, ifaceObj, base2Obj] : iface[] +>b3 : (base | iface | base2)[] +>[baseObj, ifaceObj, base2Obj] : (base | iface | base2)[] >baseObj : base >ifaceObj : iface >base2Obj : base2 var b4 = [ifaceObj, baseObj, base2Obj]; ->b4 : iface[] ->[ifaceObj, baseObj, base2Obj] : iface[] +>b4 : (iface | base | base2)[] +>[ifaceObj, baseObj, base2Obj] : (iface | base | base2)[] >ifaceObj : iface >baseObj : base >base2Obj : base2 diff --git a/tests/baselines/reference/arrayCast.errors.txt b/tests/baselines/reference/arrayCast.errors.txt index 10562cc57e4bf..82b4b856a975b 100644 --- a/tests/baselines/reference/arrayCast.errors.txt +++ b/tests/baselines/reference/arrayCast.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/arrayCast.ts(3,1): error TS2352: Neither type '{ foo: string; }[]' nor type '{ id: number; }[]' is assignable to the other. Type '{ foo: string; }' is not assignable to type '{ id: number; }'. - Property 'id' is missing in type '{ foo: string; }'. + Object literal may only specify known properties, and 'foo' does not exist in type '{ id: number; }'. ==== tests/cases/compiler/arrayCast.ts (1 errors) ==== @@ -10,7 +10,7 @@ tests/cases/compiler/arrayCast.ts(3,1): error TS2352: Neither type '{ foo: strin ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2352: Neither type '{ foo: string; }[]' nor type '{ id: number; }[]' is assignable to the other. !!! error TS2352: Type '{ foo: string; }' is not assignable to type '{ id: number; }'. -!!! error TS2352: Property 'id' is missing in type '{ foo: string; }'. +!!! error TS2352: Object literal may only specify known properties, and 'foo' does not exist in type '{ id: number; }'. // Should succeed, as the {} element causes the type of the array to be {}[] <{ id: number; }[]>[{ foo: "s" }, {}]; \ No newline at end of file diff --git a/tests/baselines/reference/arrayLiteralExpressionContextualTyping.errors.txt b/tests/baselines/reference/arrayLiteralExpressionContextualTyping.errors.txt index 3e9777aea7c26..72ba14113207d 100644 --- a/tests/baselines/reference/arrayLiteralExpressionContextualTyping.errors.txt +++ b/tests/baselines/reference/arrayLiteralExpressionContextualTyping.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/expressions/contextualTyping/arrayLiteralExpressionContextualTyping.ts(8,5): error TS2322: Type '[number, number, number, string]' is not assignable to type '[number, number, number]'. Types of property 'pop' are incompatible. - Type '() => string | number' is not assignable to type '() => number'. - Type 'string | number' is not assignable to type 'number'. + Type '() => number | string' is not assignable to type '() => number'. + Type 'number | string' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/conformance/expressions/contextualTyping/arrayLiteralExpressionContextualTyping.ts(14,5): error TS2322: Type 'number[]' is not assignable to type '[number, number, number]'. Property '0' is missing in type 'number[]'. @@ -19,8 +19,8 @@ tests/cases/conformance/expressions/contextualTyping/arrayLiteralExpressionConte ~~~~ !!! error TS2322: Type '[number, number, number, string]' is not assignable to type '[number, number, number]'. !!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => string | number' is not assignable to type '() => number'. -!!! error TS2322: Type 'string | number' is not assignable to type 'number'. +!!! error TS2322: Type '() => number | string' is not assignable to type '() => number'. +!!! error TS2322: Type 'number | string' is not assignable to type 'number'. !!! error TS2322: Type 'string' is not assignable to type 'number'. // In a contextually typed array literal expression containing one or more spread elements, diff --git a/tests/baselines/reference/arrayLiteralTypeInference.errors.txt b/tests/baselines/reference/arrayLiteralTypeInference.errors.txt new file mode 100644 index 0000000000000..105375f2e748b --- /dev/null +++ b/tests/baselines/reference/arrayLiteralTypeInference.errors.txt @@ -0,0 +1,72 @@ +tests/cases/compiler/arrayLiteralTypeInference.ts(13,5): error TS2322: Type '({ id: number; trueness: boolean; } | { id: number; name: string; })[]' is not assignable to type 'Action[]'. + Type '{ id: number; trueness: boolean; } | { id: number; name: string; }' is not assignable to type 'Action'. + Type '{ id: number; trueness: boolean; }' is not assignable to type 'Action'. + Object literal may only specify known properties, and 'trueness' does not exist in type 'Action'. +tests/cases/compiler/arrayLiteralTypeInference.ts(29,5): error TS2322: Type '({ id: number; trueness: boolean; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'. + Type '{ id: number; trueness: boolean; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'. + Type '{ id: number; trueness: boolean; }' is not assignable to type '{ id: number; }'. + Object literal may only specify known properties, and 'trueness' does not exist in type '{ id: number; }'. + + +==== tests/cases/compiler/arrayLiteralTypeInference.ts (2 errors) ==== + class Action { + id: number; + } + + class ActionA extends Action { + value: string; + } + + class ActionB extends Action { + trueNess: boolean; + } + + var x1: Action[] = [ + ~~ +!!! error TS2322: Type '({ id: number; trueness: boolean; } | { id: number; name: string; })[]' is not assignable to type 'Action[]'. +!!! error TS2322: Type '{ id: number; trueness: boolean; } | { id: number; name: string; }' is not assignable to type 'Action'. +!!! error TS2322: Type '{ id: number; trueness: boolean; }' is not assignable to type 'Action'. +!!! error TS2322: Object literal may only specify known properties, and 'trueness' does not exist in type 'Action'. + { id: 2, trueness: false }, + { id: 3, name: "three" } + ] + + var x2: Action[] = [ + new ActionA(), + new ActionB() + ] + + var x3: Action[] = [ + new Action(), + new ActionA(), + new ActionB() + ] + + var z1: { id: number }[] = + ~~ +!!! error TS2322: Type '({ id: number; trueness: boolean; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'. +!!! error TS2322: Type '{ id: number; trueness: boolean; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Type '{ id: number; trueness: boolean; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'trueness' does not exist in type '{ id: number; }'. + [ + { id: 2, trueness: false }, + { id: 3, name: "three" } + ] + + var z2: { id: number }[] = + [ + new ActionA(), + new ActionB() + ] + + var z3: { id: number }[] = + [ + new Action(), + new ActionA(), + new ActionB() + ] + + + + + \ No newline at end of file diff --git a/tests/baselines/reference/arrayLiteralTypeInference.symbols b/tests/baselines/reference/arrayLiteralTypeInference.symbols deleted file mode 100644 index 005cb57f6c402..0000000000000 --- a/tests/baselines/reference/arrayLiteralTypeInference.symbols +++ /dev/null @@ -1,113 +0,0 @@ -=== tests/cases/compiler/arrayLiteralTypeInference.ts === -class Action { ->Action : Symbol(Action, Decl(arrayLiteralTypeInference.ts, 0, 0)) - - id: number; ->id : Symbol(id, Decl(arrayLiteralTypeInference.ts, 0, 14)) -} - -class ActionA extends Action { ->ActionA : Symbol(ActionA, Decl(arrayLiteralTypeInference.ts, 2, 1)) ->Action : Symbol(Action, Decl(arrayLiteralTypeInference.ts, 0, 0)) - - value: string; ->value : Symbol(value, Decl(arrayLiteralTypeInference.ts, 4, 30)) -} - -class ActionB extends Action { ->ActionB : Symbol(ActionB, Decl(arrayLiteralTypeInference.ts, 6, 1)) ->Action : Symbol(Action, Decl(arrayLiteralTypeInference.ts, 0, 0)) - - trueNess: boolean; ->trueNess : Symbol(trueNess, Decl(arrayLiteralTypeInference.ts, 8, 30)) -} - -var x1: Action[] = [ ->x1 : Symbol(x1, Decl(arrayLiteralTypeInference.ts, 12, 3)) ->Action : Symbol(Action, Decl(arrayLiteralTypeInference.ts, 0, 0)) - - { id: 2, trueness: false }, ->id : Symbol(id, Decl(arrayLiteralTypeInference.ts, 13, 5)) ->trueness : Symbol(trueness, Decl(arrayLiteralTypeInference.ts, 13, 12)) - - { id: 3, name: "three" } ->id : Symbol(id, Decl(arrayLiteralTypeInference.ts, 14, 5)) ->name : Symbol(name, Decl(arrayLiteralTypeInference.ts, 14, 12)) - -] - -var x2: Action[] = [ ->x2 : Symbol(x2, Decl(arrayLiteralTypeInference.ts, 17, 3)) ->Action : Symbol(Action, Decl(arrayLiteralTypeInference.ts, 0, 0)) - - new ActionA(), ->ActionA : Symbol(ActionA, Decl(arrayLiteralTypeInference.ts, 2, 1)) - - new ActionB() ->ActionB : Symbol(ActionB, Decl(arrayLiteralTypeInference.ts, 6, 1)) - -] - -var x3: Action[] = [ ->x3 : Symbol(x3, Decl(arrayLiteralTypeInference.ts, 22, 3)) ->Action : Symbol(Action, Decl(arrayLiteralTypeInference.ts, 0, 0)) - - new Action(), ->Action : Symbol(Action, Decl(arrayLiteralTypeInference.ts, 0, 0)) - - new ActionA(), ->ActionA : Symbol(ActionA, Decl(arrayLiteralTypeInference.ts, 2, 1)) - - new ActionB() ->ActionB : Symbol(ActionB, Decl(arrayLiteralTypeInference.ts, 6, 1)) - -] - -var z1: { id: number }[] = ->z1 : Symbol(z1, Decl(arrayLiteralTypeInference.ts, 28, 3)) ->id : Symbol(id, Decl(arrayLiteralTypeInference.ts, 28, 9)) - - [ - { id: 2, trueness: false }, ->id : Symbol(id, Decl(arrayLiteralTypeInference.ts, 30, 9)) ->trueness : Symbol(trueness, Decl(arrayLiteralTypeInference.ts, 30, 16)) - - { id: 3, name: "three" } ->id : Symbol(id, Decl(arrayLiteralTypeInference.ts, 31, 9)) ->name : Symbol(name, Decl(arrayLiteralTypeInference.ts, 31, 16)) - - ] - -var z2: { id: number }[] = ->z2 : Symbol(z2, Decl(arrayLiteralTypeInference.ts, 34, 3)) ->id : Symbol(id, Decl(arrayLiteralTypeInference.ts, 34, 9)) - - [ - new ActionA(), ->ActionA : Symbol(ActionA, Decl(arrayLiteralTypeInference.ts, 2, 1)) - - new ActionB() ->ActionB : Symbol(ActionB, Decl(arrayLiteralTypeInference.ts, 6, 1)) - - ] - -var z3: { id: number }[] = ->z3 : Symbol(z3, Decl(arrayLiteralTypeInference.ts, 40, 3)) ->id : Symbol(id, Decl(arrayLiteralTypeInference.ts, 40, 9)) - - [ - new Action(), ->Action : Symbol(Action, Decl(arrayLiteralTypeInference.ts, 0, 0)) - - new ActionA(), ->ActionA : Symbol(ActionA, Decl(arrayLiteralTypeInference.ts, 2, 1)) - - new ActionB() ->ActionB : Symbol(ActionB, Decl(arrayLiteralTypeInference.ts, 6, 1)) - - ] - - - - - diff --git a/tests/baselines/reference/arrayLiteralTypeInference.types b/tests/baselines/reference/arrayLiteralTypeInference.types deleted file mode 100644 index 660592fceb896..0000000000000 --- a/tests/baselines/reference/arrayLiteralTypeInference.types +++ /dev/null @@ -1,144 +0,0 @@ -=== tests/cases/compiler/arrayLiteralTypeInference.ts === -class Action { ->Action : Action - - id: number; ->id : number -} - -class ActionA extends Action { ->ActionA : ActionA ->Action : Action - - value: string; ->value : string -} - -class ActionB extends Action { ->ActionB : ActionB ->Action : Action - - trueNess: boolean; ->trueNess : boolean -} - -var x1: Action[] = [ ->x1 : Action[] ->Action : Action ->[ { id: 2, trueness: false }, { id: 3, name: "three" }] : ({ id: number; trueness: boolean; } | { id: number; name: string; })[] - - { id: 2, trueness: false }, ->{ id: 2, trueness: false } : { id: number; trueness: boolean; } ->id : number ->2 : number ->trueness : boolean ->false : boolean - - { id: 3, name: "three" } ->{ id: 3, name: "three" } : { id: number; name: string; } ->id : number ->3 : number ->name : string ->"three" : string - -] - -var x2: Action[] = [ ->x2 : Action[] ->Action : Action ->[ new ActionA(), new ActionB()] : (ActionA | ActionB)[] - - new ActionA(), ->new ActionA() : ActionA ->ActionA : typeof ActionA - - new ActionB() ->new ActionB() : ActionB ->ActionB : typeof ActionB - -] - -var x3: Action[] = [ ->x3 : Action[] ->Action : Action ->[ new Action(), new ActionA(), new ActionB()] : Action[] - - new Action(), ->new Action() : Action ->Action : typeof Action - - new ActionA(), ->new ActionA() : ActionA ->ActionA : typeof ActionA - - new ActionB() ->new ActionB() : ActionB ->ActionB : typeof ActionB - -] - -var z1: { id: number }[] = ->z1 : { id: number; }[] ->id : number - - [ ->[ { id: 2, trueness: false }, { id: 3, name: "three" } ] : ({ id: number; trueness: boolean; } | { id: number; name: string; })[] - - { id: 2, trueness: false }, ->{ id: 2, trueness: false } : { id: number; trueness: boolean; } ->id : number ->2 : number ->trueness : boolean ->false : boolean - - { id: 3, name: "three" } ->{ id: 3, name: "three" } : { id: number; name: string; } ->id : number ->3 : number ->name : string ->"three" : string - - ] - -var z2: { id: number }[] = ->z2 : { id: number; }[] ->id : number - - [ ->[ new ActionA(), new ActionB() ] : (ActionA | ActionB)[] - - new ActionA(), ->new ActionA() : ActionA ->ActionA : typeof ActionA - - new ActionB() ->new ActionB() : ActionB ->ActionB : typeof ActionB - - ] - -var z3: { id: number }[] = ->z3 : { id: number; }[] ->id : number - - [ ->[ new Action(), new ActionA(), new ActionB() ] : Action[] - - new Action(), ->new Action() : Action ->Action : typeof Action - - new ActionA(), ->new ActionA() : ActionA ->ActionA : typeof ActionA - - new ActionB() ->new ActionB() : ActionB ->ActionB : typeof ActionB - - ] - - - - - diff --git a/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types index aad515b62ee5f..5b5a1be6b8a73 100644 --- a/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types +++ b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types @@ -23,8 +23,8 @@ var as = [a, b]; // { x: number; y?: number };[] >b : { x: number; z?: number; } var bs = [b, a]; // { x: number; z?: number };[] ->bs : ({ x: number; y?: number; } | { x: number; z?: number; })[] ->[b, a] : ({ x: number; y?: number; } | { x: number; z?: number; })[] +>bs : ({ x: number; z?: number; } | { x: number; y?: number; })[] +>[b, a] : ({ x: number; z?: number; } | { x: number; y?: number; })[] >b : { x: number; z?: number; } >a : { x: number; y?: number; } @@ -36,8 +36,8 @@ var cs = [a, b, c]; // { x: number; y?: number };[] >c : { x: number; a?: number; } var ds = [(x: Object) => 1, (x: string) => 2]; // { (x:Object) => number }[] ->ds : ((x: Object) => number)[] ->[(x: Object) => 1, (x: string) => 2] : ((x: Object) => number)[] +>ds : (((x: Object) => number) | ((x: string) => number))[] +>[(x: Object) => 1, (x: string) => 2] : (((x: Object) => number) | ((x: string) => number))[] >(x: Object) => 1 : (x: Object) => number >x : Object >Object : Object @@ -47,8 +47,8 @@ var ds = [(x: Object) => 1, (x: string) => 2]; // { (x:Object) => number }[] >2 : number var es = [(x: string) => 2, (x: Object) => 1]; // { (x:string) => number }[] ->es : ((x: string) => number)[] ->[(x: string) => 2, (x: Object) => 1] : ((x: string) => number)[] +>es : (((x: string) => number) | ((x: Object) => number))[] +>[(x: string) => 2, (x: Object) => 1] : (((x: string) => number) | ((x: Object) => number))[] >(x: string) => 2 : (x: string) => number >x : string >2 : number diff --git a/tests/baselines/reference/arrayLiterals.errors.txt b/tests/baselines/reference/arrayLiterals.errors.txt new file mode 100644 index 0000000000000..fd882804b8a9d --- /dev/null +++ b/tests/baselines/reference/arrayLiterals.errors.txt @@ -0,0 +1,50 @@ +tests/cases/conformance/expressions/arrayLiterals/arrayLiterals.ts(24,5): error TS2322: Type '({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[]' is not assignable to type '{ [n: number]: { a: string; b: number; }; }'. + Index signatures are incompatible. + Type '{ a: string; b: number; c: string; } | { a: string; b: number; c: number; }' is not assignable to type '{ a: string; b: number; }'. + Type '{ a: string; b: number; c: string; }' is not assignable to type '{ a: string; b: number; }'. + Object literal may only specify known properties, and 'c' does not exist in type '{ a: string; b: number; }'. + + +==== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals.ts (1 errors) ==== + // Empty array literal with no contextual type has type Undefined[] + + var arr1= [[], [1], ['']]; + + var arr2 = [[null], [1], ['']]; + + + // Array literal with elements of only EveryType E has type E[] + var stringArrArr = [[''], [""]]; + + var stringArr = ['', ""]; + + var numberArr = [0, 0.0, 0x00, 1e1]; + + var boolArr = [false, true, false, true]; + + class C { private p; } + var classArr = [new C(), new C()]; + + var classTypeArray = [C, C, C]; + var classTypeArray: Array; // Should OK, not be a parse error + + // Contextual type C with numeric index signature makes array literal of EveryType E of type BCT(E,C)[] + var context1: { [n: number]: { a: string; b: number; }; } = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; + ~~~~~~~~ +!!! error TS2322: Type '({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[]' is not assignable to type '{ [n: number]: { a: string; b: number; }; }'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type '{ a: string; b: number; c: string; } | { a: string; b: number; c: number; }' is not assignable to type '{ a: string; b: number; }'. +!!! error TS2322: Type '{ a: string; b: number; c: string; }' is not assignable to type '{ a: string; b: number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'c' does not exist in type '{ a: string; b: number; }'. + var context2 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; + + // Contextual type C with numeric index signature of type Base makes array literal of Derived have type Base[] + class Base { private p; } + class Derived1 extends Base { private m }; + class Derived2 extends Base { private n }; + var context3: Base[] = [new Derived1(), new Derived2()]; + + // Contextual type C with numeric index signature of type Base makes array literal of Derived1 and Derived2 have type Base[] + var context4: Base[] = [new Derived1(), new Derived1()]; + + \ No newline at end of file diff --git a/tests/baselines/reference/arrayLiterals.symbols b/tests/baselines/reference/arrayLiterals.symbols deleted file mode 100644 index b338e7ff6e6c5..0000000000000 --- a/tests/baselines/reference/arrayLiterals.symbols +++ /dev/null @@ -1,94 +0,0 @@ -=== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals.ts === -// Empty array literal with no contextual type has type Undefined[] - -var arr1= [[], [1], ['']]; ->arr1 : Symbol(arr1, Decl(arrayLiterals.ts, 2, 3)) - -var arr2 = [[null], [1], ['']]; ->arr2 : Symbol(arr2, Decl(arrayLiterals.ts, 4, 3)) - - -// Array literal with elements of only EveryType E has type E[] -var stringArrArr = [[''], [""]]; ->stringArrArr : Symbol(stringArrArr, Decl(arrayLiterals.ts, 8, 3)) - -var stringArr = ['', ""]; ->stringArr : Symbol(stringArr, Decl(arrayLiterals.ts, 10, 3)) - -var numberArr = [0, 0.0, 0x00, 1e1]; ->numberArr : Symbol(numberArr, Decl(arrayLiterals.ts, 12, 3)) - -var boolArr = [false, true, false, true]; ->boolArr : Symbol(boolArr, Decl(arrayLiterals.ts, 14, 3)) - -class C { private p; } ->C : Symbol(C, Decl(arrayLiterals.ts, 14, 41)) ->p : Symbol(p, Decl(arrayLiterals.ts, 16, 9)) - -var classArr = [new C(), new C()]; ->classArr : Symbol(classArr, Decl(arrayLiterals.ts, 17, 3)) ->C : Symbol(C, Decl(arrayLiterals.ts, 14, 41)) ->C : Symbol(C, Decl(arrayLiterals.ts, 14, 41)) - -var classTypeArray = [C, C, C]; ->classTypeArray : Symbol(classTypeArray, Decl(arrayLiterals.ts, 19, 3), Decl(arrayLiterals.ts, 20, 3)) ->C : Symbol(C, Decl(arrayLiterals.ts, 14, 41)) ->C : Symbol(C, Decl(arrayLiterals.ts, 14, 41)) ->C : Symbol(C, Decl(arrayLiterals.ts, 14, 41)) - -var classTypeArray: Array; // Should OK, not be a parse error ->classTypeArray : Symbol(classTypeArray, Decl(arrayLiterals.ts, 19, 3), Decl(arrayLiterals.ts, 20, 3)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11)) ->C : Symbol(C, Decl(arrayLiterals.ts, 14, 41)) - -// Contextual type C with numeric index signature makes array literal of EveryType E of type BCT(E,C)[] -var context1: { [n: number]: { a: string; b: number; }; } = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; ->context1 : Symbol(context1, Decl(arrayLiterals.ts, 23, 3)) ->n : Symbol(n, Decl(arrayLiterals.ts, 23, 17)) ->a : Symbol(a, Decl(arrayLiterals.ts, 23, 30)) ->b : Symbol(b, Decl(arrayLiterals.ts, 23, 41)) ->a : Symbol(a, Decl(arrayLiterals.ts, 23, 62)) ->b : Symbol(b, Decl(arrayLiterals.ts, 23, 69)) ->c : Symbol(c, Decl(arrayLiterals.ts, 23, 75)) ->a : Symbol(a, Decl(arrayLiterals.ts, 23, 86)) ->b : Symbol(b, Decl(arrayLiterals.ts, 23, 93)) ->c : Symbol(c, Decl(arrayLiterals.ts, 23, 99)) - -var context2 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; ->context2 : Symbol(context2, Decl(arrayLiterals.ts, 24, 3)) ->a : Symbol(a, Decl(arrayLiterals.ts, 24, 17)) ->b : Symbol(b, Decl(arrayLiterals.ts, 24, 24)) ->c : Symbol(c, Decl(arrayLiterals.ts, 24, 30)) ->a : Symbol(a, Decl(arrayLiterals.ts, 24, 41)) ->b : Symbol(b, Decl(arrayLiterals.ts, 24, 48)) ->c : Symbol(c, Decl(arrayLiterals.ts, 24, 54)) - -// Contextual type C with numeric index signature of type Base makes array literal of Derived have type Base[] -class Base { private p; } ->Base : Symbol(Base, Decl(arrayLiterals.ts, 24, 63)) ->p : Symbol(p, Decl(arrayLiterals.ts, 27, 12)) - -class Derived1 extends Base { private m }; ->Derived1 : Symbol(Derived1, Decl(arrayLiterals.ts, 27, 25)) ->Base : Symbol(Base, Decl(arrayLiterals.ts, 24, 63)) ->m : Symbol(m, Decl(arrayLiterals.ts, 28, 29)) - -class Derived2 extends Base { private n }; ->Derived2 : Symbol(Derived2, Decl(arrayLiterals.ts, 28, 42)) ->Base : Symbol(Base, Decl(arrayLiterals.ts, 24, 63)) ->n : Symbol(n, Decl(arrayLiterals.ts, 29, 29)) - -var context3: Base[] = [new Derived1(), new Derived2()]; ->context3 : Symbol(context3, Decl(arrayLiterals.ts, 30, 3)) ->Base : Symbol(Base, Decl(arrayLiterals.ts, 24, 63)) ->Derived1 : Symbol(Derived1, Decl(arrayLiterals.ts, 27, 25)) ->Derived2 : Symbol(Derived2, Decl(arrayLiterals.ts, 28, 42)) - -// Contextual type C with numeric index signature of type Base makes array literal of Derived1 and Derived2 have type Base[] -var context4: Base[] = [new Derived1(), new Derived1()]; ->context4 : Symbol(context4, Decl(arrayLiterals.ts, 33, 3)) ->Base : Symbol(Base, Decl(arrayLiterals.ts, 24, 63)) ->Derived1 : Symbol(Derived1, Decl(arrayLiterals.ts, 27, 25)) ->Derived1 : Symbol(Derived1, Decl(arrayLiterals.ts, 27, 25)) - - diff --git a/tests/baselines/reference/arrayLiterals.types b/tests/baselines/reference/arrayLiterals.types deleted file mode 100644 index e103241dd0b92..0000000000000 --- a/tests/baselines/reference/arrayLiterals.types +++ /dev/null @@ -1,153 +0,0 @@ -=== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals.ts === -// Empty array literal with no contextual type has type Undefined[] - -var arr1= [[], [1], ['']]; ->arr1 : (number[] | string[])[] ->[[], [1], ['']] : (number[] | string[])[] ->[] : undefined[] ->[1] : number[] ->1 : number ->[''] : string[] ->'' : string - -var arr2 = [[null], [1], ['']]; ->arr2 : (number[] | string[])[] ->[[null], [1], ['']] : (number[] | string[])[] ->[null] : null[] ->null : null ->[1] : number[] ->1 : number ->[''] : string[] ->'' : string - - -// Array literal with elements of only EveryType E has type E[] -var stringArrArr = [[''], [""]]; ->stringArrArr : string[][] ->[[''], [""]] : string[][] ->[''] : string[] ->'' : string ->[""] : string[] ->"" : string - -var stringArr = ['', ""]; ->stringArr : string[] ->['', ""] : string[] ->'' : string ->"" : string - -var numberArr = [0, 0.0, 0x00, 1e1]; ->numberArr : number[] ->[0, 0.0, 0x00, 1e1] : number[] ->0 : number ->0.0 : number ->0x00 : number ->1e1 : number - -var boolArr = [false, true, false, true]; ->boolArr : boolean[] ->[false, true, false, true] : boolean[] ->false : boolean ->true : boolean ->false : boolean ->true : boolean - -class C { private p; } ->C : C ->p : any - -var classArr = [new C(), new C()]; ->classArr : C[] ->[new C(), new C()] : C[] ->new C() : C ->C : typeof C ->new C() : C ->C : typeof C - -var classTypeArray = [C, C, C]; ->classTypeArray : typeof C[] ->[C, C, C] : typeof C[] ->C : typeof C ->C : typeof C ->C : typeof C - -var classTypeArray: Array; // Should OK, not be a parse error ->classTypeArray : typeof C[] ->Array : T[] ->C : typeof C - -// Contextual type C with numeric index signature makes array literal of EveryType E of type BCT(E,C)[] -var context1: { [n: number]: { a: string; b: number; }; } = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; ->context1 : { [n: number]: { a: string; b: number; }; } ->n : number ->a : string ->b : number ->[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : ({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[] ->{ a: '', b: 0, c: '' } : { a: string; b: number; c: string; } ->a : string ->'' : string ->b : number ->0 : number ->c : string ->'' : string ->{ a: "", b: 3, c: 0 } : { a: string; b: number; c: number; } ->a : string ->"" : string ->b : number ->3 : number ->c : number ->0 : number - -var context2 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; ->context2 : ({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[] ->[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : ({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[] ->{ a: '', b: 0, c: '' } : { a: string; b: number; c: string; } ->a : string ->'' : string ->b : number ->0 : number ->c : string ->'' : string ->{ a: "", b: 3, c: 0 } : { a: string; b: number; c: number; } ->a : string ->"" : string ->b : number ->3 : number ->c : number ->0 : number - -// Contextual type C with numeric index signature of type Base makes array literal of Derived have type Base[] -class Base { private p; } ->Base : Base ->p : any - -class Derived1 extends Base { private m }; ->Derived1 : Derived1 ->Base : Base ->m : any - -class Derived2 extends Base { private n }; ->Derived2 : Derived2 ->Base : Base ->n : any - -var context3: Base[] = [new Derived1(), new Derived2()]; ->context3 : Base[] ->Base : Base ->[new Derived1(), new Derived2()] : (Derived1 | Derived2)[] ->new Derived1() : Derived1 ->Derived1 : typeof Derived1 ->new Derived2() : Derived2 ->Derived2 : typeof Derived2 - -// Contextual type C with numeric index signature of type Base makes array literal of Derived1 and Derived2 have type Base[] -var context4: Base[] = [new Derived1(), new Derived1()]; ->context4 : Base[] ->Base : Base ->[new Derived1(), new Derived1()] : Derived1[] ->new Derived1() : Derived1 ->Derived1 : typeof Derived1 ->new Derived1() : Derived1 ->Derived1 : typeof Derived1 - - diff --git a/tests/baselines/reference/arrayLiterals2ES5.types b/tests/baselines/reference/arrayLiterals2ES5.types index 6eae997f4654c..a9cf31611c26f 100644 --- a/tests/baselines/reference/arrayLiterals2ES5.types +++ b/tests/baselines/reference/arrayLiterals2ES5.types @@ -24,8 +24,8 @@ var a1 = ["hello", "world"] >"world" : string var a2 = [, , , ...a0, "hello"]; ->a2 : (string | number)[] ->[, , , ...a0, "hello"] : (string | number)[] +>a2 : (number | string)[] +>[, , , ...a0, "hello"] : (number | string)[] > : undefined > : undefined > : undefined @@ -151,8 +151,8 @@ interface myArray2 extends Array { } >String : String var d0 = [1, true, ...temp,]; // has type (string|number|boolean)[] ->d0 : (string | number | boolean)[] ->[1, true, ...temp,] : (string | number | boolean)[] +>d0 : (number | boolean | string)[] +>[1, true, ...temp,] : (number | boolean | string)[] >1 : number >true : boolean >...temp : string @@ -214,8 +214,8 @@ var d8: number[][] = [[...temp1]] >temp1 : number[] var d9 = [[...temp1], ...["hello"]]; ->d9 : (string | number[])[] ->[[...temp1], ...["hello"]] : (string | number[])[] +>d9 : (number[] | string)[] +>[[...temp1], ...["hello"]] : (number[] | string)[] >[...temp1] : number[] >...temp1 : number >temp1 : number[] diff --git a/tests/baselines/reference/arrayLiterals2ES6.types b/tests/baselines/reference/arrayLiterals2ES6.types index f05b0ca9282a6..b6bf4f1de1b39 100644 --- a/tests/baselines/reference/arrayLiterals2ES6.types +++ b/tests/baselines/reference/arrayLiterals2ES6.types @@ -24,8 +24,8 @@ var a1 = ["hello", "world"] >"world" : string var a2 = [, , , ...a0, "hello"]; ->a2 : (string | number)[] ->[, , , ...a0, "hello"] : (string | number)[] +>a2 : (number | string)[] +>[, , , ...a0, "hello"] : (number | string)[] > : undefined > : undefined > : undefined @@ -140,8 +140,8 @@ interface myArray2 extends Array { } >String : String var d0 = [1, true, ...temp, ]; // has type (string|number|boolean)[] ->d0 : (string | number | boolean)[] ->[1, true, ...temp, ] : (string | number | boolean)[] +>d0 : (number | boolean | string)[] +>[1, true, ...temp, ] : (number | boolean | string)[] >1 : number >true : boolean >...temp : string @@ -176,10 +176,10 @@ var d4: myArray2 = [...temp, ...temp1]; >temp1 : number[] var d5 = [...a2]; ->d5 : (string | number)[] ->[...a2] : (string | number)[] ->...a2 : string | number ->a2 : (string | number)[] +>d5 : (number | string)[] +>[...a2] : (number | string)[] +>...a2 : number | string +>a2 : (number | string)[] var d6 = [...a3]; >d6 : number[] @@ -201,8 +201,8 @@ var d8: number[][] = [[...temp1]] >temp1 : number[] var d9 = [[...temp1], ...["hello"]]; ->d9 : (string | number[])[] ->[[...temp1], ...["hello"]] : (string | number[])[] +>d9 : (number[] | string)[] +>[[...temp1], ...["hello"]] : (number[] | string)[] >[...temp1] : number[] >...temp1 : number >temp1 : number[] diff --git a/tests/baselines/reference/arrayLiterals3.errors.txt b/tests/baselines/reference/arrayLiterals3.errors.txt index 36714162de0cd..637fb3e3bc40d 100644 --- a/tests/baselines/reference/arrayLiterals3.errors.txt +++ b/tests/baselines/reference/arrayLiterals3.errors.txt @@ -5,18 +5,18 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,5): error Type 'string' is not assignable to type 'boolean'. tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(17,5): error TS2322: Type '[number, number, string, boolean]' is not assignable to type '[number, number]'. Types of property 'pop' are incompatible. - Type '() => string | number | boolean' is not assignable to type '() => number'. - Type 'string | number | boolean' is not assignable to type 'number'. + Type '() => number | string | boolean' is not assignable to type '() => number'. + Type 'number | string | boolean' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(32,5): error TS2322: Type '(number[] | string[])[]' is not assignable to type 'tup'. Property '0' is missing in type '(number[] | string[])[]'. tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(33,5): error TS2322: Type 'number[]' is not assignable to type '[number, number, number]'. Property '0' is missing in type 'number[]'. -tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'. +tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error TS2322: Type '(number | string)[]' is not assignable to type 'myArray'. Types of property 'push' are incompatible. - Type '(...items: (string | number)[]) => number' is not assignable to type '(...items: Number[]) => number'. + Type '(...items: (number | string)[]) => number' is not assignable to type '(...items: Number[]) => number'. Types of parameters 'items' and 'items' are incompatible. - Type 'string | number' is not assignable to type 'Number'. + Type 'number | string' is not assignable to type 'Number'. Type 'string' is not assignable to type 'Number'. Property 'toFixed' is missing in type 'String'. @@ -49,8 +49,8 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error ~~~~~~~~ !!! error TS2322: Type '[number, number, string, boolean]' is not assignable to type '[number, number]'. !!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => string | number | boolean' is not assignable to type '() => number'. -!!! error TS2322: Type 'string | number | boolean' is not assignable to type 'number'. +!!! error TS2322: Type '() => number | string | boolean' is not assignable to type '() => number'. +!!! error TS2322: Type 'number | string | boolean' is not assignable to type 'number'. !!! error TS2322: Type 'string' is not assignable to type 'number'. // The resulting type an array literal expression is determined as follows: @@ -76,11 +76,11 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error !!! error TS2322: Property '0' is missing in type 'number[]'. var c2: myArray = [...temp1, ...temp]; // Error cannot assign (number|string)[] to number[] ~~ -!!! error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'. +!!! error TS2322: Type '(number | string)[]' is not assignable to type 'myArray'. !!! error TS2322: Types of property 'push' are incompatible. -!!! error TS2322: Type '(...items: (string | number)[]) => number' is not assignable to type '(...items: Number[]) => number'. +!!! error TS2322: Type '(...items: (number | string)[]) => number' is not assignable to type '(...items: Number[]) => number'. !!! error TS2322: Types of parameters 'items' and 'items' are incompatible. -!!! error TS2322: Type 'string | number' is not assignable to type 'Number'. +!!! error TS2322: Type 'number | string' is not assignable to type 'Number'. !!! error TS2322: Type 'string' is not assignable to type 'Number'. !!! error TS2322: Property 'toFixed' is missing in type 'String'. \ No newline at end of file diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types index 9cdbe0a0a6157..b7224fe91c43c 100644 --- a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types @@ -77,8 +77,8 @@ var myDerivedList: DerivedList; >DerivedList : DerivedList var as = [list, myDerivedList]; // List[] ->as : List[] ->[list, myDerivedList] : List[] +>as : (List | DerivedList)[] +>[list, myDerivedList] : (List | DerivedList)[] >list : List >myDerivedList : DerivedList diff --git a/tests/baselines/reference/arrayOfFunctionTypes3.errors.txt b/tests/baselines/reference/arrayOfFunctionTypes3.errors.txt new file mode 100644 index 0000000000000..499d6bca387e6 --- /dev/null +++ b/tests/baselines/reference/arrayOfFunctionTypes3.errors.txt @@ -0,0 +1,35 @@ +tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts(17,13): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts(26,10): error TS2349: Cannot invoke an expression whose type lacks a call signature. + + +==== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts (2 errors) ==== + // valid uses of arrays of function types + + var x = [() => 1, () => { }]; + var r2 = x[0](); + + class C { + foo: string; + } + var y = [C, C]; + var r3 = new y[0](); + + var a: { (x: number): number; (x: string): string; }; + var b: { (x: number): number; (x: string): string; }; + var c: { (x: number): number; (x: any): any; }; + var z = [a, b, c]; + var r4 = z[0]; + var r5 = r4(''); // any not string + ~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + var r5b = r4(1); + + var a2: { (x: T): number; (x: string): string;}; + var b2: { (x: T): number; (x: string): string; }; + var c2: { (x: number): number; (x: T): any; }; + + var z2 = [a2, b2, c2]; + var r6 = z2[0]; + var r7 = r6(''); // any not string + ~~~~~~ +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. \ No newline at end of file diff --git a/tests/baselines/reference/arrayOfFunctionTypes3.symbols b/tests/baselines/reference/arrayOfFunctionTypes3.symbols deleted file mode 100644 index d26effeb5b77b..0000000000000 --- a/tests/baselines/reference/arrayOfFunctionTypes3.symbols +++ /dev/null @@ -1,93 +0,0 @@ -=== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts === -// valid uses of arrays of function types - -var x = [() => 1, () => { }]; ->x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 2, 3)) - -var r2 = x[0](); ->r2 : Symbol(r2, Decl(arrayOfFunctionTypes3.ts, 3, 3)) ->x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 2, 3)) - -class C { ->C : Symbol(C, Decl(arrayOfFunctionTypes3.ts, 3, 16)) - - foo: string; ->foo : Symbol(foo, Decl(arrayOfFunctionTypes3.ts, 5, 9)) -} -var y = [C, C]; ->y : Symbol(y, Decl(arrayOfFunctionTypes3.ts, 8, 3)) ->C : Symbol(C, Decl(arrayOfFunctionTypes3.ts, 3, 16)) ->C : Symbol(C, Decl(arrayOfFunctionTypes3.ts, 3, 16)) - -var r3 = new y[0](); ->r3 : Symbol(r3, Decl(arrayOfFunctionTypes3.ts, 9, 3)) ->y : Symbol(y, Decl(arrayOfFunctionTypes3.ts, 8, 3)) - -var a: { (x: number): number; (x: string): string; }; ->a : Symbol(a, Decl(arrayOfFunctionTypes3.ts, 11, 3)) ->x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 11, 10)) ->x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 11, 31)) - -var b: { (x: number): number; (x: string): string; }; ->b : Symbol(b, Decl(arrayOfFunctionTypes3.ts, 12, 3)) ->x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 12, 10)) ->x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 12, 31)) - -var c: { (x: number): number; (x: any): any; }; ->c : Symbol(c, Decl(arrayOfFunctionTypes3.ts, 13, 3)) ->x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 13, 10)) ->x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 13, 31)) - -var z = [a, b, c]; ->z : Symbol(z, Decl(arrayOfFunctionTypes3.ts, 14, 3)) ->a : Symbol(a, Decl(arrayOfFunctionTypes3.ts, 11, 3)) ->b : Symbol(b, Decl(arrayOfFunctionTypes3.ts, 12, 3)) ->c : Symbol(c, Decl(arrayOfFunctionTypes3.ts, 13, 3)) - -var r4 = z[0]; ->r4 : Symbol(r4, Decl(arrayOfFunctionTypes3.ts, 15, 3)) ->z : Symbol(z, Decl(arrayOfFunctionTypes3.ts, 14, 3)) - -var r5 = r4(''); // any not string ->r5 : Symbol(r5, Decl(arrayOfFunctionTypes3.ts, 16, 3)) ->r4 : Symbol(r4, Decl(arrayOfFunctionTypes3.ts, 15, 3)) - -var r5b = r4(1); ->r5b : Symbol(r5b, Decl(arrayOfFunctionTypes3.ts, 17, 3)) ->r4 : Symbol(r4, Decl(arrayOfFunctionTypes3.ts, 15, 3)) - -var a2: { (x: T): number; (x: string): string;}; ->a2 : Symbol(a2, Decl(arrayOfFunctionTypes3.ts, 19, 3)) ->T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 19, 11)) ->x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 19, 14)) ->T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 19, 11)) ->x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 19, 30)) - -var b2: { (x: T): number; (x: string): string; }; ->b2 : Symbol(b2, Decl(arrayOfFunctionTypes3.ts, 20, 3)) ->T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 20, 11)) ->x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 20, 14)) ->T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 20, 11)) ->x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 20, 30)) - -var c2: { (x: number): number; (x: T): any; }; ->c2 : Symbol(c2, Decl(arrayOfFunctionTypes3.ts, 21, 3)) ->x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 21, 11)) ->T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 21, 32)) ->x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 21, 35)) ->T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 21, 32)) - -var z2 = [a2, b2, c2]; ->z2 : Symbol(z2, Decl(arrayOfFunctionTypes3.ts, 23, 3)) ->a2 : Symbol(a2, Decl(arrayOfFunctionTypes3.ts, 19, 3)) ->b2 : Symbol(b2, Decl(arrayOfFunctionTypes3.ts, 20, 3)) ->c2 : Symbol(c2, Decl(arrayOfFunctionTypes3.ts, 21, 3)) - -var r6 = z2[0]; ->r6 : Symbol(r6, Decl(arrayOfFunctionTypes3.ts, 24, 3)) ->z2 : Symbol(z2, Decl(arrayOfFunctionTypes3.ts, 23, 3)) - -var r7 = r6(''); // any not string ->r7 : Symbol(r7, Decl(arrayOfFunctionTypes3.ts, 25, 3)) ->r6 : Symbol(r6, Decl(arrayOfFunctionTypes3.ts, 24, 3)) - diff --git a/tests/baselines/reference/arrayOfFunctionTypes3.types b/tests/baselines/reference/arrayOfFunctionTypes3.types deleted file mode 100644 index 0ed92991ed08a..0000000000000 --- a/tests/baselines/reference/arrayOfFunctionTypes3.types +++ /dev/null @@ -1,116 +0,0 @@ -=== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts === -// valid uses of arrays of function types - -var x = [() => 1, () => { }]; ->x : (() => void)[] ->[() => 1, () => { }] : (() => void)[] ->() => 1 : () => number ->1 : number ->() => { } : () => void - -var r2 = x[0](); ->r2 : void ->x[0]() : void ->x[0] : () => void ->x : (() => void)[] ->0 : number - -class C { ->C : C - - foo: string; ->foo : string -} -var y = [C, C]; ->y : typeof C[] ->[C, C] : typeof C[] ->C : typeof C ->C : typeof C - -var r3 = new y[0](); ->r3 : C ->new y[0]() : C ->y[0] : typeof C ->y : typeof C[] ->0 : number - -var a: { (x: number): number; (x: string): string; }; ->a : { (x: number): number; (x: string): string; } ->x : number ->x : string - -var b: { (x: number): number; (x: string): string; }; ->b : { (x: number): number; (x: string): string; } ->x : number ->x : string - -var c: { (x: number): number; (x: any): any; }; ->c : { (x: number): number; (x: any): any; } ->x : number ->x : any - -var z = [a, b, c]; ->z : { (x: number): number; (x: any): any; }[] ->[a, b, c] : { (x: number): number; (x: any): any; }[] ->a : { (x: number): number; (x: string): string; } ->b : { (x: number): number; (x: string): string; } ->c : { (x: number): number; (x: any): any; } - -var r4 = z[0]; ->r4 : { (x: number): number; (x: any): any; } ->z[0] : { (x: number): number; (x: any): any; } ->z : { (x: number): number; (x: any): any; }[] ->0 : number - -var r5 = r4(''); // any not string ->r5 : any ->r4('') : any ->r4 : { (x: number): number; (x: any): any; } ->'' : string - -var r5b = r4(1); ->r5b : number ->r4(1) : number ->r4 : { (x: number): number; (x: any): any; } ->1 : number - -var a2: { (x: T): number; (x: string): string;}; ->a2 : { (x: T): number; (x: string): string; } ->T : T ->x : T ->T : T ->x : string - -var b2: { (x: T): number; (x: string): string; }; ->b2 : { (x: T): number; (x: string): string; } ->T : T ->x : T ->T : T ->x : string - -var c2: { (x: number): number; (x: T): any; }; ->c2 : { (x: number): number; (x: T): any; } ->x : number ->T : T ->x : T ->T : T - -var z2 = [a2, b2, c2]; ->z2 : { (x: number): number; (x: T): any; }[] ->[a2, b2, c2] : { (x: number): number; (x: T): any; }[] ->a2 : { (x: T): number; (x: string): string; } ->b2 : { (x: T): number; (x: string): string; } ->c2 : { (x: number): number; (x: T): any; } - -var r6 = z2[0]; ->r6 : { (x: number): number; (x: T): any; } ->z2[0] : { (x: number): number; (x: T): any; } ->z2 : { (x: number): number; (x: T): any; }[] ->0 : number - -var r7 = r6(''); // any not string ->r7 : any ->r6('') : any ->r6 : { (x: number): number; (x: T): any; } ->'' : string - diff --git a/tests/baselines/reference/asOperator1.types b/tests/baselines/reference/asOperator1.types index 3f69871ea0942..cc8a49ddc55fa 100644 --- a/tests/baselines/reference/asOperator1.types +++ b/tests/baselines/reference/asOperator1.types @@ -24,12 +24,12 @@ var z = Date as any as string; // Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string' var j = 32 as number|string; ->j : string | number ->32 as number|string : string | number +>j : number | string +>32 as number|string : number | string >32 : number j = ''; >j = '' : string ->j : string | number +>j : number | string >'' : string diff --git a/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt index 03dcee9baf3e1..c7552c3fdb2a9 100644 --- a/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt +++ b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(17,1): error TS2322: Type '[number, string]' is not assignable to type 'number[]'. Types of property 'pop' are incompatible. - Type '() => string | number' is not assignable to type '() => number'. - Type 'string | number' is not assignable to type 'number'. + Type '() => number | string' is not assignable to type '() => number'. + Type 'number | string' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(18,1): error TS2322: Type '{}[]' is not assignable to type '[{}]'. Property '0' is missing in type '{}[]'. @@ -28,8 +28,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~~~~~~~ !!! error TS2322: Type '[number, string]' is not assignable to type 'number[]'. !!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => string | number' is not assignable to type '() => number'. -!!! error TS2322: Type 'string | number' is not assignable to type 'number'. +!!! error TS2322: Type '() => number | string' is not assignable to type '() => number'. +!!! error TS2322: Type 'number | string' is not assignable to type 'number'. !!! error TS2322: Type 'string' is not assignable to type 'number'. emptyObjTuple = emptyObjArray; ~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/assignmentCompatBug2.errors.txt b/tests/baselines/reference/assignmentCompatBug2.errors.txt index 15bf111139158..53e126358882e 100644 --- a/tests/baselines/reference/assignmentCompatBug2.errors.txt +++ b/tests/baselines/reference/assignmentCompatBug2.errors.txt @@ -1,7 +1,9 @@ tests/cases/compiler/assignmentCompatBug2.ts(1,5): error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }'. - Property 'b' is missing in type '{ a: number; }'. + Object literal may only specify known properties, and 'a' does not exist in type '{ b: number; }'. tests/cases/compiler/assignmentCompatBug2.ts(3,1): error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }'. - Property 'b' is missing in type '{ a: number; }'. + Object literal may only specify known properties, and 'a' does not exist in type '{ b: number; }'. +tests/cases/compiler/assignmentCompatBug2.ts(5,1): error TS2322: Type '{ b: number; a: number; }' is not assignable to type '{ b: number; }'. + Object literal may only specify known properties, and 'a' does not exist in type '{ b: number; }'. tests/cases/compiler/assignmentCompatBug2.ts(15,1): error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; }'. tests/cases/compiler/assignmentCompatBug2.ts(20,1): error TS2322: Type '{ f: (n: number) => number; m: number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. @@ -10,18 +12,21 @@ tests/cases/compiler/assignmentCompatBug2.ts(33,1): error TS2322: Type '{ f: (n: Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }'. -==== tests/cases/compiler/assignmentCompatBug2.ts (5 errors) ==== +==== tests/cases/compiler/assignmentCompatBug2.ts (6 errors) ==== var b2: { b: number;} = { a: 0 }; // error ~~ !!! error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }'. -!!! error TS2322: Property 'b' is missing in type '{ a: number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'a' does not exist in type '{ b: number; }'. b2 = { a: 0 }; // error ~~ !!! error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }'. -!!! error TS2322: Property 'b' is missing in type '{ a: number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'a' does not exist in type '{ b: number; }'. b2 = {b: 0, a: 0 }; + ~~ +!!! error TS2322: Type '{ b: number; a: number; }' is not assignable to type '{ b: number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'a' does not exist in type '{ b: number; }'. var b3: { f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }; diff --git a/tests/baselines/reference/assignmentCompatBug5.errors.txt b/tests/baselines/reference/assignmentCompatBug5.errors.txt index fd13a07a948c5..790848babf4ae 100644 --- a/tests/baselines/reference/assignmentCompatBug5.errors.txt +++ b/tests/baselines/reference/assignmentCompatBug5.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/assignmentCompatBug5.ts(2,6): error TS2345: Argument of type '{ b: number; }' is not assignable to parameter of type '{ a: number; }'. - Property 'a' is missing in type '{ b: number; }'. + Object literal may only specify known properties, and 'b' does not exist in type '{ a: number; }'. tests/cases/compiler/assignmentCompatBug5.ts(5,6): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'number[]'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/assignmentCompatBug5.ts(8,6): error TS2345: Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'. @@ -14,7 +14,7 @@ tests/cases/compiler/assignmentCompatBug5.ts(9,6): error TS2345: Argument of typ foo1({ b: 5 }); ~~~~~~~~ !!! error TS2345: Argument of type '{ b: number; }' is not assignable to parameter of type '{ a: number; }'. -!!! error TS2345: Property 'a' is missing in type '{ b: number; }'. +!!! error TS2345: Object literal may only specify known properties, and 'b' does not exist in type '{ a: number; }'. function foo2(x: number[]) { } foo2(["s", "t"]); diff --git a/tests/baselines/reference/awaitUnion_es6.types b/tests/baselines/reference/awaitUnion_es6.types index fc7bef8a28c25..d0b5b6ccfd015 100644 --- a/tests/baselines/reference/awaitUnion_es6.types +++ b/tests/baselines/reference/awaitUnion_es6.types @@ -1,6 +1,6 @@ === tests/cases/conformance/async/es6/awaitUnion_es6.ts === declare let a: number | string; ->a : string | number +>a : number | string declare let b: PromiseLike | PromiseLike; >b : PromiseLike | PromiseLike @@ -8,7 +8,7 @@ declare let b: PromiseLike | PromiseLike; >PromiseLike : PromiseLike declare let c: PromiseLike; ->c : PromiseLike +>c : PromiseLike >PromiseLike : PromiseLike declare let d: number | PromiseLike; @@ -16,29 +16,29 @@ declare let d: number | PromiseLike; >PromiseLike : PromiseLike declare let e: number | PromiseLike; ->e : number | PromiseLike +>e : number | PromiseLike >PromiseLike : PromiseLike async function f() { >f : () => Promise let await_a = await a; ->await_a : string | number +>await_a : number | string >a : any let await_b = await b; ->await_b : string | number +>await_b : number | string >b : any let await_c = await c; ->await_c : string | number +>await_c : number | string >c : any let await_d = await d; ->await_d : string | number +>await_d : number | string >d : any let await_e = await e; ->await_e : string | number +>await_e : number | string >e : any } diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types index 2a5ee6a2fe230..933d46cc80228 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types @@ -46,8 +46,8 @@ var r = true ? 1 : 2; >2 : number var r3 = true ? 1 : {}; ->r3 : {} ->true ? 1 : {} : {} +>r3 : number | {} +>true ? 1 : {} : number | {} >true : boolean >1 : number >{} : {} @@ -60,15 +60,15 @@ var r4 = true ? a : b; // typeof a >b : { x: number; z?: number; } var r5 = true ? b : a; // typeof b ->r5 : { x: number; y?: number; } | { x: number; z?: number; } ->true ? b : a : { x: number; y?: number; } | { x: number; z?: number; } +>r5 : { x: number; z?: number; } | { x: number; y?: number; } +>true ? b : a : { x: number; z?: number; } | { x: number; y?: number; } >true : boolean >b : { x: number; z?: number; } >a : { x: number; y?: number; } var r6 = true ? (x: number) => { } : (x: Object) => { }; // returns number => void ->r6 : (x: number) => void ->true ? (x: number) => { } : (x: Object) => { } : (x: number) => void +>r6 : ((x: number) => void) | ((x: Object) => void) +>true ? (x: number) => { } : (x: Object) => { } : ((x: number) => void) | ((x: Object) => void) >true : boolean >(x: number) => { } : (x: number) => void >x : number @@ -80,7 +80,7 @@ var r7: (x: Object) => void = true ? (x: number) => { } : (x: Object) => { }; >r7 : (x: Object) => void >x : Object >Object : Object ->true ? (x: number) => { } : (x: Object) => { } : (x: number) => void +>true ? (x: number) => { } : (x: Object) => { } : ((x: number) => void) | ((x: Object) => void) >true : boolean >(x: number) => { } : (x: number) => void >x : number @@ -89,8 +89,8 @@ var r7: (x: Object) => void = true ? (x: number) => { } : (x: Object) => { }; >Object : Object var r8 = true ? (x: Object) => { } : (x: number) => { }; // returns Object => void ->r8 : (x: Object) => void ->true ? (x: Object) => { } : (x: number) => { } : (x: Object) => void +>r8 : ((x: Object) => void) | ((x: number) => void) +>true ? (x: Object) => { } : (x: number) => { } : ((x: Object) => void) | ((x: number) => void) >true : boolean >(x: Object) => { } : (x: Object) => void >x : Object @@ -107,8 +107,8 @@ var r10: Base = true ? derived : derived2; // no error since we use the contextu >derived2 : Derived2 var r11 = true ? base : derived2; ->r11 : Base ->true ? base : derived2 : Base +>r11 : Base | Derived2 +>true ? base : derived2 : Base | Derived2 >true : boolean >base : Base >derived2 : Derived2 diff --git a/tests/baselines/reference/bestCommonTypeOfTuple.types b/tests/baselines/reference/bestCommonTypeOfTuple.types index 7b7302a9cc2a0..7d3330f486341 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple.types +++ b/tests/baselines/reference/bestCommonTypeOfTuple.types @@ -98,8 +98,8 @@ var e3 = t3[2]; // any >2 : number var e4 = t4[3]; // number ->e4 : number ->t4[3] : number +>e4 : E1 | E2 | number +>t4[3] : E1 | E2 | number >t4 : [E1, E2, number] >3 : number diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.types b/tests/baselines/reference/bestCommonTypeOfTuple2.types index 32196fdf66854..573e346637601 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple2.types +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.types @@ -66,8 +66,8 @@ var t5: [C1, F] >F : F var e11 = t1[4]; // base ->e11 : base ->t1[4] : base +>e11 : C | base +>t1[4] : C | base >t1 : [C, base] >4 : number @@ -78,20 +78,20 @@ var e21 = t2[4]; // {} >4 : number var e31 = t3[4]; // C1 ->e31 : C1 ->t3[4] : C1 +>e31 : C1 | D1 +>t3[4] : C1 | D1 >t3 : [C1, D1] >4 : number var e41 = t4[2]; // base1 ->e41 : base1 ->t4[2] : base1 +>e41 : base1 | C1 +>t4[2] : base1 | C1 >t4 : [base1, C1] >2 : number var e51 = t5[2]; // {} ->e51 : F | C1 ->t5[2] : F | C1 +>e51 : C1 | F +>t5[2] : C1 | F >t5 : [C1, F] >2 : number diff --git a/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types b/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types index df40291b0e507..4c47753a90d7a 100644 --- a/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types +++ b/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types @@ -27,43 +27,43 @@ var z: Z; // All these arrays should be X[] var b1 = [x, y, z]; ->b1 : X[] ->[x, y, z] : X[] +>b1 : (X | Y | Z)[] +>[x, y, z] : (X | Y | Z)[] >x : X >y : Y >z : Z var b2 = [x, z, y]; ->b2 : X[] ->[x, z, y] : X[] +>b2 : (X | Z | Y)[] +>[x, z, y] : (X | Z | Y)[] >x : X >z : Z >y : Y var b3 = [y, x, z]; ->b3 : X[] ->[y, x, z] : X[] +>b3 : (Y | X | Z)[] +>[y, x, z] : (Y | X | Z)[] >y : Y >x : X >z : Z var b4 = [y, z, x]; ->b4 : X[] ->[y, z, x] : X[] +>b4 : (Y | Z | X)[] +>[y, z, x] : (Y | Z | X)[] >y : Y >z : Z >x : X var b5 = [z, x, y]; ->b5 : X[] ->[z, x, y] : X[] +>b5 : (Z | X | Y)[] +>[z, x, y] : (Z | X | Y)[] >z : Z >x : X >y : Y var b6 = [z, y, x]; ->b6 : X[] ->[z, y, x] : X[] +>b6 : (Z | Y | X)[] +>[z, y, x] : (Z | Y | X)[] >z : Z >y : Y >x : X diff --git a/tests/baselines/reference/callWithSpread.types b/tests/baselines/reference/callWithSpread.types index f7097727204ff..8964708c05eb3 100644 --- a/tests/baselines/reference/callWithSpread.types +++ b/tests/baselines/reference/callWithSpread.types @@ -163,8 +163,8 @@ xa[1].foo(1, 2, ...a, "abc"); >xa : X[] >1 : number >foo : (x: number, y: number, ...z: string[]) => any ->...[1, 2, "abc"] : string | number ->[1, 2, "abc"] : (string | number)[] +>...[1, 2, "abc"] : number | string +>[1, 2, "abc"] : (number | string)[] >1 : number >2 : number >"abc" : string diff --git a/tests/baselines/reference/callWithSpreadES6.types b/tests/baselines/reference/callWithSpreadES6.types index ba638207e8a28..9c9e795ce2487 100644 --- a/tests/baselines/reference/callWithSpreadES6.types +++ b/tests/baselines/reference/callWithSpreadES6.types @@ -164,8 +164,8 @@ xa[1].foo(1, 2, ...a, "abc"); >xa : X[] >1 : number >foo : (x: number, y: number, ...z: string[]) => any ->...[1, 2, "abc"] : string | number ->[1, 2, "abc"] : (string | number)[] +>...[1, 2, "abc"] : number | string +>[1, 2, "abc"] : (number | string)[] >1 : number >2 : number >"abc" : string diff --git a/tests/baselines/reference/castingTuple.errors.txt b/tests/baselines/reference/castingTuple.errors.txt index 98be259964d95..62a36c9c15615 100644 --- a/tests/baselines/reference/castingTuple.errors.txt +++ b/tests/baselines/reference/castingTuple.errors.txt @@ -8,11 +8,12 @@ tests/cases/conformance/types/tuple/castingTuple.ts(28,10): error TS2352: Neithe tests/cases/conformance/types/tuple/castingTuple.ts(29,10): error TS2352: Neither type '[C, D]' nor type '[A, I]' is assignable to the other. Types of property '0' are incompatible. Type 'C' is not assignable to type 'A'. + Property 'a' is missing in type 'C'. tests/cases/conformance/types/tuple/castingTuple.ts(30,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'. tests/cases/conformance/types/tuple/castingTuple.ts(30,14): error TS2352: Neither type '[number, string]' nor type 'number[]' is assignable to the other. Types of property 'pop' are incompatible. - Type '() => string | number' is not assignable to type '() => number'. - Type 'string | number' is not assignable to type 'number'. + Type '() => number | string' is not assignable to type '() => number'. + Type 'number | string' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot find name 't4'. @@ -61,14 +62,15 @@ tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot !!! error TS2352: Neither type '[C, D]' nor type '[A, I]' is assignable to the other. !!! error TS2352: Types of property '0' are incompatible. !!! error TS2352: Type 'C' is not assignable to type 'A'. +!!! error TS2352: Property 'a' is missing in type 'C'. var array1 = numStrTuple; ~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'. ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2352: Neither type '[number, string]' nor type 'number[]' is assignable to the other. !!! error TS2352: Types of property 'pop' are incompatible. -!!! error TS2352: Type '() => string | number' is not assignable to type '() => number'. -!!! error TS2352: Type 'string | number' is not assignable to type 'number'. +!!! error TS2352: Type '() => number | string' is not assignable to type '() => number'. +!!! error TS2352: Type 'number | string' is not assignable to type 'number'. !!! error TS2352: Type 'string' is not assignable to type 'number'. t4[2] = 10; ~~ diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types index d6c97b5db81ac..a3a393fba0cbd 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types @@ -17,9 +17,9 @@ declare function foo(obj: I): T >T : T foo({ ->foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | (() => void) | number[] +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | (() => void) | boolean | number | number[] >foo : (obj: I) => T ->{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | (() => void) | number[]; 0: () => void; p: string; } +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; 0: () => void; p: string; } p: "", >p : string diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types index 72a1d5ba04fa1..4abefe4484331 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types @@ -17,9 +17,9 @@ declare function foo(obj: I): T >T : T foo({ ->foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | (() => void) | number[] +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | (() => void) | boolean | number | number[] >foo : (obj: I) => T ->{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | (() => void) | number[]; 0: () => void; p: string; } +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; 0: () => void; p: string; } p: "", >p : string diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types index 5674f6aa39370..ae1004c9819e6 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types @@ -17,9 +17,9 @@ declare function foo(obj: I): T >T : T foo({ ->foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : number | (() => void) | number[] +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : (() => void) | number | number[] >foo : (obj: I) => T ->{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: number | (() => void) | number[]; 0: () => void; p: string; } +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: (() => void) | number | number[]; 0: () => void; p: string; } p: "", >p : string diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types index 93558c075e7a7..e98e0fb8941d6 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types @@ -17,9 +17,9 @@ declare function foo(obj: I): T >T : T foo({ ->foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : number | (() => void) | number[] +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : (() => void) | number | number[] >foo : (obj: I) => T ->{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: number | (() => void) | number[]; 0: () => void; p: string; } +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: (() => void) | number | number[]; 0: () => void; p: string; } p: "", >p : string diff --git a/tests/baselines/reference/conditionalExpression1.errors.txt b/tests/baselines/reference/conditionalExpression1.errors.txt index 0e2919867858d..49ed20953532c 100644 --- a/tests/baselines/reference/conditionalExpression1.errors.txt +++ b/tests/baselines/reference/conditionalExpression1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/conditionalExpression1.ts(1,5): error TS2322: Type 'string | number' is not assignable to type 'boolean'. - Type 'string' is not assignable to type 'boolean'. +tests/cases/compiler/conditionalExpression1.ts(1,5): error TS2322: Type 'number | string' is not assignable to type 'boolean'. + Type 'number' is not assignable to type 'boolean'. ==== tests/cases/compiler/conditionalExpression1.ts (1 errors) ==== var x: boolean = (true ? 1 : ""); // should be an error ~ -!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. -!!! error TS2322: Type 'string' is not assignable to type 'boolean'. \ No newline at end of file +!!! error TS2322: Type 'number | string' is not assignable to type 'boolean'. +!!! error TS2322: Type 'number' is not assignable to type 'boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types index 722ec13c68439..d5530f98fe854 100644 --- a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types +++ b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types @@ -31,27 +31,27 @@ var b: B; //Cond ? Expr1 : Expr2, Expr1 is supertype //Be Not contextually typed true ? x : a; ->true ? x : a : X +>true ? x : a : X | A >true : boolean >x : X >a : A var result1 = true ? x : a; ->result1 : X ->true ? x : a : X +>result1 : X | A +>true ? x : a : X | A >true : boolean >x : X >a : A //Expr1 and Expr2 are literals true ? {} : 1; ->true ? {} : 1 : {} +>true ? {} : 1 : {} | number >true : boolean >{} : {} >1 : number true ? { a: 1 } : { a: 2, b: 'string' }; ->true ? { a: 1 } : { a: 2, b: 'string' } : { a: number; } +>true ? { a: 1 } : { a: 2, b: 'string' } : { a: number; } | { a: number; b: string; } >true : boolean >{ a: 1 } : { a: number; } >a : number @@ -63,15 +63,15 @@ true ? { a: 1 } : { a: 2, b: 'string' }; >'string' : string var result2 = true ? {} : 1; ->result2 : {} ->true ? {} : 1 : {} +>result2 : {} | number +>true ? {} : 1 : {} | number >true : boolean >{} : {} >1 : number var result3 = true ? { a: 1 } : { a: 2, b: 'string' }; ->result3 : { a: number; } ->true ? { a: 1 } : { a: 2, b: 'string' } : { a: number; } +>result3 : { a: number; } | { a: number; b: string; } +>true ? { a: 1 } : { a: 2, b: 'string' } : { a: number; } | { a: number; b: string; } >true : boolean >{ a: 1 } : { a: number; } >a : number @@ -86,7 +86,7 @@ var result3 = true ? { a: 1 } : { a: 2, b: 'string' }; var resultIsX1: X = true ? x : a; >resultIsX1 : X >X : X ->true ? x : a : X +>true ? x : a : X | A >true : boolean >x : X >a : A @@ -95,7 +95,7 @@ var result4: (t: A) => any = true ? (m) => m.propertyX : (n) => n.propertyA; >result4 : (t: A) => any >t : A >A : A ->true ? (m) => m.propertyX : (n) => n.propertyA : (m: A) => any +>true ? (m) => m.propertyX : (n) => n.propertyA : ((m: A) => any) | ((n: A) => number) >true : boolean >(m) => m.propertyX : (m: A) => any >m : A @@ -111,27 +111,27 @@ var result4: (t: A) => any = true ? (m) => m.propertyX : (n) => n.propertyA; //Cond ? Expr1 : Expr2, Expr2 is supertype //Be Not contextually typed true ? a : x; ->true ? a : x : X +>true ? a : x : A | X >true : boolean >a : A >x : X var result5 = true ? a : x; ->result5 : X ->true ? a : x : X +>result5 : A | X +>true ? a : x : A | X >true : boolean >a : A >x : X //Expr1 and Expr2 are literals true ? 1 : {}; ->true ? 1 : {} : {} +>true ? 1 : {} : number | {} >true : boolean >1 : number >{} : {} true ? { a: 2, b: 'string' } : { a: 1 }; ->true ? { a: 2, b: 'string' } : { a: 1 } : { a: number; } +>true ? { a: 2, b: 'string' } : { a: 1 } : { a: number; b: string; } | { a: number; } >true : boolean >{ a: 2, b: 'string' } : { a: number; b: string; } >a : number @@ -143,15 +143,15 @@ true ? { a: 2, b: 'string' } : { a: 1 }; >1 : number var result6 = true ? 1 : {}; ->result6 : {} ->true ? 1 : {} : {} +>result6 : number | {} +>true ? 1 : {} : number | {} >true : boolean >1 : number >{} : {} var result7 = true ? { a: 2, b: 'string' } : { a: 1 }; ->result7 : { a: number; } ->true ? { a: 2, b: 'string' } : { a: 1 } : { a: number; } +>result7 : { a: number; b: string; } | { a: number; } +>true ? { a: 2, b: 'string' } : { a: 1 } : { a: number; b: string; } | { a: number; } >true : boolean >{ a: 2, b: 'string' } : { a: number; b: string; } >a : number @@ -166,7 +166,7 @@ var result7 = true ? { a: 2, b: 'string' } : { a: 1 }; var resultIsX2: X = true ? x : a; >resultIsX2 : X >X : X ->true ? x : a : X +>true ? x : a : X | A >true : boolean >x : X >a : A @@ -175,7 +175,7 @@ var result8: (t: A) => any = true ? (m) => m.propertyA : (n) => n.propertyX; >result8 : (t: A) => any >t : A >A : A ->true ? (m) => m.propertyA : (n) => n.propertyX : (n: A) => any +>true ? (m) => m.propertyA : (n) => n.propertyX : ((m: A) => number) | ((n: A) => any) >true : boolean >(m) => m.propertyA : (m: A) => number >m : A @@ -218,7 +218,7 @@ var result10: (t: X) => any = true ? (m) => m.propertyX1 : (n) => n.propertyX2; //Expr1 and Expr2 are literals var result11: any = true ? 1 : 'string'; >result11 : any ->true ? 1 : 'string' : string | number +>true ? 1 : 'string' : number | string >true : boolean >1 : number >'string' : string diff --git a/tests/baselines/reference/contextualSignatureInstantiation.types b/tests/baselines/reference/contextualSignatureInstantiation.types index 49d6871804c04..dd88a00ae3a3e 100644 --- a/tests/baselines/reference/contextualSignatureInstantiation.types +++ b/tests/baselines/reference/contextualSignatureInstantiation.types @@ -87,24 +87,24 @@ var a = baz(1, 1, g); // Should be number >g : (x: T, y: T) => T var b: number | string; ->b : string | number +>b : number | string var b = foo(g); // Should be number | string ->b : string | number ->foo(g) : string | number +>b : number | string +>foo(g) : number | string >foo : (cb: (x: number, y: string) => T) => T >g : (x: T, y: T) => T var b = bar(1, "one", g); // Should be number | string ->b : string | number ->bar(1, "one", g) : string | number +>b : number | string +>bar(1, "one", g) : number | string >bar : (x: T, y: U, cb: (x: T, y: U) => V) => V >1 : number >"one" : string >g : (x: T, y: T) => T var b = bar("one", 1, g); // Should be number | string ->b : string | number +>b : number | string >bar("one", 1, g) : string | number >bar : (x: T, y: U, cb: (x: T, y: U) => V) => V >"one" : string @@ -112,11 +112,11 @@ var b = bar("one", 1, g); // Should be number | string >g : (x: T, y: T) => T var b = baz(b, b, g); // Should be number | string ->b : string | number ->baz(b, b, g) : string | number +>b : number | string +>baz(b, b, g) : number | string >baz : (x: T, y: T, cb: (x: T, y: T) => U) => U ->b : string | number ->b : string | number +>b : number | string +>b : number | string >g : (x: T, y: T) => T var d: number[] | string[]; @@ -138,7 +138,7 @@ var d = bar(1, "one", h); // Should be number[] | string[] var d = bar("one", 1, h); // Should be number[] | string[] >d : number[] | string[] ->bar("one", 1, h) : number[] | string[] +>bar("one", 1, h) : string[] | number[] >bar : (x: T, y: U, cb: (x: T, y: U) => V) => V >"one" : string >1 : number diff --git a/tests/baselines/reference/contextualTypeWithTuple.errors.txt b/tests/baselines/reference/contextualTypeWithTuple.errors.txt index ff9ace5a2c06f..e447ed62b39ec 100644 --- a/tests/baselines/reference/contextualTypeWithTuple.errors.txt +++ b/tests/baselines/reference/contextualTypeWithTuple.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(3,5): error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]'. Types of property 'pop' are incompatible. - Type '() => string | number | boolean' is not assignable to type '() => string | number'. - Type 'string | number | boolean' is not assignable to type 'string | number'. - Type 'boolean' is not assignable to type 'string | number'. - Type 'boolean' is not assignable to type 'number'. + Type '() => number | string | boolean' is not assignable to type '() => number | string'. + Type 'number | string | boolean' is not assignable to type 'number | string'. + Type 'boolean' is not assignable to type 'number | string'. + Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(15,1): error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]'. tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(18,1): error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]'. Types of property '0' are incompatible. @@ -31,10 +31,10 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(25,1): error TS23 ~~~~~~~~~~~~ !!! error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]'. !!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => string | number | boolean' is not assignable to type '() => string | number'. -!!! error TS2322: Type 'string | number | boolean' is not assignable to type 'string | number'. -!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. +!!! error TS2322: Type '() => number | string | boolean' is not assignable to type '() => number | string'. +!!! error TS2322: Type 'number | string | boolean' is not assignable to type 'number | string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number | string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. var numStrBoolTuple: [number, string, boolean] = [5, "foo", true]; var objNumTuple: [{ a: string }, number] = [{ a: "world" }, 5]; var strTupleTuple: [string, [number, {}]] = ["bar", [5, { x: 1, y: 1 }]]; diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.symbols b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.symbols index 3e23a7812f5b3..172336603ab2e 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.symbols +++ b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.symbols @@ -82,7 +82,5 @@ var x4: IWithCallSignatures | IWithCallSignatures4 = a => /*here a should be any >IWithCallSignatures : Symbol(IWithCallSignatures, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 9, 1)) >IWithCallSignatures4 : Symbol(IWithCallSignatures4, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 18, 1)) >a : Symbol(a, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 35, 52)) ->a.toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18)) >a : Symbol(a, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 35, 52)) ->toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18)) diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.types b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.types index 8e1915d47549d..02dfecf5c0845 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.types +++ b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.types @@ -90,10 +90,10 @@ var x4: IWithCallSignatures | IWithCallSignatures4 = a => /*here a should be any >x4 : IWithCallSignatures | IWithCallSignatures4 >IWithCallSignatures : IWithCallSignatures >IWithCallSignatures4 : IWithCallSignatures4 ->a => /*here a should be any*/ a.toString() : (a: number) => string ->a : number ->a.toString() : string ->a.toString : (radix?: number) => string ->a : number ->toString : (radix?: number) => string +>a => /*here a should be any*/ a.toString() : (a: any) => any +>a : any +>a.toString() : any +>a.toString : any +>a : any +>toString : any diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.types b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.types index c51227fd13a4e..8f2abf37e0e79 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.types +++ b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.types @@ -187,7 +187,7 @@ var arrayI1OrI2: Array | I2> = [i1, i2, { // Like i1 >Array : T[] >I1 : I1 >I2 : I2 ->[i1, i2, { // Like i1 commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI1: a => a, propertyOnlyInI1: "Hello", }, { // Like i2 commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI2: a => a, propertyOnlyInI2: "Hello", }, { // Like i1 and i2 both commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI1: a => a, propertyOnlyInI1: "Hello", methodOnlyInI2: a => a, propertyOnlyInI2: "Hello", }] : (I1 | I2)[] +>[i1, i2, { // Like i1 commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI1: a => a, propertyOnlyInI1: "Hello", }, { // Like i2 commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI2: a => a, propertyOnlyInI2: "Hello", }, { // Like i1 and i2 both commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI1: a => a, propertyOnlyInI1: "Hello", methodOnlyInI2: a => a, propertyOnlyInI2: "Hello", }] : (I1 | I2 | { commonPropertyType: string; commonMethodType: (a: string) => string; commonMethodWithTypeParameter: (a: number) => number; methodOnlyInI1: (a: string) => string; propertyOnlyInI1: string; methodOnlyInI2: (a: string) => string; propertyOnlyInI2: string; })[] >i1 : I1 >i2 : I2 >{ // Like i1 commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI1: a => a, propertyOnlyInI1: "Hello", } : { commonPropertyType: string; commonMethodType: (a: string) => string; commonMethodWithTypeParameter: (a: number) => number; methodOnlyInI1: (a: string) => string; propertyOnlyInI1: string; } diff --git a/tests/baselines/reference/contextualTyping12.errors.txt b/tests/baselines/reference/contextualTyping12.errors.txt new file mode 100644 index 0000000000000..8b079ecc5e0f0 --- /dev/null +++ b/tests/baselines/reference/contextualTyping12.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/contextualTyping12.ts(1,13): error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'. + Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'. + Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. + Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'. + + +==== tests/cases/compiler/contextualTyping12.ts (1 errors) ==== + class foo { public bar:{id:number;}[] = [{id:1}, {id:2, name:"foo"}]; } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'. +!!! error TS2322: Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping12.symbols b/tests/baselines/reference/contextualTyping12.symbols deleted file mode 100644 index bafef4c8e0a00..0000000000000 --- a/tests/baselines/reference/contextualTyping12.symbols +++ /dev/null @@ -1,9 +0,0 @@ -=== tests/cases/compiler/contextualTyping12.ts === -class foo { public bar:{id:number;}[] = [{id:1}, {id:2, name:"foo"}]; } ->foo : Symbol(foo, Decl(contextualTyping12.ts, 0, 0)) ->bar : Symbol(bar, Decl(contextualTyping12.ts, 0, 11)) ->id : Symbol(id, Decl(contextualTyping12.ts, 0, 24)) ->id : Symbol(id, Decl(contextualTyping12.ts, 0, 42)) ->id : Symbol(id, Decl(contextualTyping12.ts, 0, 50)) ->name : Symbol(name, Decl(contextualTyping12.ts, 0, 55)) - diff --git a/tests/baselines/reference/contextualTyping12.types b/tests/baselines/reference/contextualTyping12.types deleted file mode 100644 index 68e2663fb6ab0..0000000000000 --- a/tests/baselines/reference/contextualTyping12.types +++ /dev/null @@ -1,15 +0,0 @@ -=== tests/cases/compiler/contextualTyping12.ts === -class foo { public bar:{id:number;}[] = [{id:1}, {id:2, name:"foo"}]; } ->foo : foo ->bar : { id: number; }[] ->id : number ->[{id:1}, {id:2, name:"foo"}] : { id: number; }[] ->{id:1} : { id: number; } ->id : number ->1 : number ->{id:2, name:"foo"} : { id: number; name: string; } ->id : number ->2 : number ->name : string ->"foo" : string - diff --git a/tests/baselines/reference/contextualTyping17.errors.txt b/tests/baselines/reference/contextualTyping17.errors.txt new file mode 100644 index 0000000000000..24c428db58b76 --- /dev/null +++ b/tests/baselines/reference/contextualTyping17.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/contextualTyping17.ts(1,33): error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. + Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'. + + +==== tests/cases/compiler/contextualTyping17.ts (1 errors) ==== + var foo: {id:number;} = {id:4}; foo = {id: 5, name:"foo"}; + ~~~ +!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping17.symbols b/tests/baselines/reference/contextualTyping17.symbols deleted file mode 100644 index 55631494105ad..0000000000000 --- a/tests/baselines/reference/contextualTyping17.symbols +++ /dev/null @@ -1,9 +0,0 @@ -=== tests/cases/compiler/contextualTyping17.ts === -var foo: {id:number;} = {id:4}; foo = {id: 5, name:"foo"}; ->foo : Symbol(foo, Decl(contextualTyping17.ts, 0, 3)) ->id : Symbol(id, Decl(contextualTyping17.ts, 0, 10)) ->id : Symbol(id, Decl(contextualTyping17.ts, 0, 25)) ->foo : Symbol(foo, Decl(contextualTyping17.ts, 0, 3)) ->id : Symbol(id, Decl(contextualTyping17.ts, 0, 39)) ->name : Symbol(name, Decl(contextualTyping17.ts, 0, 45)) - diff --git a/tests/baselines/reference/contextualTyping17.types b/tests/baselines/reference/contextualTyping17.types deleted file mode 100644 index 649bc339ba1e3..0000000000000 --- a/tests/baselines/reference/contextualTyping17.types +++ /dev/null @@ -1,15 +0,0 @@ -=== tests/cases/compiler/contextualTyping17.ts === -var foo: {id:number;} = {id:4}; foo = {id: 5, name:"foo"}; ->foo : { id: number; } ->id : number ->{id:4} : { id: number; } ->id : number ->4 : number ->foo = {id: 5, name:"foo"} : { id: number; name: string; } ->foo : { id: number; } ->{id: 5, name:"foo"} : { id: number; name: string; } ->id : number ->5 : number ->name : string ->"foo" : string - diff --git a/tests/baselines/reference/contextualTyping2.errors.txt b/tests/baselines/reference/contextualTyping2.errors.txt new file mode 100644 index 0000000000000..2665204b1671c --- /dev/null +++ b/tests/baselines/reference/contextualTyping2.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/contextualTyping2.ts(1,5): error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. + Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'. + + +==== tests/cases/compiler/contextualTyping2.ts (1 errors) ==== + var foo: {id:number;} = {id:4, name:"foo"}; + ~~~ +!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping2.symbols b/tests/baselines/reference/contextualTyping2.symbols deleted file mode 100644 index 9c1020929794b..0000000000000 --- a/tests/baselines/reference/contextualTyping2.symbols +++ /dev/null @@ -1,7 +0,0 @@ -=== tests/cases/compiler/contextualTyping2.ts === -var foo: {id:number;} = {id:4, name:"foo"}; ->foo : Symbol(foo, Decl(contextualTyping2.ts, 0, 3)) ->id : Symbol(id, Decl(contextualTyping2.ts, 0, 10)) ->id : Symbol(id, Decl(contextualTyping2.ts, 0, 25)) ->name : Symbol(name, Decl(contextualTyping2.ts, 0, 30)) - diff --git a/tests/baselines/reference/contextualTyping2.types b/tests/baselines/reference/contextualTyping2.types deleted file mode 100644 index 0658247c089ea..0000000000000 --- a/tests/baselines/reference/contextualTyping2.types +++ /dev/null @@ -1,10 +0,0 @@ -=== tests/cases/compiler/contextualTyping2.ts === -var foo: {id:number;} = {id:4, name:"foo"}; ->foo : { id: number; } ->id : number ->{id:4, name:"foo"} : { id: number; name: string; } ->id : number ->4 : number ->name : string ->"foo" : string - diff --git a/tests/baselines/reference/contextualTyping20.errors.txt b/tests/baselines/reference/contextualTyping20.errors.txt new file mode 100644 index 0000000000000..d723dcd1d1bf7 --- /dev/null +++ b/tests/baselines/reference/contextualTyping20.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/contextualTyping20.ts(1,36): error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'. + Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'. + Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. + Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'. + + +==== tests/cases/compiler/contextualTyping20.ts (1 errors) ==== + var foo:{id:number;}[] = [{id:1}]; foo = [{id:1}, {id:2, name:"foo"}]; + ~~~ +!!! error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'. +!!! error TS2322: Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping20.symbols b/tests/baselines/reference/contextualTyping20.symbols deleted file mode 100644 index 505c6a04a59f2..0000000000000 --- a/tests/baselines/reference/contextualTyping20.symbols +++ /dev/null @@ -1,10 +0,0 @@ -=== tests/cases/compiler/contextualTyping20.ts === -var foo:{id:number;}[] = [{id:1}]; foo = [{id:1}, {id:2, name:"foo"}]; ->foo : Symbol(foo, Decl(contextualTyping20.ts, 0, 3)) ->id : Symbol(id, Decl(contextualTyping20.ts, 0, 9)) ->id : Symbol(id, Decl(contextualTyping20.ts, 0, 27)) ->foo : Symbol(foo, Decl(contextualTyping20.ts, 0, 3)) ->id : Symbol(id, Decl(contextualTyping20.ts, 0, 43)) ->id : Symbol(id, Decl(contextualTyping20.ts, 0, 51)) ->name : Symbol(name, Decl(contextualTyping20.ts, 0, 56)) - diff --git a/tests/baselines/reference/contextualTyping20.types b/tests/baselines/reference/contextualTyping20.types deleted file mode 100644 index be863db836be1..0000000000000 --- a/tests/baselines/reference/contextualTyping20.types +++ /dev/null @@ -1,20 +0,0 @@ -=== tests/cases/compiler/contextualTyping20.ts === -var foo:{id:number;}[] = [{id:1}]; foo = [{id:1}, {id:2, name:"foo"}]; ->foo : { id: number; }[] ->id : number ->[{id:1}] : { id: number; }[] ->{id:1} : { id: number; } ->id : number ->1 : number ->foo = [{id:1}, {id:2, name:"foo"}] : { id: number; }[] ->foo : { id: number; }[] ->[{id:1}, {id:2, name:"foo"}] : { id: number; }[] ->{id:1} : { id: number; } ->id : number ->1 : number ->{id:2, name:"foo"} : { id: number; name: string; } ->id : number ->2 : number ->name : string ->"foo" : string - diff --git a/tests/baselines/reference/contextualTyping21.errors.txt b/tests/baselines/reference/contextualTyping21.errors.txt index d40192c62407f..362ead49ad388 100644 --- a/tests/baselines/reference/contextualTyping21.errors.txt +++ b/tests/baselines/reference/contextualTyping21.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/contextualTyping21.ts(1,36): error TS2322: Type '(number | { id: number; })[]' is not assignable to type '{ id: number; }[]'. - Type 'number | { id: number; }' is not assignable to type '{ id: number; }'. +tests/cases/compiler/contextualTyping21.ts(1,36): error TS2322: Type '({ id: number; } | number)[]' is not assignable to type '{ id: number; }[]'. + Type '{ id: number; } | number' is not assignable to type '{ id: number; }'. Type 'number' is not assignable to type '{ id: number; }'. Property 'id' is missing in type 'Number'. @@ -7,7 +7,7 @@ tests/cases/compiler/contextualTyping21.ts(1,36): error TS2322: Type '(number | ==== tests/cases/compiler/contextualTyping21.ts (1 errors) ==== var foo:{id:number;}[] = [{id:1}]; foo = [{id:1}, 1]; ~~~ -!!! error TS2322: Type '(number | { id: number; })[]' is not assignable to type '{ id: number; }[]'. -!!! error TS2322: Type 'number | { id: number; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Type '({ id: number; } | number)[]' is not assignable to type '{ id: number; }[]'. +!!! error TS2322: Type '{ id: number; } | number' is not assignable to type '{ id: number; }'. !!! error TS2322: Type 'number' is not assignable to type '{ id: number; }'. !!! error TS2322: Property 'id' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping30.errors.txt b/tests/baselines/reference/contextualTyping30.errors.txt index eda30769ac81d..bce19c508967c 100644 --- a/tests/baselines/reference/contextualTyping30.errors.txt +++ b/tests/baselines/reference/contextualTyping30.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/contextualTyping30.ts(1,37): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. - Type 'string | number' is not assignable to type 'number'. +tests/cases/compiler/contextualTyping30.ts(1,37): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. + Type 'number | string' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. ==== tests/cases/compiler/contextualTyping30.ts (1 errors) ==== function foo(param:number[]){}; foo([1, "a"]); ~~~~~~~~ -!!! error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. -!!! error TS2345: Type 'string | number' is not assignable to type 'number'. +!!! error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. +!!! error TS2345: Type 'number | string' is not assignable to type 'number'. !!! error TS2345: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping37.types b/tests/baselines/reference/contextualTyping37.types index 299b440013755..8acd4aedf0440 100644 --- a/tests/baselines/reference/contextualTyping37.types +++ b/tests/baselines/reference/contextualTyping37.types @@ -3,7 +3,7 @@ var foo = <{ id: number; }[]>[{ foo: "s" }, { }]; >foo : { id: number; }[] ><{ id: number; }[]>[{ foo: "s" }, { }] : { id: number; }[] >id : number ->[{ foo: "s" }, { }] : {}[] +>[{ foo: "s" }, { }] : ({ foo: string; } | {})[] >{ foo: "s" } : { foo: string; } >foo : string >"s" : string diff --git a/tests/baselines/reference/contextualTyping4.errors.txt b/tests/baselines/reference/contextualTyping4.errors.txt new file mode 100644 index 0000000000000..48eb2c406f07c --- /dev/null +++ b/tests/baselines/reference/contextualTyping4.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/contextualTyping4.ts(1,13): error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. + Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'. + + +==== tests/cases/compiler/contextualTyping4.ts (1 errors) ==== + class foo { public bar:{id:number;} = {id:5, name:"foo"}; } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping4.symbols b/tests/baselines/reference/contextualTyping4.symbols deleted file mode 100644 index c5dcd4f1577bc..0000000000000 --- a/tests/baselines/reference/contextualTyping4.symbols +++ /dev/null @@ -1,8 +0,0 @@ -=== tests/cases/compiler/contextualTyping4.ts === -class foo { public bar:{id:number;} = {id:5, name:"foo"}; } ->foo : Symbol(foo, Decl(contextualTyping4.ts, 0, 0)) ->bar : Symbol(bar, Decl(contextualTyping4.ts, 0, 11)) ->id : Symbol(id, Decl(contextualTyping4.ts, 0, 24)) ->id : Symbol(id, Decl(contextualTyping4.ts, 0, 39)) ->name : Symbol(name, Decl(contextualTyping4.ts, 0, 44)) - diff --git a/tests/baselines/reference/contextualTyping4.types b/tests/baselines/reference/contextualTyping4.types deleted file mode 100644 index 757c67745f191..0000000000000 --- a/tests/baselines/reference/contextualTyping4.types +++ /dev/null @@ -1,11 +0,0 @@ -=== tests/cases/compiler/contextualTyping4.ts === -class foo { public bar:{id:number;} = {id:5, name:"foo"}; } ->foo : foo ->bar : { id: number; } ->id : number ->{id:5, name:"foo"} : { id: number; name: string; } ->id : number ->5 : number ->name : string ->"foo" : string - diff --git a/tests/baselines/reference/contextualTyping9.errors.txt b/tests/baselines/reference/contextualTyping9.errors.txt new file mode 100644 index 0000000000000..f959d1e2e6969 --- /dev/null +++ b/tests/baselines/reference/contextualTyping9.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/contextualTyping9.ts(1,5): error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'. + Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'. + Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. + Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'. + + +==== tests/cases/compiler/contextualTyping9.ts (1 errors) ==== + var foo:{id:number;}[] = [{id:1}, {id:2, name:"foo"}]; + ~~~ +!!! error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'. +!!! error TS2322: Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping9.symbols b/tests/baselines/reference/contextualTyping9.symbols deleted file mode 100644 index f9ef2220c2013..0000000000000 --- a/tests/baselines/reference/contextualTyping9.symbols +++ /dev/null @@ -1,8 +0,0 @@ -=== tests/cases/compiler/contextualTyping9.ts === -var foo:{id:number;}[] = [{id:1}, {id:2, name:"foo"}]; ->foo : Symbol(foo, Decl(contextualTyping9.ts, 0, 3)) ->id : Symbol(id, Decl(contextualTyping9.ts, 0, 9)) ->id : Symbol(id, Decl(contextualTyping9.ts, 0, 27)) ->id : Symbol(id, Decl(contextualTyping9.ts, 0, 35)) ->name : Symbol(name, Decl(contextualTyping9.ts, 0, 40)) - diff --git a/tests/baselines/reference/contextualTyping9.types b/tests/baselines/reference/contextualTyping9.types deleted file mode 100644 index 46480d64b3030..0000000000000 --- a/tests/baselines/reference/contextualTyping9.types +++ /dev/null @@ -1,14 +0,0 @@ -=== tests/cases/compiler/contextualTyping9.ts === -var foo:{id:number;}[] = [{id:1}, {id:2, name:"foo"}]; ->foo : { id: number; }[] ->id : number ->[{id:1}, {id:2, name:"foo"}] : { id: number; }[] ->{id:1} : { id: number; } ->id : number ->1 : number ->{id:2, name:"foo"} : { id: number; name: string; } ->id : number ->2 : number ->name : string ->"foo" : string - diff --git a/tests/baselines/reference/contextualTypingArrayOfLambdas.types b/tests/baselines/reference/contextualTypingArrayOfLambdas.types index d3e5b9942e37a..0bb6160433627 100644 --- a/tests/baselines/reference/contextualTypingArrayOfLambdas.types +++ b/tests/baselines/reference/contextualTypingArrayOfLambdas.types @@ -23,8 +23,8 @@ class C extends A { } var xs = [(x: A) => { }, (x: B) => { }, (x: C) => { }]; ->xs : ((x: A) => void)[] ->[(x: A) => { }, (x: B) => { }, (x: C) => { }] : ((x: A) => void)[] +>xs : (((x: A) => void) | ((x: B) => void) | ((x: C) => void))[] +>[(x: A) => { }, (x: B) => { }, (x: C) => { }] : (((x: A) => void) | ((x: B) => void) | ((x: C) => void))[] >(x: A) => { } : (x: A) => void >x : A >A : A diff --git a/tests/baselines/reference/contextualTypingOfArrayLiterals1.errors.txt b/tests/baselines/reference/contextualTypingOfArrayLiterals1.errors.txt index 26b06abf78280..a1bfaf56336dd 100644 --- a/tests/baselines/reference/contextualTypingOfArrayLiterals1.errors.txt +++ b/tests/baselines/reference/contextualTypingOfArrayLiterals1.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/contextualTypingOfArrayLiterals1.ts(5,5): error TS2322: Type '(number | Date)[]' is not assignable to type 'I'. +tests/cases/compiler/contextualTypingOfArrayLiterals1.ts(5,5): error TS2322: Type '(Date | number)[]' is not assignable to type 'I'. Index signatures are incompatible. - Type 'number | Date' is not assignable to type 'Date'. + Type 'Date | number' is not assignable to type 'Date'. Type 'number' is not assignable to type 'Date'. Property 'toDateString' is missing in type 'Number'. @@ -12,9 +12,9 @@ tests/cases/compiler/contextualTypingOfArrayLiterals1.ts(5,5): error TS2322: Typ var x3: I = [new Date(), 1]; ~~ -!!! error TS2322: Type '(number | Date)[]' is not assignable to type 'I'. +!!! error TS2322: Type '(Date | number)[]' is not assignable to type 'I'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'number | Date' is not assignable to type 'Date'. +!!! error TS2322: Type 'Date | number' is not assignable to type 'Date'. !!! error TS2322: Type 'number' is not assignable to type 'Date'. !!! error TS2322: Property 'toDateString' is missing in type 'Number'. var r2 = x3[1]; diff --git a/tests/baselines/reference/declFileTypeAnnotationParenType.js b/tests/baselines/reference/declFileTypeAnnotationParenType.js index c61517c733945..126ec3a873ef2 100644 --- a/tests/baselines/reference/declFileTypeAnnotationParenType.js +++ b/tests/baselines/reference/declFileTypeAnnotationParenType.js @@ -29,4 +29,4 @@ declare class c { declare var x: (() => c)[]; declare var y: (() => c)[]; declare var k: (() => c) | string; -declare var l: string | (() => c); +declare var l: (() => c) | string; diff --git a/tests/baselines/reference/declFileTypeAnnotationParenType.types b/tests/baselines/reference/declFileTypeAnnotationParenType.types index 31b6ad037513d..6776a0f492f41 100644 --- a/tests/baselines/reference/declFileTypeAnnotationParenType.types +++ b/tests/baselines/reference/declFileTypeAnnotationParenType.types @@ -23,9 +23,9 @@ var y = [() => new c()]; >c : typeof c var k: (() => c) | string = (() => new c()) || ""; ->k : string | (() => c) +>k : (() => c) | string >c : c ->(() => new c()) || "" : string | (() => c) +>(() => new c()) || "" : (() => c) | string >(() => new c()) : () => c >() => new c() : () => c >new c() : c @@ -33,8 +33,8 @@ var k: (() => c) | string = (() => new c()) || ""; >"" : string var l = (() => new c()) || ""; ->l : string | (() => c) ->(() => new c()) || "" : string | (() => c) +>l : (() => c) | string +>(() => new c()) || "" : (() => c) | string >(() => new c()) : () => c >() => new c() : () => c >new c() : c diff --git a/tests/baselines/reference/declFileTypeAnnotationTypeAlias.types b/tests/baselines/reference/declFileTypeAnnotationTypeAlias.types index beef88c0ca25c..e93f86dbde72f 100644 --- a/tests/baselines/reference/declFileTypeAnnotationTypeAlias.types +++ b/tests/baselines/reference/declFileTypeAnnotationTypeAlias.types @@ -47,7 +47,7 @@ module M { >M : typeof M export type W = Window | string; ->W : string | Window +>W : Window | string >Window : Window export module N { @@ -57,7 +57,7 @@ module M { >Window : Window export var p: W; ->p : string | Window ->W : string | Window +>p : Window | string +>W : Window | string } } diff --git a/tests/baselines/reference/declarationEmitDestructuring3.js b/tests/baselines/reference/declarationEmitDestructuring3.js index b21c63203c894..81cb1d96fd8fc 100644 --- a/tests/baselines/reference/declarationEmitDestructuring3.js +++ b/tests/baselines/reference/declarationEmitDestructuring3.js @@ -15,4 +15,4 @@ function foo(_a) { //// [declarationEmitDestructuring3.d.ts] declare function bar([x, z, ...w]: any[]): void; -declare function foo([x, ...y]?: (string | number | boolean)[]): void; +declare function foo([x, ...y]?: (number | string | boolean)[]): void; diff --git a/tests/baselines/reference/declarationEmitDestructuring3.types b/tests/baselines/reference/declarationEmitDestructuring3.types index da9fc6d66061b..737bb39e078f8 100644 --- a/tests/baselines/reference/declarationEmitDestructuring3.types +++ b/tests/baselines/reference/declarationEmitDestructuring3.types @@ -6,10 +6,10 @@ function bar([x, z, ...w]) { } >w : any[] function foo([x, ...y] = [1, "string", true]) { } ->foo : ([x, ...y]?: (string | number | boolean)[]) => void ->x : string | number | boolean ->y : (string | number | boolean)[] ->[1, "string", true] : (string | number | boolean)[] +>foo : ([x, ...y]?: (number | string | boolean)[]) => void +>x : number | string | boolean +>y : (number | string | boolean)[] +>[1, "string", true] : (number | string | boolean)[] >1 : number >"string" : string >true : boolean diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.js b/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.js index 9a9be8c69da32..28330d94f7797 100644 --- a/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.js +++ b/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.js @@ -23,6 +23,6 @@ var x3 = a[0], y3 = a[1], z3 = a[2]; // emit x3, y3, z3 declare var x: number; declare var x1: number, y1: string; declare var z1: number; -declare var a: (string | number)[]; -declare var x2: string | number; -declare var x3: string | number, y3: string | number, z3: string | number; +declare var a: (number | string)[]; +declare var x2: number | string; +declare var x3: number | string, y3: number | string, z3: number | string; diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.types b/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.types index 0feeaf2db1ad0..9629324b9f92b 100644 --- a/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.types +++ b/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.types @@ -1,7 +1,7 @@ === tests/cases/compiler/declarationEmitDestructuringArrayPattern1.ts === var [] = [1, "hello"]; // Dont emit anything ->[1, "hello"] : (string | number)[] +>[1, "hello"] : (number | string)[] >1 : number >"hello" : string @@ -28,18 +28,18 @@ var [, , z1] = [0, 1, 2]; // emit z1: number >2 : number var a = [1, "hello"]; ->a : (string | number)[] ->[1, "hello"] : (string | number)[] +>a : (number | string)[] +>[1, "hello"] : (number | string)[] >1 : number >"hello" : string var [x2] = a; // emit x2: number | string ->x2 : string | number ->a : (string | number)[] +>x2 : number | string +>a : (number | string)[] var [x3, y3, z3] = a; // emit x3, y3, z3 ->x3 : string | number ->y3 : string | number ->z3 : string | number ->a : (string | number)[] +>x3 : number | string +>y3 : number | string +>z3 : number | string +>a : (number | string)[] diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.js b/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.js index 818b3a6f7a97b..662b4625ec807 100644 --- a/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.js +++ b/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.js @@ -25,7 +25,7 @@ declare var x11: number, y11: string; declare var a11: any, b11: any, c11: any; declare var a2: number, b2: string, x12: number, c2: boolean; declare var x13: number, y13: string; -declare var a3: (string | number)[], b3: { +declare var a3: (number | string)[], b3: { x: number; y: string; }; diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.types b/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.types index 9fce72751cf14..eb028aacff4e2 100644 --- a/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.types +++ b/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.types @@ -56,10 +56,10 @@ var [x13, y13] = [1, "hello"]; >"hello" : string var [a3, b3] = [[x13, y13], { x: x13, y: y13 }]; ->a3 : (string | number)[] +>a3 : (number | string)[] >b3 : { x: number; y: string; } ->[[x13, y13], { x: x13, y: y13 }] : [(string | number)[], { x: number; y: string; }] ->[x13, y13] : (string | number)[] +>[[x13, y13], { x: x13, y: y13 }] : [(number | string)[], { x: number; y: string; }] +>[x13, y13] : (number | string)[] >x13 : number >y13 : string >{ x: x13, y: y13 } : { x: number; y: string; } diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.js b/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.js index 1bd07e7b974e8..d83c1b721d871 100644 --- a/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.js +++ b/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.js @@ -25,7 +25,7 @@ declare var a5: number[]; declare var x14: number, a6: number[]; declare var x15: number, y15: number, a7: number[]; declare var x16: number, y16: number, z16: number, a8: number[]; -declare var a9: (string | number | boolean)[]; -declare var x17: string | number | boolean, a10: (string | number | boolean)[]; -declare var x18: string | number | boolean, y18: string | number | boolean, a12: (string | number | boolean)[]; -declare var x19: string | number | boolean, y19: string | number | boolean, z19: string | number | boolean, a13: (string | number | boolean)[]; +declare var a9: (number | string | boolean)[]; +declare var x17: number | string | boolean, a10: (number | string | boolean)[]; +declare var x18: number | string | boolean, y18: number | string | boolean, a12: (number | string | boolean)[]; +declare var x19: number | string | boolean, y19: number | string | boolean, z19: number | string | boolean, a13: (number | string | boolean)[]; diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.types b/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.types index 2cc56abcb05b5..1e8701eedb520 100644 --- a/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.types +++ b/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.types @@ -34,35 +34,35 @@ var [x16, y16, z16, ...a8] = [1, 2, 3]; >3 : number var [...a9] = [1, "hello", true]; ->a9 : (string | number | boolean)[] ->[1, "hello", true] : (string | number | boolean)[] +>a9 : (number | string | boolean)[] +>[1, "hello", true] : (number | string | boolean)[] >1 : number >"hello" : string >true : boolean var [x17, ...a10] = [1, "hello", true]; ->x17 : string | number | boolean ->a10 : (string | number | boolean)[] ->[1, "hello", true] : (string | number | boolean)[] +>x17 : number | string | boolean +>a10 : (number | string | boolean)[] +>[1, "hello", true] : (number | string | boolean)[] >1 : number >"hello" : string >true : boolean var [x18, y18, ...a12] = [1, "hello", true]; ->x18 : string | number | boolean ->y18 : string | number | boolean ->a12 : (string | number | boolean)[] ->[1, "hello", true] : (string | number | boolean)[] +>x18 : number | string | boolean +>y18 : number | string | boolean +>a12 : (number | string | boolean)[] +>[1, "hello", true] : (number | string | boolean)[] >1 : number >"hello" : string >true : boolean var [x19, y19, z19, ...a13] = [1, "hello", true]; ->x19 : string | number | boolean ->y19 : string | number | boolean ->z19 : string | number | boolean ->a13 : (string | number | boolean)[] ->[1, "hello", true] : (string | number | boolean)[] +>x19 : number | string | boolean +>y19 : number | string | boolean +>z19 : number | string | boolean +>a13 : (number | string | boolean)[] +>[1, "hello", true] : (number | string | boolean)[] >1 : number >"hello" : string >true : boolean diff --git a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.errors.txt b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.errors.txt new file mode 100644 index 0000000000000..dc2db292eb5d5 --- /dev/null +++ b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.errors.txt @@ -0,0 +1,25 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts(14,28): error TS2345: Argument of type '{ a: number; b: number; }' is not assignable to parameter of type '{ a: number; }'. + Object literal may only specify known properties, and 'b' does not exist in type '{ a: number; }'. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts (1 errors) ==== + class Base { + foo(x: { a: number }): { a: number } { + return null; + } + } + + class Derived extends Base { + foo(x: { a: number; b: number }): { a: number; b: number } { + return null; + } + + bar() { + var r = super.foo({ a: 1 }); // { a: number } + var r2 = super.foo({ a: 1, b: 2 }); // { a: number } + ~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ a: number; b: number; }' is not assignable to parameter of type '{ a: number; }'. +!!! error TS2345: Object literal may only specify known properties, and 'b' does not exist in type '{ a: number; }'. + var r3 = this.foo({ a: 1, b: 2 }); // { a: number; b: number; } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.symbols b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.symbols deleted file mode 100644 index e935d7bf66aa2..0000000000000 --- a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.symbols +++ /dev/null @@ -1,56 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts === -class Base { ->Base : Symbol(Base, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 0)) - - foo(x: { a: number }): { a: number } { ->foo : Symbol(foo, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 12)) ->x : Symbol(x, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 1, 8)) ->a : Symbol(a, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 1, 12)) ->a : Symbol(a, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 1, 28)) - - return null; - } -} - -class Derived extends Base { ->Derived : Symbol(Derived, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 4, 1)) ->Base : Symbol(Base, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 0)) - - foo(x: { a: number; b: number }): { a: number; b: number } { ->foo : Symbol(foo, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 6, 28)) ->x : Symbol(x, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 7, 8)) ->a : Symbol(a, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 7, 12)) ->b : Symbol(b, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 7, 23)) ->a : Symbol(a, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 7, 39)) ->b : Symbol(b, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 7, 50)) - - return null; - } - - bar() { ->bar : Symbol(bar, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 9, 5)) - - var r = super.foo({ a: 1 }); // { a: number } ->r : Symbol(r, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 12, 11)) ->super.foo : Symbol(Base.foo, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 12)) ->super : Symbol(Base, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 0)) ->foo : Symbol(Base.foo, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 12)) ->a : Symbol(a, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 12, 27)) - - var r2 = super.foo({ a: 1, b: 2 }); // { a: number } ->r2 : Symbol(r2, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 13, 11)) ->super.foo : Symbol(Base.foo, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 12)) ->super : Symbol(Base, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 0)) ->foo : Symbol(Base.foo, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 12)) ->a : Symbol(a, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 13, 28)) ->b : Symbol(b, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 13, 34)) - - var r3 = this.foo({ a: 1, b: 2 }); // { a: number; b: number; } ->r3 : Symbol(r3, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 14, 11)) ->this.foo : Symbol(foo, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 6, 28)) ->this : Symbol(Derived, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 4, 1)) ->foo : Symbol(foo, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 6, 28)) ->a : Symbol(a, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 14, 27)) ->b : Symbol(b, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 14, 33)) - } -} diff --git a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.types b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.types deleted file mode 100644 index d8d9f657255af..0000000000000 --- a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.types +++ /dev/null @@ -1,69 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts === -class Base { ->Base : Base - - foo(x: { a: number }): { a: number } { ->foo : (x: { a: number; }) => { a: number; } ->x : { a: number; } ->a : number ->a : number - - return null; ->null : null - } -} - -class Derived extends Base { ->Derived : Derived ->Base : Base - - foo(x: { a: number; b: number }): { a: number; b: number } { ->foo : (x: { a: number; b: number; }) => { a: number; b: number; } ->x : { a: number; b: number; } ->a : number ->b : number ->a : number ->b : number - - return null; ->null : null - } - - bar() { ->bar : () => void - - var r = super.foo({ a: 1 }); // { a: number } ->r : { a: number; } ->super.foo({ a: 1 }) : { a: number; } ->super.foo : (x: { a: number; }) => { a: number; } ->super : Base ->foo : (x: { a: number; }) => { a: number; } ->{ a: 1 } : { a: number; } ->a : number ->1 : number - - var r2 = super.foo({ a: 1, b: 2 }); // { a: number } ->r2 : { a: number; } ->super.foo({ a: 1, b: 2 }) : { a: number; } ->super.foo : (x: { a: number; }) => { a: number; } ->super : Base ->foo : (x: { a: number; }) => { a: number; } ->{ a: 1, b: 2 } : { a: number; b: number; } ->a : number ->1 : number ->b : number ->2 : number - - var r3 = this.foo({ a: 1, b: 2 }); // { a: number; b: number; } ->r3 : { a: number; b: number; } ->this.foo({ a: 1, b: 2 }) : { a: number; b: number; } ->this.foo : (x: { a: number; b: number; }) => { a: number; b: number; } ->this : Derived ->foo : (x: { a: number; b: number; }) => { a: number; b: number; } ->{ a: 1, b: 2 } : { a: number; b: number; } ->a : number ->1 : number ->b : number ->2 : number - } -} diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.types b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.types index bde9c867e2b48..adff61e407ce4 100644 --- a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.types +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.types @@ -148,8 +148,8 @@ var [,,,...c10] = [1, 2, 3, 4, "hello"]; > : undefined > : undefined > : undefined ->c10 : (string | number)[] ->[1, 2, 3, 4, "hello"] : (string | number)[] +>c10 : (number | string)[] +>[1, 2, 3, 4, "hello"] : (number | string)[] >1 : number >2 : number >3 : number @@ -157,10 +157,10 @@ var [,,,...c10] = [1, 2, 3, 4, "hello"]; >"hello" : string var [c11, c12, ...c13] = [1, 2, "string"]; ->c11 : string | number ->c12 : string | number ->c13 : (string | number)[] ->[1, 2, "string"] : (string | number)[] +>c11 : number | string +>c12 : number | string +>c13 : (number | string)[] +>[1, 2, "string"] : (number | string)[] >1 : number >2 : number >"string" : string diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES6.types b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES6.types index 2d5d82c5efe55..0a9e75a8aedfe 100644 --- a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES6.types +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES6.types @@ -149,8 +149,8 @@ var [,,,...c10] = [1, 2, 3, 4, "hello"]; > : undefined > : undefined > : undefined ->c10 : (string | number)[] ->[1, 2, 3, 4, "hello"] : (string | number)[] +>c10 : (number | string)[] +>[1, 2, 3, 4, "hello"] : (number | string)[] >1 : number >2 : number >3 : number @@ -158,10 +158,10 @@ var [,,,...c10] = [1, 2, 3, 4, "hello"]; >"hello" : string var [c11, c12, ...c13] = [1, 2, "string"]; ->c11 : string | number ->c12 : string | number ->c13 : (string | number)[] ->[1, 2, "string"] : (string | number)[] +>c11 : number | string +>c12 : number | string +>c13 : (number | string)[] +>[1, 2, "string"] : (number | string)[] >1 : number >2 : number >"string" : string diff --git a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt index 12f50d6886c6e..95524d4bf4dc5 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt @@ -4,8 +4,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(7,29): error TS1005: ',' expected. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(8,4): error TS2345: Argument of type '[number, number, string[][], string]' is not assignable to parameter of type '[number, number, string[][]]'. Types of property 'pop' are incompatible. - Type '() => string | number | string[][]' is not assignable to type '() => number | string[][]'. - Type 'string | number | string[][]' is not assignable to type 'number | string[][]'. + Type '() => number | string[][] | string' is not assignable to type '() => number | string[][]'. + Type 'number | string[][] | string' is not assignable to type 'number | string[][]'. Type 'string' is not assignable to type 'number | string[][]'. Type 'string' is not assignable to type 'string[][]'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(16,8): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. @@ -26,10 +26,10 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(37,4): error TS2345: Argument of type '{ z: boolean; }' is not assignable to parameter of type '{ z?: number; }'. Types of property 'z' are incompatible. Type 'boolean' is not assignable to type 'number'. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(38,4): error TS2345: Argument of type '{ b: boolean; }' is not assignable to parameter of type '{ b: string | number; }'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(38,4): error TS2345: Argument of type '{ b: boolean; }' is not assignable to parameter of type '{ b: number | string; }'. Types of property 'b' are incompatible. - Type 'boolean' is not assignable to type 'string | number'. - Type 'boolean' is not assignable to type 'number'. + Type 'boolean' is not assignable to type 'number | string'. + Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(39,4): error TS2345: Argument of type '[number, number, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'. Types of property '2' are incompatible. Type 'boolean' is not assignable to type '[[any]]'. @@ -73,8 +73,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '[number, number, string[][], string]' is not assignable to parameter of type '[number, number, string[][]]'. !!! error TS2345: Types of property 'pop' are incompatible. -!!! error TS2345: Type '() => string | number | string[][]' is not assignable to type '() => number | string[][]'. -!!! error TS2345: Type 'string | number | string[][]' is not assignable to type 'number | string[][]'. +!!! error TS2345: Type '() => number | string[][] | string' is not assignable to type '() => number | string[][]'. +!!! error TS2345: Type 'number | string[][] | string' is not assignable to type 'number | string[][]'. !!! error TS2345: Type 'string' is not assignable to type 'number | string[][]'. !!! error TS2345: Type 'string' is not assignable to type 'string[][]'. @@ -135,10 +135,10 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( !!! error TS2345: Type 'boolean' is not assignable to type 'number'. c3({ b: true }); // Error, implied type is { b: number|string }. ~~~~~~~~~~~ -!!! error TS2345: Argument of type '{ b: boolean; }' is not assignable to parameter of type '{ b: string | number; }'. +!!! error TS2345: Argument of type '{ b: boolean; }' is not assignable to parameter of type '{ b: number | string; }'. !!! error TS2345: Types of property 'b' are incompatible. -!!! error TS2345: Type 'boolean' is not assignable to type 'string | number'. -!!! error TS2345: Type 'boolean' is not assignable to type 'number'. +!!! error TS2345: Type 'boolean' is not assignable to type 'number | string'. +!!! error TS2345: Type 'boolean' is not assignable to type 'string'. c5([1, 2, false, true]); // Error, implied type is [any, any, [[any]]] ~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '[number, number, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'. diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES5.types b/tests/baselines/reference/destructuringParameterDeclaration3ES5.types index d51a0e32dc8c8..b8d48dcb9d41d 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration3ES5.types +++ b/tests/baselines/reference/destructuringParameterDeclaration3ES5.types @@ -23,8 +23,8 @@ type stringOrNumArray = Array; >Number : Number function a1(...x: (number|string)[]) { } ->a1 : (...x: (string | number)[]) => void ->x : (string | number)[] +>a1 : (...x: (number | string)[]) => void +>x : (number | string)[] function a2(...a) { } >a2 : (...a: any[]) => void @@ -75,8 +75,8 @@ var array = [1, 2, 3]; >3 : number var array2 = [true, false, "hello"]; ->array2 : (string | boolean)[] ->[true, false, "hello"] : (string | boolean)[] +>array2 : (boolean | string)[] +>[true, false, "hello"] : (boolean | string)[] >true : boolean >false : boolean >"hello" : string @@ -90,7 +90,7 @@ a2([...array]); a1(...array); >a1(...array) : void ->a1 : (...x: (string | number)[]) => void +>a1 : (...x: (number | string)[]) => void >...array : number >array : number[] @@ -109,7 +109,7 @@ a9([1, 2, [["string"]], false, true]); // Parameter type is [any, any, [[any]] a10([1, 2, [["string"]], false, true]); // Parameter type is any[] >a10([1, 2, [["string"]], false, true]) : void >a10 : ([a, b, [[c]], ...x]: Iterable) => void ->[1, 2, [["string"]], false, true] : (number | boolean | string[][])[] +>[1, 2, [["string"]], false, true] : (number | string[][] | boolean)[] >1 : number >2 : number >[["string"]] : string[][] diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES6.types b/tests/baselines/reference/destructuringParameterDeclaration3ES6.types index 63d5d074a8d65..b439c4134ba00 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration3ES6.types +++ b/tests/baselines/reference/destructuringParameterDeclaration3ES6.types @@ -23,8 +23,8 @@ type stringOrNumArray = Array; >Number : Number function a1(...x: (number|string)[]) { } ->a1 : (...x: (string | number)[]) => void ->x : (string | number)[] +>a1 : (...x: (number | string)[]) => void +>x : (number | string)[] function a2(...a) { } >a2 : (...a: any[]) => void @@ -75,8 +75,8 @@ var array = [1, 2, 3]; >3 : number var array2 = [true, false, "hello"]; ->array2 : (string | boolean)[] ->[true, false, "hello"] : (string | boolean)[] +>array2 : (boolean | string)[] +>[true, false, "hello"] : (boolean | string)[] >true : boolean >false : boolean >"hello" : string @@ -90,7 +90,7 @@ a2([...array]); a1(...array); >a1(...array) : void ->a1 : (...x: (string | number)[]) => void +>a1 : (...x: (number | string)[]) => void >...array : number >array : number[] @@ -109,7 +109,7 @@ a9([1, 2, [["string"]], false, true]); // Parameter type is [any, any, [[any]] a10([1, 2, [["string"]], false, true]); // Parameter type is any[] >a10([1, 2, [["string"]], false, true]) : void >a10 : ([a, b, [[c]], ...x]: Iterable) => void ->[1, 2, [["string"]], false, true] : (number | boolean | string[][])[] +>[1, 2, [["string"]], false, true] : (number | string[][] | boolean)[] >1 : number >2 : number >[["string"]] : string[][] diff --git a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt index 707fb005a8045..7e71a2cd75315 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(11,13): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(13,13): error TS2370: A rest parameter must be of an array type. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(20,19): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. - Type 'boolean' is not assignable to type 'number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(20,19): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number | string'. + Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(21,7): error TS2304: Cannot find name 'array2'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(22,4): error TS2345: Argument of type '[number, number, string, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'. Types of property '2' are incompatible. @@ -9,8 +9,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( Property '0' is missing in type 'String'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(23,4): error TS2345: Argument of type '[number, number]' is not assignable to parameter of type '[any, any, [[any]]]'. Property '2' is missing in type '[number, number]'. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(24,4): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. - Type 'string | number' is not assignable to type 'number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(24,4): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. + Type 'number | string' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(29,24): error TS1005: ',' expected. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(34,22): error TS2304: Cannot find name 'E1'. @@ -43,8 +43,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( a1(1, 2, "hello", true); // Error, parameter type is (number|string)[] ~~~~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. -!!! error TS2345: Type 'boolean' is not assignable to type 'number'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number | string'. +!!! error TS2345: Type 'boolean' is not assignable to type 'string'. a1(...array2); // Error parameter type is (number|string)[] ~~~~~~ !!! error TS2304: Cannot find name 'array2'. @@ -60,8 +60,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( !!! error TS2345: Property '2' is missing in type '[number, number]'. a6([1, 2, "string"]); // Error, parameter type is number[] ~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. -!!! error TS2345: Type 'string | number' is not assignable to type 'number'. +!!! error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. +!!! error TS2345: Type 'number | string' is not assignable to type 'number'. !!! error TS2345: Type 'string' is not assignable to type 'number'. diff --git a/tests/baselines/reference/destructuringParameterProperties5.errors.txt b/tests/baselines/reference/destructuringParameterProperties5.errors.txt index dca02a9a84e3f..47e50b1df8341 100644 --- a/tests/baselines/reference/destructuringParameterProperties5.errors.txt +++ b/tests/baselines/reference/destructuringParameterProperties5.errors.txt @@ -10,7 +10,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(7 tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,16): error TS2345: Argument of type '[{ x1: number; x2: string; x3: boolean; }, string, boolean]' is not assignable to parameter of type '[{ x: number; y: string; z: boolean; }, number, string]'. Types of property '0' are incompatible. Type '{ x1: number; x2: string; x3: boolean; }' is not assignable to type '{ x: number; y: string; z: boolean; }'. - Property 'x' is missing in type '{ x1: number; x2: string; x3: boolean; }'. + Object literal may only specify known properties, and 'x1' does not exist in type '{ x: number; y: string; z: boolean; }'. ==== tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts (10 errors) ==== @@ -47,5 +47,5 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(1 !!! error TS2345: Argument of type '[{ x1: number; x2: string; x3: boolean; }, string, boolean]' is not assignable to parameter of type '[{ x: number; y: string; z: boolean; }, number, string]'. !!! error TS2345: Types of property '0' are incompatible. !!! error TS2345: Type '{ x1: number; x2: string; x3: boolean; }' is not assignable to type '{ x: number; y: string; z: boolean; }'. -!!! error TS2345: Property 'x' is missing in type '{ x1: number; x2: string; x3: boolean; }'. +!!! error TS2345: Object literal may only specify known properties, and 'x1' does not exist in type '{ x: number; y: string; z: boolean; }'. var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z]; \ No newline at end of file diff --git a/tests/baselines/reference/destructuringVariableDeclaration1ES5.types b/tests/baselines/reference/destructuringVariableDeclaration1ES5.types index ef3507f0f8b0b..a0630fee9951c 100644 --- a/tests/baselines/reference/destructuringVariableDeclaration1ES5.types +++ b/tests/baselines/reference/destructuringVariableDeclaration1ES5.types @@ -84,8 +84,8 @@ var [...c1] = [1,2,3]; >3 : number var [...c2] = [1,2,3, "string"]; ->c2 : (string | number)[] ->[1,2,3, "string"] : (string | number)[] +>c2 : (number | string)[] +>[1,2,3, "string"] : (number | string)[] >1 : number >2 : number >3 : number @@ -113,9 +113,9 @@ var temp1 = [true, false, true] >true : boolean var [d3, d4] = [1, "string", ...temp1]; ->d3 : string | number | boolean ->d4 : string | number | boolean ->[1, "string", ...temp1] : (string | number | boolean)[] +>d3 : number | string | boolean +>d4 : number | string | boolean +>[1, "string", ...temp1] : (number | string | boolean)[] >1 : number >"string" : string >...temp1 : boolean diff --git a/tests/baselines/reference/destructuringVariableDeclaration1ES6.types b/tests/baselines/reference/destructuringVariableDeclaration1ES6.types index d62574c28f0c9..f9faf519b0abb 100644 --- a/tests/baselines/reference/destructuringVariableDeclaration1ES6.types +++ b/tests/baselines/reference/destructuringVariableDeclaration1ES6.types @@ -84,8 +84,8 @@ var [...c1] = [1,2,3]; >3 : number var [...c2] = [1,2,3, "string"]; ->c2 : (string | number)[] ->[1,2,3, "string"] : (string | number)[] +>c2 : (number | string)[] +>[1,2,3, "string"] : (number | string)[] >1 : number >2 : number >3 : number @@ -113,9 +113,9 @@ var temp1 = [true, false, true] >true : boolean var [d3, d4] = [1, "string", ...temp1]; ->d3 : string | number | boolean ->d4 : string | number | boolean ->[1, "string", ...temp1] : (string | number | boolean)[] +>d3 : number | string | boolean +>d4 : number | string | boolean +>[1, "string", ...temp1] : (number | string | boolean)[] >1 : number >"string" : string >...temp1 : boolean diff --git a/tests/baselines/reference/enumBasics.types b/tests/baselines/reference/enumBasics.types index 6a147f01062ef..87f6f12b6b2ef 100644 --- a/tests/baselines/reference/enumBasics.types +++ b/tests/baselines/reference/enumBasics.types @@ -172,8 +172,8 @@ enum E9 { // (refer to .js to validate) // Enum constant members are propagated var doNotPropagate = [ ->doNotPropagate : (E3 | E4 | E7 | E8)[] ->[ E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z] : (E3 | E4 | E7 | E8)[] +>doNotPropagate : (E8 | E7 | E4 | E3)[] +>[ E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z] : (E8 | E7 | E4 | E3)[] E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z >E8.B : E8 @@ -198,8 +198,8 @@ var doNotPropagate = [ ]; // Enum computed members are not propagated var doPropagate = [ ->doPropagate : (E5 | E6 | E9)[] ->[ E9.A, E9.B, E6.B, E6.C, E6.A, E5.A, E5.B, E5.C] : (E5 | E6 | E9)[] +>doPropagate : (E9 | E6 | E5)[] +>[ E9.A, E9.B, E6.B, E6.C, E6.A, E5.A, E5.B, E5.C] : (E9 | E6 | E5)[] E9.A, E9.B, E6.B, E6.C, E6.A, E5.A, E5.B, E5.C >E9.A : E9 diff --git a/tests/baselines/reference/for-of11.errors.txt b/tests/baselines/reference/for-of11.errors.txt index dc527e73efe2b..7c00e454d4e3e 100644 --- a/tests/baselines/reference/for-of11.errors.txt +++ b/tests/baselines/reference/for-of11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/for-ofStatements/for-of11.ts(2,6): error TS2322: Type 'string | number' is not assignable to type 'string'. +tests/cases/conformance/es6/for-ofStatements/for-of11.ts(2,6): error TS2322: Type 'number | string' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. @@ -6,5 +6,5 @@ tests/cases/conformance/es6/for-ofStatements/for-of11.ts(2,6): error TS2322: Typ var v: string; for (v of [0, ""]) { } ~ -!!! error TS2322: Type 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number | string' is not assignable to type 'string'. !!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/for-of12.errors.txt b/tests/baselines/reference/for-of12.errors.txt index f19fa5ed0146d..6100564ba58a2 100644 --- a/tests/baselines/reference/for-of12.errors.txt +++ b/tests/baselines/reference/for-of12.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/for-ofStatements/for-of12.ts(2,6): error TS2322: Type 'string | number' is not assignable to type 'string'. +tests/cases/conformance/es6/for-ofStatements/for-of12.ts(2,6): error TS2322: Type 'number | string' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. @@ -6,5 +6,5 @@ tests/cases/conformance/es6/for-ofStatements/for-of12.ts(2,6): error TS2322: Typ var v: string; for (v of [0, ""].values()) { } ~ -!!! error TS2322: Type 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number | string' is not assignable to type 'string'. !!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt b/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt index 53ecb88363df4..098afe94b471c 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt @@ -7,7 +7,7 @@ tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDec tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(40,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(43,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(46,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. -tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(47,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(47,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | C2 | D)[]'. tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(50,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(53,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. @@ -79,7 +79,7 @@ tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDec !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. for( var arr = [new C(), new C2(), new D()];;){} ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | C2 | D)[]'. for(var arr2 = [new D()];;){} for( var arr2 = new Array>();;){} diff --git a/tests/baselines/reference/functionImplementations.types b/tests/baselines/reference/functionImplementations.types index f277821d69628..4facd65bda774 100644 --- a/tests/baselines/reference/functionImplementations.types +++ b/tests/baselines/reference/functionImplementations.types @@ -324,7 +324,7 @@ class AnotherClass { private x } var f7: (x: number) => string | number = x => { // should be (x: number) => number | string >f7 : (x: number) => string | number >x : number ->x => { // should be (x: number) => number | string if (x < 0) { return x; } return x.toString();} : (x: number) => string | number +>x => { // should be (x: number) => number | string if (x < 0) { return x; } return x.toString();} : (x: number) => number | string >x : number if (x < 0) { return x; } @@ -342,7 +342,7 @@ var f7: (x: number) => string | number = x => { // should be (x: number) => numb var f8: (x: number) => any = x => { // should be (x: number) => Base >f8 : (x: number) => any >x : number ->x => { // should be (x: number) => Base return new Base(); return new Derived2();} : (x: number) => Base +>x => { // should be (x: number) => Base return new Base(); return new Derived2();} : (x: number) => Base | Derived2 >x : number return new Base(); @@ -356,7 +356,7 @@ var f8: (x: number) => any = x => { // should be (x: number) => Base var f9: (x: number) => any = x => { // should be (x: number) => Base >f9 : (x: number) => any >x : number ->x => { // should be (x: number) => Base return new Base(); return new Derived(); return new Derived2();} : (x: number) => Base +>x => { // should be (x: number) => Base return new Base(); return new Derived(); return new Derived2();} : (x: number) => Base | Derived | Derived2 >x : number return new Base(); diff --git a/tests/baselines/reference/generatedContextualTyping.types b/tests/baselines/reference/generatedContextualTyping.types index e8f434d31a88c..06745d0d7aa06 100644 --- a/tests/baselines/reference/generatedContextualTyping.types +++ b/tests/baselines/reference/generatedContextualTyping.types @@ -2125,8 +2125,8 @@ var x216 = >{ func: n => { return [d1, d2]; } }; >d2 : Derived2 var x217 = (<() => Base[]>undefined) || function() { return [d1, d2] }; ->x217 : () => Base[] ->(<() => Base[]>undefined) || function() { return [d1, d2] } : () => Base[] +>x217 : (() => Base[]) | (() => (Derived1 | Derived2)[]) +>(<() => Base[]>undefined) || function() { return [d1, d2] } : (() => Base[]) | (() => (Derived1 | Derived2)[]) >(<() => Base[]>undefined) : () => Base[] ><() => Base[]>undefined : () => Base[] >Base : Base @@ -2137,8 +2137,8 @@ var x217 = (<() => Base[]>undefined) || function() { return [d1, d2] }; >d2 : Derived2 var x218 = (<() => Base[]>undefined) || function named() { return [d1, d2] }; ->x218 : () => Base[] ->(<() => Base[]>undefined) || function named() { return [d1, d2] } : () => Base[] +>x218 : (() => Base[]) | (() => (Derived1 | Derived2)[]) +>(<() => Base[]>undefined) || function named() { return [d1, d2] } : (() => Base[]) | (() => (Derived1 | Derived2)[]) >(<() => Base[]>undefined) : () => Base[] ><() => Base[]>undefined : () => Base[] >Base : Base @@ -2150,8 +2150,8 @@ var x218 = (<() => Base[]>undefined) || function named() { return [d1, d2] }; >d2 : Derived2 var x219 = (<{ (): Base[]; }>undefined) || function() { return [d1, d2] }; ->x219 : () => Base[] ->(<{ (): Base[]; }>undefined) || function() { return [d1, d2] } : () => Base[] +>x219 : (() => Base[]) | (() => (Derived1 | Derived2)[]) +>(<{ (): Base[]; }>undefined) || function() { return [d1, d2] } : (() => Base[]) | (() => (Derived1 | Derived2)[]) >(<{ (): Base[]; }>undefined) : () => Base[] ><{ (): Base[]; }>undefined : () => Base[] >Base : Base @@ -2162,8 +2162,8 @@ var x219 = (<{ (): Base[]; }>undefined) || function() { return [d1, d2] }; >d2 : Derived2 var x220 = (<{ (): Base[]; }>undefined) || function named() { return [d1, d2] }; ->x220 : () => Base[] ->(<{ (): Base[]; }>undefined) || function named() { return [d1, d2] } : () => Base[] +>x220 : (() => Base[]) | (() => (Derived1 | Derived2)[]) +>(<{ (): Base[]; }>undefined) || function named() { return [d1, d2] } : (() => Base[]) | (() => (Derived1 | Derived2)[]) >(<{ (): Base[]; }>undefined) : () => Base[] ><{ (): Base[]; }>undefined : () => Base[] >Base : Base @@ -2175,8 +2175,8 @@ var x220 = (<{ (): Base[]; }>undefined) || function named() { return [d1, d2] }; >d2 : Derived2 var x221 = (undefined) || [d1, d2]; ->x221 : Base[] ->(undefined) || [d1, d2] : Base[] +>x221 : Base[] | (Derived1 | Derived2)[] +>(undefined) || [d1, d2] : Base[] | (Derived1 | Derived2)[] >(undefined) : Base[] >undefined : Base[] >Base : Base @@ -2186,8 +2186,8 @@ var x221 = (undefined) || [d1, d2]; >d2 : Derived2 var x222 = (>undefined) || [d1, d2]; ->x222 : Base[] ->(>undefined) || [d1, d2] : Base[] +>x222 : Base[] | (Derived1 | Derived2)[] +>(>undefined) || [d1, d2] : Base[] | (Derived1 | Derived2)[] >(>undefined) : Base[] >>undefined : Base[] >Array : T[] @@ -2198,8 +2198,8 @@ var x222 = (>undefined) || [d1, d2]; >d2 : Derived2 var x223 = (<{ [n: number]: Base; }>undefined) || [d1, d2]; ->x223 : { [n: number]: Base; } ->(<{ [n: number]: Base; }>undefined) || [d1, d2] : { [n: number]: Base; } +>x223 : { [n: number]: Base; } | (Derived1 | Derived2)[] +>(<{ [n: number]: Base; }>undefined) || [d1, d2] : { [n: number]: Base; } | (Derived1 | Derived2)[] >(<{ [n: number]: Base; }>undefined) : { [n: number]: Base; } ><{ [n: number]: Base; }>undefined : { [n: number]: Base; } >n : number @@ -2210,8 +2210,8 @@ var x223 = (<{ [n: number]: Base; }>undefined) || [d1, d2]; >d2 : Derived2 var x224 = (<{n: Base[]; } >undefined) || { n: [d1, d2] }; ->x224 : { n: Base[]; } ->(<{n: Base[]; } >undefined) || { n: [d1, d2] } : { n: Base[]; } +>x224 : { n: Base[]; } | { n: (Derived1 | Derived2)[]; } +>(<{n: Base[]; } >undefined) || { n: [d1, d2] } : { n: Base[]; } | { n: (Derived1 | Derived2)[]; } >(<{n: Base[]; } >undefined) : { n: Base[]; } ><{n: Base[]; } >undefined : { n: Base[]; } >n : Base[] diff --git a/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types b/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types index c5fd984d32767..5c7500fb5ed94 100644 --- a/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types +++ b/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types @@ -49,7 +49,7 @@ _.all([true, 1, null, 'yes'], _.identity); >_.all : (list: T[], iterator?: Underscore.Iterator, context?: any) => boolean >_ : Underscore.Static >all : (list: T[], iterator?: Underscore.Iterator, context?: any) => boolean ->[true, 1, null, 'yes'] : (string | number | boolean)[] +>[true, 1, null, 'yes'] : (boolean | number | string)[] >true : boolean >1 : number >null : null diff --git a/tests/baselines/reference/genericCallWithArrayLiteralArgs.types b/tests/baselines/reference/genericCallWithArrayLiteralArgs.types index 48a7150ef4426..c8e8b41b5fdda 100644 --- a/tests/baselines/reference/genericCallWithArrayLiteralArgs.types +++ b/tests/baselines/reference/genericCallWithArrayLiteralArgs.types @@ -46,10 +46,10 @@ var r3 = foo([]); // number[] >[] : undefined[] var r4 = foo([1, '']); // {}[] ->r4 : (string | number)[] ->foo([1, '']) : (string | number)[] +>r4 : (number | string)[] +>foo([1, '']) : (number | string)[] >foo : (t: T) => T ->[1, ''] : (string | number)[] +>[1, ''] : (number | string)[] >1 : number >'' : string @@ -57,7 +57,7 @@ var r5 = foo([1, '']); // any[] >r5 : any[] >foo([1, '']) : any[] >foo : (t: T) => T ->[1, ''] : (string | number)[] +>[1, ''] : (number | string)[] >1 : number >'' : string @@ -66,7 +66,7 @@ var r6 = foo([1, '']); // Object[] >foo([1, '']) : Object[] >foo : (t: T) => T >Object : Object ->[1, ''] : (string | number)[] +>[1, ''] : (number | string)[] >1 : number >'' : string diff --git a/tests/baselines/reference/genericTypeArgumentInference1.types b/tests/baselines/reference/genericTypeArgumentInference1.types index 2d64c8f5c58d7..405c328bc4573 100644 --- a/tests/baselines/reference/genericTypeArgumentInference1.types +++ b/tests/baselines/reference/genericTypeArgumentInference1.types @@ -42,12 +42,12 @@ declare var _: Underscore.Static; >Static : Underscore.Static var r = _.all([true, 1, null, 'yes'], _.identity); ->r : string | number | boolean ->_.all([true, 1, null, 'yes'], _.identity) : string | number | boolean +>r : boolean | number | string +>_.all([true, 1, null, 'yes'], _.identity) : boolean | number | string >_.all : (list: T[], iterator?: Underscore.Iterator, context?: any) => T >_ : Underscore.Static >all : (list: T[], iterator?: Underscore.Iterator, context?: any) => T ->[true, 1, null, 'yes'] : (string | number | boolean)[] +>[true, 1, null, 'yes'] : (boolean | number | string)[] >true : boolean >1 : number >null : null diff --git a/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt b/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt index e5c2be7a598a1..20e113faf2aa2 100644 --- a/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt +++ b/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/heterogeneousArrayAndOverloads.ts(9,19): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'string[]'. - Type 'string | number' is not assignable to type 'string'. +tests/cases/compiler/heterogeneousArrayAndOverloads.ts(9,19): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'string[]'. + Type 'number | string' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. @@ -14,8 +14,8 @@ tests/cases/compiler/heterogeneousArrayAndOverloads.ts(9,19): error TS2345: Argu this.test([]); this.test([1, 2, "hi", 5]); // Error ~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'string[]'. -!!! error TS2345: Type 'string | number' is not assignable to type 'string'. +!!! error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'string[]'. +!!! error TS2345: Type 'number | string' is not assignable to type 'string'. !!! error TS2345: Type 'number' is not assignable to type 'string'. } } \ No newline at end of file diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.types b/tests/baselines/reference/heterogeneousArrayLiterals.types index ecfbf75e864c4..952200d74f89c 100644 --- a/tests/baselines/reference/heterogeneousArrayLiterals.types +++ b/tests/baselines/reference/heterogeneousArrayLiterals.types @@ -2,8 +2,8 @@ // type of an array is the best common type of its elements (plus its contextual type if it exists) var a = [1, '']; // {}[] ->a : (string | number)[] ->[1, ''] : (string | number)[] +>a : (number | string)[] +>[1, ''] : (number | string)[] >1 : number >'' : string @@ -14,21 +14,21 @@ var b = [1, null]; // number[] >null : null var c = [1, '', null]; // {}[] ->c : (string | number)[] ->[1, '', null] : (string | number)[] +>c : (number | string)[] +>[1, '', null] : (number | string)[] >1 : number >'' : string >null : null var d = [{}, 1]; // {}[] ->d : {}[] ->[{}, 1] : {}[] +>d : ({} | number)[] +>[{}, 1] : ({} | number)[] >{} : {} >1 : number var e = [{}, Object]; // {}[] ->e : {}[] ->[{}, Object] : {}[] +>e : ({} | ObjectConstructor)[] +>[{}, Object] : ({} | ObjectConstructor)[] >{} : {} >Object : ObjectConstructor @@ -48,8 +48,8 @@ var g = [[1], ['']]; // {}[] >'' : string var h = [{ foo: 1, bar: '' }, { foo: 2 }]; // {foo: number}[] ->h : { foo: number; }[] ->[{ foo: 1, bar: '' }, { foo: 2 }] : { foo: number; }[] +>h : ({ foo: number; bar: string; } | { foo: number; })[] +>[{ foo: 1, bar: '' }, { foo: 2 }] : ({ foo: number; bar: string; } | { foo: number; })[] >{ foo: 1, bar: '' } : { foo: number; bar: string; } >foo : number >1 : number @@ -88,16 +88,16 @@ var k = [() => 1, () => 1]; // { (): number }[] >1 : number var l = [() => 1, () => null]; // { (): any }[] ->l : (() => any)[] ->[() => 1, () => null] : (() => any)[] +>l : ((() => number) | (() => any))[] +>[() => 1, () => null] : ((() => number) | (() => any))[] >() => 1 : () => number >1 : number >() => null : () => any >null : null var m = [() => 1, () => '', () => null]; // { (): any }[] ->m : (() => any)[] ->[() => 1, () => '', () => null] : (() => any)[] +>m : ((() => number) | (() => string) | (() => any))[] +>[() => 1, () => '', () => null] : ((() => number) | (() => string) | (() => any))[] >() => 1 : () => number >1 : number >() => '' : () => string @@ -145,8 +145,8 @@ module Derived { >Derived : typeof Derived var h = [{ foo: base, basear: derived }, { foo: base }]; // {foo: Base}[] ->h : { foo: Base; }[] ->[{ foo: base, basear: derived }, { foo: base }] : { foo: Base; }[] +>h : ({ foo: Base; basear: Derived; } | { foo: Base; })[] +>[{ foo: base, basear: derived }, { foo: base }] : ({ foo: Base; basear: Derived; } | { foo: Base; })[] >{ foo: base, basear: derived } : { foo: Base; basear: Derived; } >foo : Base >base : Base @@ -169,8 +169,8 @@ module Derived { >derived : Derived var j = [() => base, () => derived]; // { {}: Base } ->j : (() => Base)[] ->[() => base, () => derived] : (() => Base)[] +>j : ((() => Base) | (() => Derived))[] +>[() => base, () => derived] : ((() => Base) | (() => Derived))[] >() => base : () => Base >base : Base >() => derived : () => Derived @@ -185,16 +185,16 @@ module Derived { >1 : number var l = [() => base, () => null]; // { (): any }[] ->l : (() => any)[] ->[() => base, () => null] : (() => any)[] +>l : ((() => Base) | (() => any))[] +>[() => base, () => null] : ((() => Base) | (() => any))[] >() => base : () => Base >base : Base >() => null : () => any >null : null var m = [() => base, () => derived, () => null]; // { (): any }[] ->m : (() => any)[] ->[() => base, () => derived, () => null] : (() => any)[] +>m : ((() => Base) | (() => Derived) | (() => any))[] +>[() => base, () => derived, () => null] : ((() => Base) | (() => Derived) | (() => any))[] >() => base : () => Base >base : Base >() => derived : () => Derived @@ -203,8 +203,8 @@ module Derived { >null : null var n = [[() => base], [() => derived]]; // { (): Base }[] ->n : (() => Base)[][] ->[[() => base], [() => derived]] : (() => Base)[][] +>n : ((() => Base)[] | (() => Derived)[])[] +>[[() => base], [() => derived]] : ((() => Base)[] | (() => Derived)[])[] >[() => base] : (() => Base)[] >() => base : () => Base >base : Base @@ -219,8 +219,8 @@ module Derived { >derived2 : Derived2 var p = [derived, derived2, base]; // Base[] ->p : Base[] ->[derived, derived2, base] : Base[] +>p : (Derived | Derived2 | Base)[] +>[derived, derived2, base] : (Derived | Derived2 | Base)[] >derived : Derived >derived2 : Derived2 >base : Base @@ -296,8 +296,8 @@ function foo(t: T, u: U) { >u : U var d = [t, 1]; // {}[] ->d : (number | T)[] ->[t, 1] : (number | T)[] +>d : (T | number)[] +>[t, 1] : (T | number)[] >t : T >1 : number @@ -310,8 +310,8 @@ function foo(t: T, u: U) { >u : U var f = [() => t, () => u, () => null]; // { (): any }[] ->f : (() => any)[] ->[() => t, () => u, () => null] : (() => any)[] +>f : ((() => T) | (() => U) | (() => any))[] +>[() => t, () => u, () => null] : ((() => T) | (() => U) | (() => any))[] >() => t : () => T >t : T >() => u : () => U @@ -350,8 +350,8 @@ function foo2(t: T, u: U) { >u : U var d = [t, 1]; // {}[] ->d : (number | T)[] ->[t, 1] : (number | T)[] +>d : (T | number)[] +>[t, 1] : (T | number)[] >t : T >1 : number @@ -364,8 +364,8 @@ function foo2(t: T, u: U) { >u : U var f = [() => t, () => u, () => null]; // { (): any }[] ->f : (() => any)[] ->[() => t, () => u, () => null] : (() => any)[] +>f : ((() => T) | (() => U) | (() => any))[] +>[() => t, () => u, () => null] : ((() => T) | (() => U) | (() => any))[] >() => t : () => T >t : T >() => u : () => U @@ -374,26 +374,26 @@ function foo2(t: T, u: U) { >null : null var g = [t, base]; // Base[] ->g : Base[] ->[t, base] : Base[] +>g : (T | Base)[] +>[t, base] : (T | Base)[] >t : T >base : Base var h = [t, derived]; // Derived[] ->h : (Derived | T)[] ->[t, derived] : (Derived | T)[] +>h : (T | Derived)[] +>[t, derived] : (T | Derived)[] >t : T >derived : Derived var i = [u, base]; // Base[] ->i : Base[] ->[u, base] : Base[] +>i : (U | Base)[] +>[u, base] : (U | Base)[] >u : U >base : Base var j = [u, derived]; // Derived[] ->j : Derived[] ->[u, derived] : Derived[] +>j : (U | Derived)[] +>[u, derived] : (U | Derived)[] >u : U >derived : Derived } @@ -428,8 +428,8 @@ function foo3(t: T, u: U) { >u : U var d = [t, 1]; // {}[] ->d : (number | T)[] ->[t, 1] : (number | T)[] +>d : (T | number)[] +>[t, 1] : (T | number)[] >t : T >1 : number @@ -442,8 +442,8 @@ function foo3(t: T, u: U) { >u : U var f = [() => t, () => u, () => null]; // { (): any }[] ->f : (() => any)[] ->[() => t, () => u, () => null] : (() => any)[] +>f : ((() => T) | (() => U) | (() => any))[] +>[() => t, () => u, () => null] : ((() => T) | (() => U) | (() => any))[] >() => t : () => T >t : T >() => u : () => U @@ -452,26 +452,26 @@ function foo3(t: T, u: U) { >null : null var g = [t, base]; // Base[] ->g : Base[] ->[t, base] : Base[] +>g : (T | Base)[] +>[t, base] : (T | Base)[] >t : T >base : Base var h = [t, derived]; // Derived[] ->h : Derived[] ->[t, derived] : Derived[] +>h : (T | Derived)[] +>[t, derived] : (T | Derived)[] >t : T >derived : Derived var i = [u, base]; // Base[] ->i : Base[] ->[u, base] : Base[] +>i : (U | Base)[] +>[u, base] : (U | Base)[] >u : U >base : Base var j = [u, derived]; // Derived[] ->j : Derived[] ->[u, derived] : Derived[] +>j : (U | Derived)[] +>[u, derived] : (U | Derived)[] >u : U >derived : Derived } @@ -506,8 +506,8 @@ function foo4(t: T, u: U) { >u : U var d = [t, 1]; // {}[] ->d : (number | T)[] ->[t, 1] : (number | T)[] +>d : (T | number)[] +>[t, 1] : (T | number)[] >t : T >1 : number @@ -520,8 +520,8 @@ function foo4(t: T, u: U) { >u : U var f = [() => t, () => u, () => null]; // { (): any }[] ->f : (() => any)[] ->[() => t, () => u, () => null] : (() => any)[] +>f : ((() => T) | (() => U) | (() => any))[] +>[() => t, () => u, () => null] : ((() => T) | (() => U) | (() => any))[] >() => t : () => T >t : T >() => u : () => U @@ -530,26 +530,26 @@ function foo4(t: T, u: U) { >null : null var g = [t, base]; // Base[] ->g : Base[] ->[t, base] : Base[] +>g : (T | Base)[] +>[t, base] : (T | Base)[] >t : T >base : Base var h = [t, derived]; // Derived[] ->h : (Derived | T)[] ->[t, derived] : (Derived | T)[] +>h : (T | Derived)[] +>[t, derived] : (T | Derived)[] >t : T >derived : Derived var i = [u, base]; // Base[] ->i : Base[] ->[u, base] : Base[] +>i : (U | Base)[] +>[u, base] : (U | Base)[] >u : U >base : Base var j = [u, derived]; // Derived[] ->j : (Derived | U)[] ->[u, derived] : (Derived | U)[] +>j : (U | Derived)[] +>[u, derived] : (U | Derived)[] >u : U >derived : Derived diff --git a/tests/baselines/reference/incompatibleTypes.errors.txt b/tests/baselines/reference/incompatibleTypes.errors.txt index 504ff0088fa6c..e8763b0d54c91 100644 --- a/tests/baselines/reference/incompatibleTypes.errors.txt +++ b/tests/baselines/reference/incompatibleTypes.errors.txt @@ -19,9 +19,9 @@ tests/cases/compiler/incompatibleTypes.ts(42,5): error TS2345: Argument of type Type '() => string' is not assignable to type '(s: string) => number'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/incompatibleTypes.ts(49,5): error TS2345: Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'. - Property 'c' is missing in type '{ e: number; f: number; }'. + Object literal may only specify known properties, and 'e' does not exist in type '{ c: { b: string; }; d: string; }'. tests/cases/compiler/incompatibleTypes.ts(66,5): error TS2322: Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }'. - Property 'a' is missing in type '{ e: number; f: number; }'. + Object literal may only specify known properties, and 'e' does not exist in type '{ a: { a: string; }; b: string; }'. tests/cases/compiler/incompatibleTypes.ts(72,5): error TS2322: Type 'number' is not assignable to type '() => string'. tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => number' is not assignable to type '() => any'. @@ -103,7 +103,7 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => of1({ e: 0, f: 0 }); ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'. -!!! error TS2345: Property 'c' is missing in type '{ e: number; f: number; }'. +!!! error TS2345: Object literal may only specify known properties, and 'e' does not exist in type '{ c: { b: string; }; d: string; }'. interface IMap { [key:string]:string; @@ -123,7 +123,7 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => var o1: { a: { a: string; }; b: string; } = { e: 0, f: 0 }; ~~ !!! error TS2322: Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }'. -!!! error TS2322: Property 'a' is missing in type '{ e: number; f: number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'e' does not exist in type '{ a: { a: string; }; b: string; }'. var a1 = [{ e: 0, f: 0 }, { e: 0, f: 0 }, { e: 0, g: 0 }]; diff --git a/tests/baselines/reference/indexerWithTuple.types b/tests/baselines/reference/indexerWithTuple.types index 4faae2cda29c3..7605fba051866 100644 --- a/tests/baselines/reference/indexerWithTuple.types +++ b/tests/baselines/reference/indexerWithTuple.types @@ -101,20 +101,20 @@ var eleUnion11 = unionTuple1[1]; // string | number >1 : number var eleUnion12 = unionTuple1[2]; // string | number ->eleUnion12 : string | number ->unionTuple1[2] : string | number +>eleUnion12 : number | string +>unionTuple1[2] : number | string >unionTuple1 : [number, string | number] >2 : number var eleUnion13 = unionTuple1[idx0]; // string | number ->eleUnion13 : string | number ->unionTuple1[idx0] : string | number +>eleUnion13 : number | string +>unionTuple1[idx0] : number | string >unionTuple1 : [number, string | number] >idx0 : number var eleUnion14 = unionTuple1[idx1]; // string | number ->eleUnion14 : string | number ->unionTuple1[idx1] : string | number +>eleUnion14 : number | string +>unionTuple1[idx1] : number | string >unionTuple1 : [number, string | number] >idx1 : number @@ -143,20 +143,20 @@ var eleUnion21 = unionTuple2[1]; // string | number >1 : number var eleUnion22 = unionTuple2[2]; // string | number | boolean ->eleUnion22 : string | number | boolean ->unionTuple2[2] : string | number | boolean +>eleUnion22 : boolean | string | number +>unionTuple2[2] : boolean | string | number >unionTuple2 : [boolean, string | number] >2 : number var eleUnion23 = unionTuple2[idx0]; // string | number | boolean ->eleUnion23 : string | number | boolean ->unionTuple2[idx0] : string | number | boolean +>eleUnion23 : boolean | string | number +>unionTuple2[idx0] : boolean | string | number >unionTuple2 : [boolean, string | number] >idx0 : number var eleUnion24 = unionTuple2[idx1]; // string | number | boolean ->eleUnion24 : string | number | boolean ->unionTuple2[idx1] : string | number | boolean +>eleUnion24 : boolean | string | number +>unionTuple2[idx1] : boolean | string | number >unionTuple2 : [boolean, string | number] >idx1 : number diff --git a/tests/baselines/reference/inferentialTypingUsingApparentType3.types b/tests/baselines/reference/inferentialTypingUsingApparentType3.types index 7d0da8f4b06c0..9e0a4ceaea6de 100644 --- a/tests/baselines/reference/inferentialTypingUsingApparentType3.types +++ b/tests/baselines/reference/inferentialTypingUsingApparentType3.types @@ -49,10 +49,10 @@ class ObjectField }> { } var person = new ObjectField({ ->person : ObjectField<{}, { [x: string]: CharField | NumberField; id: NumberField; name: CharField; }> ->new ObjectField({ id: new NumberField(), name: new CharField()}) : ObjectField<{}, { [x: string]: CharField | NumberField; id: NumberField; name: CharField; }> +>person : ObjectField<{}, { [x: string]: NumberField | CharField; id: NumberField; name: CharField; }> +>new ObjectField({ id: new NumberField(), name: new CharField()}) : ObjectField<{}, { [x: string]: NumberField | CharField; id: NumberField; name: CharField; }> >ObjectField : typeof ObjectField ->{ id: new NumberField(), name: new CharField()} : { [x: string]: CharField | NumberField; id: NumberField; name: CharField; } +>{ id: new NumberField(), name: new CharField()} : { [x: string]: NumberField | CharField; id: NumberField; name: CharField; } id: new NumberField(), >id : NumberField @@ -68,8 +68,8 @@ var person = new ObjectField({ person.fields.id; >person.fields.id : NumberField ->person.fields : { [x: string]: CharField | NumberField; id: NumberField; name: CharField; } ->person : ObjectField<{}, { [x: string]: CharField | NumberField; id: NumberField; name: CharField; }> ->fields : { [x: string]: CharField | NumberField; id: NumberField; name: CharField; } +>person.fields : { [x: string]: NumberField | CharField; id: NumberField; name: CharField; } +>person : ObjectField<{}, { [x: string]: NumberField | CharField; id: NumberField; name: CharField; }> +>fields : { [x: string]: NumberField | CharField; id: NumberField; name: CharField; } >id : NumberField diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt b/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt index 3ec718f3b25fe..0c4b95214b02d 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt @@ -7,7 +7,7 @@ tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDec tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(43,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(46,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. -tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(47,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(47,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | C2 | D)[]'. tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(50,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(53,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. @@ -79,7 +79,7 @@ tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDec !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. var arr = [new C(), new C2(), new D()]; ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | C2 | D)[]'. var arr2 = [new D()]; var arr2 = new Array>(); diff --git a/tests/baselines/reference/iteratorSpreadInCall12.types b/tests/baselines/reference/iteratorSpreadInCall12.types index fcc4bbc3d454e..4307daa78b012 100644 --- a/tests/baselines/reference/iteratorSpreadInCall12.types +++ b/tests/baselines/reference/iteratorSpreadInCall12.types @@ -1,9 +1,9 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall12.ts === new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); ->new Foo(...[...new SymbolIterator, ...[...new StringIterator]]) : Foo +>new Foo(...[...new SymbolIterator, ...[...new StringIterator]]) : Foo >Foo : typeof Foo ->...[...new SymbolIterator, ...[...new StringIterator]] : string | symbol ->[...new SymbolIterator, ...[...new StringIterator]] : (string | symbol)[] +>...[...new SymbolIterator, ...[...new StringIterator]] : symbol | string +>[...new SymbolIterator, ...[...new StringIterator]] : (symbol | string)[] >...new SymbolIterator : symbol >new SymbolIterator : SymbolIterator >SymbolIterator : typeof SymbolIterator diff --git a/tests/baselines/reference/iteratorSpreadInCall5.types b/tests/baselines/reference/iteratorSpreadInCall5.types index 2401a41cca8de..631ad940554d8 100644 --- a/tests/baselines/reference/iteratorSpreadInCall5.types +++ b/tests/baselines/reference/iteratorSpreadInCall5.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall5.ts === foo(...new SymbolIterator, ...new StringIterator); >foo(...new SymbolIterator, ...new StringIterator) : void ->foo : (...s: (string | symbol)[]) => void +>foo : (...s: (symbol | string)[]) => void >...new SymbolIterator : symbol >new SymbolIterator : SymbolIterator >SymbolIterator : typeof SymbolIterator @@ -10,8 +10,8 @@ foo(...new SymbolIterator, ...new StringIterator); >StringIterator : typeof StringIterator function foo(...s: (symbol | string)[]) { } ->foo : (...s: (string | symbol)[]) => void ->s : (string | symbol)[] +>foo : (...s: (symbol | string)[]) => void +>s : (symbol | string)[] class SymbolIterator { >SymbolIterator : SymbolIterator diff --git a/tests/baselines/reference/iteratorSpreadInCall6.errors.txt b/tests/baselines/reference/iteratorSpreadInCall6.errors.txt index be085beb63286..0a0da985aceaa 100644 --- a/tests/baselines/reference/iteratorSpreadInCall6.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall6.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts(1,28): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | symbol'. - Type 'string' is not assignable to type 'symbol'. +tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts(1,28): error TS2345: Argument of type 'string' is not assignable to parameter of type 'symbol | number'. + Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts (1 errors) ==== foo(...new SymbolIterator, ...new StringIterator); ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | symbol'. -!!! error TS2345: Type 'string' is not assignable to type 'symbol'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'symbol | number'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. function foo(...s: (symbol | number)[]) { } class SymbolIterator { diff --git a/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.errors.txt b/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.errors.txt new file mode 100644 index 0000000000000..bd210c555700b --- /dev/null +++ b/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrExpressionIsContextuallyTyped.ts(6,5): error TS2322: Type '{ a: string; b: number; } | { a: string; b: boolean; }' is not assignable to type '{ a: string; }'. + Type '{ a: string; b: number; }' is not assignable to type '{ a: string; }'. + Object literal may only specify known properties, and 'b' does not exist in type '{ a: string; }'. + + +==== tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrExpressionIsContextuallyTyped.ts (1 errors) ==== + // The || operator permits the operands to be of any type. + // If the || expression is contextually typed, the operands are contextually typed by the + // same type and the result is of the best common type of the contextual type and the two + // operand types. + + var r: { a: string } = { a: '', b: 123 } || { a: '', b: true }; + ~ +!!! error TS2322: Type '{ a: string; b: number; } | { a: string; b: boolean; }' is not assignable to type '{ a: string; }'. +!!! error TS2322: Type '{ a: string; b: number; }' is not assignable to type '{ a: string; }'. +!!! error TS2322: Object literal may only specify known properties, and 'b' does not exist in type '{ a: string; }'. \ No newline at end of file diff --git a/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.symbols b/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.symbols deleted file mode 100644 index 90fc4ac163ce5..0000000000000 --- a/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.symbols +++ /dev/null @@ -1,14 +0,0 @@ -=== tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrExpressionIsContextuallyTyped.ts === -// The || operator permits the operands to be of any type. -// If the || expression is contextually typed, the operands are contextually typed by the -// same type and the result is of the best common type of the contextual type and the two -// operand types. - -var r: { a: string } = { a: '', b: 123 } || { a: '', b: true }; ->r : Symbol(r, Decl(logicalOrExpressionIsContextuallyTyped.ts, 5, 3)) ->a : Symbol(a, Decl(logicalOrExpressionIsContextuallyTyped.ts, 5, 8)) ->a : Symbol(a, Decl(logicalOrExpressionIsContextuallyTyped.ts, 5, 24)) ->b : Symbol(b, Decl(logicalOrExpressionIsContextuallyTyped.ts, 5, 31)) ->a : Symbol(a, Decl(logicalOrExpressionIsContextuallyTyped.ts, 5, 45)) ->b : Symbol(b, Decl(logicalOrExpressionIsContextuallyTyped.ts, 5, 52)) - diff --git a/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.types b/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.types deleted file mode 100644 index 52315226bb64c..0000000000000 --- a/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.types +++ /dev/null @@ -1,21 +0,0 @@ -=== tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrExpressionIsContextuallyTyped.ts === -// The || operator permits the operands to be of any type. -// If the || expression is contextually typed, the operands are contextually typed by the -// same type and the result is of the best common type of the contextual type and the two -// operand types. - -var r: { a: string } = { a: '', b: 123 } || { a: '', b: true }; ->r : { a: string; } ->a : string ->{ a: '', b: 123 } || { a: '', b: true } : { a: string; b: number; } | { a: string; b: boolean; } ->{ a: '', b: 123 } : { a: string; b: number; } ->a : string ->'' : string ->b : number ->123 : number ->{ a: '', b: true } : { a: string; b: boolean; } ->a : string ->'' : string ->b : boolean ->true : boolean - diff --git a/tests/baselines/reference/logicalOrOperatorWithEveryType.types b/tests/baselines/reference/logicalOrOperatorWithEveryType.types index ecf6b23e72979..04bc188e308ef 100644 --- a/tests/baselines/reference/logicalOrOperatorWithEveryType.types +++ b/tests/baselines/reference/logicalOrOperatorWithEveryType.types @@ -121,26 +121,26 @@ var rb4 = a4 || a2; // string || boolean is string | boolean >a2 : boolean var rb5 = a5 || a2; // void || boolean is void | boolean ->rb5 : boolean | void ->a5 || a2 : boolean | void +>rb5 : void | boolean +>a5 || a2 : void | boolean >a5 : void >a2 : boolean var rb6 = a6 || a2; // enum || boolean is E | boolean ->rb6 : boolean | E ->a6 || a2 : boolean | E +>rb6 : E | boolean +>a6 || a2 : E | boolean >a6 : E >a2 : boolean var rb7 = a7 || a2; // object || boolean is object | boolean ->rb7 : boolean | { a: string; } ->a7 || a2 : boolean | { a: string; } +>rb7 : { a: string; } | boolean +>a7 || a2 : { a: string; } | boolean >a7 : { a: string; } >a2 : boolean var rb8 = a8 || a2; // array || boolean is array | boolean ->rb8 : boolean | string[] ->a8 || a2 : boolean | string[] +>rb8 : string[] | boolean +>a8 || a2 : string[] | boolean >a8 : string[] >a2 : boolean @@ -163,8 +163,8 @@ var rc1 = a1 || a3; // any || number is any >a3 : number var rc2 = a2 || a3; // boolean || number is boolean | number ->rc2 : number | boolean ->a2 || a3 : number | boolean +>rc2 : boolean | number +>a2 || a3 : boolean | number >a2 : boolean >a3 : number @@ -181,26 +181,26 @@ var rc4 = a4 || a3; // string || number is string | number >a3 : number var rc5 = a5 || a3; // void || number is void | number ->rc5 : number | void ->a5 || a3 : number | void +>rc5 : void | number +>a5 || a3 : void | number >a5 : void >a3 : number var rc6 = a6 || a3; // enum || number is number ->rc6 : number ->a6 || a3 : number +>rc6 : E | number +>a6 || a3 : E | number >a6 : E >a3 : number var rc7 = a7 || a3; // object || number is object | number ->rc7 : number | { a: string; } ->a7 || a3 : number | { a: string; } +>rc7 : { a: string; } | number +>a7 || a3 : { a: string; } | number >a7 : { a: string; } >a3 : number var rc8 = a8 || a3; // array || number is array | number ->rc8 : number | string[] ->a8 || a3 : number | string[] +>rc8 : string[] | number +>a8 || a3 : string[] | number >a8 : string[] >a3 : number @@ -223,14 +223,14 @@ var rd1 = a1 || a4; // any || string is any >a4 : string var rd2 = a2 || a4; // boolean || string is boolean | string ->rd2 : string | boolean ->a2 || a4 : string | boolean +>rd2 : boolean | string +>a2 || a4 : boolean | string >a2 : boolean >a4 : string var rd3 = a3 || a4; // number || string is number | string ->rd3 : string | number ->a3 || a4 : string | number +>rd3 : number | string +>a3 || a4 : number | string >a3 : number >a4 : string @@ -241,26 +241,26 @@ var rd4 = a4 || a4; // string || string is string >a4 : string var rd5 = a5 || a4; // void || string is void | string ->rd5 : string | void ->a5 || a4 : string | void +>rd5 : void | string +>a5 || a4 : void | string >a5 : void >a4 : string var rd6 = a6 || a4; // enum || string is enum | string ->rd6 : string | E ->a6 || a4 : string | E +>rd6 : E | string +>a6 || a4 : E | string >a6 : E >a4 : string var rd7 = a7 || a4; // object || string is object | string ->rd7 : string | { a: string; } ->a7 || a4 : string | { a: string; } +>rd7 : { a: string; } | string +>a7 || a4 : { a: string; } | string >a7 : { a: string; } >a4 : string var rd8 = a8 || a4; // array || string is array | string ->rd8 : string | string[] ->a8 || a4 : string | string[] +>rd8 : string[] | string +>a8 || a4 : string[] | string >a8 : string[] >a4 : string @@ -307,20 +307,20 @@ var re5 = a5 || a5; // void || void is void >a5 : void var re6 = a6 || a5; // enum || void is enum | void ->re6 : void | E ->a6 || a5 : void | E +>re6 : E | void +>a6 || a5 : E | void >a6 : E >a5 : void var re7 = a7 || a5; // object || void is object | void ->re7 : void | { a: string; } ->a7 || a5 : void | { a: string; } +>re7 : { a: string; } | void +>a7 || a5 : { a: string; } | void >a7 : { a: string; } >a5 : void var re8 = a8 || a5; // array || void is array | void ->re8 : void | string[] ->a8 || a5 : void | string[] +>re8 : string[] | void +>a8 || a5 : string[] | void >a8 : string[] >a5 : void @@ -349,8 +349,8 @@ var rg2 = a2 || a6; // boolean || enum is boolean | enum >a6 : E var rg3 = a3 || a6; // number || enum is number ->rg3 : number ->a3 || a6 : number +>rg3 : number | E +>a3 || a6 : number | E >a3 : number >a6 : E @@ -373,14 +373,14 @@ var rg6 = a6 || a6; // enum || enum is E >a6 : E var rg7 = a7 || a6; // object || enum is object | enum ->rg7 : E | { a: string; } ->a7 || a6 : E | { a: string; } +>rg7 : { a: string; } | E +>a7 || a6 : { a: string; } | E >a7 : { a: string; } >a6 : E var rg8 = a8 || a6; // array || enum is array | enum ->rg8 : E | string[] ->a8 || a6 : E | string[] +>rg8 : string[] | E +>a8 || a6 : string[] | E >a8 : string[] >a6 : E @@ -439,8 +439,8 @@ var rh7 = a7 || a7; // object || object is object >a7 : { a: string; } var rh8 = a8 || a7; // array || object is array | object ->rh8 : { a: string; } | string[] ->a8 || a7 : { a: string; } | string[] +>rh8 : string[] | { a: string; } +>a8 || a7 : string[] | { a: string; } >a8 : string[] >a7 : { a: string; } diff --git a/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types b/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types index f887ad7ae140c..df8f6cac6db78 100644 --- a/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types +++ b/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types @@ -107,8 +107,8 @@ function fn3u : U var r3 = t || { a: '' }; ->r3 : { a: string; } ->t || { a: '' } : { a: string; } +>r3 : T | { a: string; } +>t || { a: '' } : T | { a: string; } >t : T >{ a: '' } : { a: string; } >a : string diff --git a/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt b/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt index 2fb7bd1bfbbb7..7445ab85a54c9 100644 --- a/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt +++ b/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt @@ -1,10 +1,11 @@ -tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(10,30): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. - Type 'string | number' is not assignable to type 'number'. +tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(7,30): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(10,30): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. + Type 'number | string' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(11,11): error TS2346: Supplied parameters do not match any signature of call target. -==== tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts (2 errors) ==== +==== tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts (3 errors) ==== function map(xs: T[], f: (x: T) => U) { var ys: U[] = []; xs.forEach(x => ys.push(f(x))); @@ -12,12 +13,14 @@ tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(11,11): e } var r0 = map([1, ""], (x) => x.toString()); + ~~~~~~~~~~~~ +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. var r5 = map([1, ""], (x) => x.toString()); var r6 = map([1, ""], (x) => x.toString()); var r7 = map([1, ""], (x) => x.toString()); // error ~~~~~~~ -!!! error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. -!!! error TS2345: Type 'string | number' is not assignable to type 'number'. +!!! error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. +!!! error TS2345: Type 'number | string' is not assignable to type 'number'. !!! error TS2345: Type 'string' is not assignable to type 'number'. var r7b = map([1, ""], (x) => x.toString()); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/narrowTypeByInstanceof.types b/tests/baselines/reference/narrowTypeByInstanceof.types index b98b1e4d234e0..e6a3466b88f5c 100644 --- a/tests/baselines/reference/narrowTypeByInstanceof.types +++ b/tests/baselines/reference/narrowTypeByInstanceof.types @@ -22,24 +22,24 @@ } type FileMatchOrMatch = FileMatch | Match; ->FileMatchOrMatch : Match | FileMatch +>FileMatchOrMatch : FileMatch | Match >FileMatch : FileMatch >Match : Match let elementA: FileMatchOrMatch, elementB: FileMatchOrMatch; ->elementA : Match | FileMatch ->FileMatchOrMatch : Match | FileMatch ->elementB : Match | FileMatch ->FileMatchOrMatch : Match | FileMatch +>elementA : FileMatch | Match +>FileMatchOrMatch : FileMatch | Match +>elementB : FileMatch | Match +>FileMatchOrMatch : FileMatch | Match if (elementA instanceof FileMatch && elementB instanceof FileMatch) { >elementA instanceof FileMatch && elementB instanceof FileMatch : boolean >elementA instanceof FileMatch : boolean ->elementA : Match | FileMatch +>elementA : FileMatch | Match >FileMatch : typeof FileMatch >elementB instanceof FileMatch : boolean ->elementB : Match | FileMatch +>elementB : FileMatch | Match >FileMatch : typeof FileMatch let a = elementA.resource().path; @@ -63,10 +63,10 @@ if (elementA instanceof FileMatch && elementB instanceof FileMatch) { } else if (elementA instanceof Match && elementB instanceof Match) { >elementA instanceof Match && elementB instanceof Match : boolean >elementA instanceof Match : boolean ->elementA : Match | FileMatch +>elementA : FileMatch | Match >Match : typeof Match >elementB instanceof Match : boolean ->elementB : Match | FileMatch +>elementB : FileMatch | Match >Match : typeof Match let a = elementA.range(); diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt index 7f73ac6da0a53..71e164d5d6252 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(16,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(25,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(34,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(39,5): error TS2322: Type '{ [x: number]: number | A; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(39,5): error TS2322: Type '{ [x: number]: A | B | number; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. Index signatures are incompatible. - Type 'number | A' is not assignable to type 'A'. + Type 'A | B | number' is not assignable to type 'A'. Type 'number' is not assignable to type 'A'. @@ -54,9 +54,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo // error var b: { [x: number]: A } = { ~ -!!! error TS2322: Type '{ [x: number]: number | A; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. +!!! error TS2322: Type '{ [x: number]: A | B | number; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'number | A' is not assignable to type 'A'. +!!! error TS2322: Type 'A | B | number' is not assignable to type 'A'. !!! error TS2322: Type 'number' is not assignable to type 'A'. 1.0: new A(), 2.0: new B(), diff --git a/tests/baselines/reference/objectLitStructuralTypeMismatch.errors.txt b/tests/baselines/reference/objectLitStructuralTypeMismatch.errors.txt index 0b218d3227b81..465c4d6d9f634 100644 --- a/tests/baselines/reference/objectLitStructuralTypeMismatch.errors.txt +++ b/tests/baselines/reference/objectLitStructuralTypeMismatch.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/objectLitStructuralTypeMismatch.ts(2,5): error TS2322: Type '{ b: number; }' is not assignable to type '{ a: number; }'. - Property 'a' is missing in type '{ b: number; }'. + Object literal may only specify known properties, and 'b' does not exist in type '{ a: number; }'. ==== tests/cases/compiler/objectLitStructuralTypeMismatch.ts (1 errors) ==== @@ -7,4 +7,4 @@ tests/cases/compiler/objectLitStructuralTypeMismatch.ts(2,5): error TS2322: Type var x: { a: number; } = { b: 5 }; ~ !!! error TS2322: Type '{ b: number; }' is not assignable to type '{ a: number; }'. -!!! error TS2322: Property 'a' is missing in type '{ b: number; }'. \ No newline at end of file +!!! error TS2322: Object literal may only specify known properties, and 'b' does not exist in type '{ a: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralFunctionArgContextualTyping.errors.txt b/tests/baselines/reference/objectLiteralFunctionArgContextualTyping.errors.txt index f031031b0a8e2..149aca43a4200 100644 --- a/tests/baselines/reference/objectLiteralFunctionArgContextualTyping.errors.txt +++ b/tests/baselines/reference/objectLiteralFunctionArgContextualTyping.errors.txt @@ -1,5 +1,7 @@ tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(8,4): error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I'. - Property 'value' is missing in type '{ hello: number; }'. + Object literal may only specify known properties, and 'hello' does not exist in type 'I'. +tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(10,4): error TS2345: Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I'. + Object literal may only specify known properties, and 'what' does not exist in type 'I'. tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(11,4): error TS2345: Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I'. Property 'value' is missing in type '{ toString: (s: string) => string; }'. tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(12,4): error TS2345: Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I'. @@ -7,7 +9,7 @@ tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(12,4): error TS tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(13,36): error TS2339: Property 'uhhh' does not exist on type 'string'. -==== tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts (4 errors) ==== +==== tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts (5 errors) ==== interface I { value: string; toString: (t: string) => string; @@ -18,9 +20,12 @@ tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(13,36): error T f2({ hello: 1 }) // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I'. -!!! error TS2345: Property 'value' is missing in type '{ hello: number; }'. +!!! error TS2345: Object literal may only specify known properties, and 'hello' does not exist in type 'I'. f2({ value: '' }) // missing toString satisfied by Object's member f2({ value: '', what: 1 }) // missing toString satisfied by Object's member + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I'. +!!! error TS2345: Object literal may only specify known properties, and 'what' does not exist in type 'I'. f2({ toString: (s) => s }) // error, missing property value from ArgsString ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I'. diff --git a/tests/baselines/reference/objectLiteralFunctionArgContextualTyping2.errors.txt b/tests/baselines/reference/objectLiteralFunctionArgContextualTyping2.errors.txt index 7cb3304aa2fd8..367a676abc639 100644 --- a/tests/baselines/reference/objectLiteralFunctionArgContextualTyping2.errors.txt +++ b/tests/baselines/reference/objectLiteralFunctionArgContextualTyping2.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(8,4): error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I2'. - Property 'value' is missing in type '{ hello: number; }'. + Object literal may only specify known properties, and 'hello' does not exist in type 'I2'. tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(9,4): error TS2345: Argument of type '{ value: string; }' is not assignable to parameter of type 'I2'. Property 'doStuff' is missing in type '{ value: string; }'. tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(10,4): error TS2345: Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I2'. - Property 'doStuff' is missing in type '{ value: string; what: number; }'. + Object literal may only specify known properties, and 'what' does not exist in type 'I2'. tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(11,4): error TS2345: Argument of type '{ toString: (s: any) => any; }' is not assignable to parameter of type 'I2'. Property 'value' is missing in type '{ toString: (s: any) => any; }'. tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(12,4): error TS2345: Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I2'. @@ -23,7 +23,7 @@ tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(13,4): error T f2({ hello: 1 }) ~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I2'. -!!! error TS2345: Property 'value' is missing in type '{ hello: number; }'. +!!! error TS2345: Object literal may only specify known properties, and 'hello' does not exist in type 'I2'. f2({ value: '' }) ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ value: string; }' is not assignable to parameter of type 'I2'. @@ -31,7 +31,7 @@ tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(13,4): error T f2({ value: '', what: 1 }) ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I2'. -!!! error TS2345: Property 'doStuff' is missing in type '{ value: string; what: number; }'. +!!! error TS2345: Object literal may only specify known properties, and 'what' does not exist in type 'I2'. f2({ toString: (s) => s }) ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ toString: (s: any) => any; }' is not assignable to parameter of type 'I2'. diff --git a/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt b/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt index c35e49f02a31f..edb6d031b1fa3 100644 --- a/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. +tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ [x: string]: B | A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. Index signatures are incompatible. Type 'A' is not assignable to type 'B'. @@ -18,7 +18,7 @@ tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ var o1: { [s: string]: A;[n: number]: B; } = { x: b, 0: a }; // both indexers are A ~~ -!!! error TS2322: Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. +!!! error TS2322: Type '{ [x: string]: B | A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'A' is not assignable to type 'B'. o1 = { x: c, 0: a }; // string indexer is any, number indexer is A \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralIndexers.types b/tests/baselines/reference/objectLiteralIndexers.types index d5add00ebafb6..55cec857c7098 100644 --- a/tests/baselines/reference/objectLiteralIndexers.types +++ b/tests/baselines/reference/objectLiteralIndexers.types @@ -31,7 +31,7 @@ var o1: { [s: string]: A;[n: number]: B; } = { x: a, 0: b }; // string indexer i >A : A >n : number >B : B ->{ x: a, 0: b } : { [x: string]: A; [x: number]: B; 0: B; x: A; } +>{ x: a, 0: b } : { [x: string]: A | B; [x: number]: B; 0: B; x: A; } >x : A >a : A >b : B diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt index f12e29f511720..d00a8ddf074b0 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(4,5): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. - Property 'b' is missing in type '{ name: string; id: number; }'. + Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(5,16): error TS1131: Property or signature expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(5,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'id' must be of type 'number', but here has type 'any'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(5,25): error TS1128: Declaration or statement expected. @@ -18,7 +18,7 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr var person: { b: string; id: number } = { name, id }; // error ~~~~~~ !!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. -!!! error TS2322: Property 'b' is missing in type '{ name: string; id: number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'. var person1: { name, id }; // error: can't use short-hand property assignment in type position ~~~~ !!! error TS1131: Property or signature expected. diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt index 26b0224f2b037..f6f4f625c454c 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(4,5): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. - Property 'b' is missing in type '{ name: string; id: number; }'. + Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,79): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ name: number; id: string; }'. Types of property 'name' are incompatible. Type 'string' is not assignable to type 'number'. @@ -18,7 +18,7 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr var person: { b: string; id: number } = { name, id }; // error ~~~~~~ !!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. -!!! error TS2322: Property 'b' is missing in type '{ name: string; id: number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'. function bar(name: string, id: number): { name: number, id: string } { return { name, id }; } // error ~~~~~~~~~~~~ !!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ name: number; id: string; }'. diff --git a/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt b/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt index b7b9f43773595..47401a7ae8b0c 100644 --- a/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt +++ b/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt @@ -1,7 +1,11 @@ +tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(19,3): error TS2345: Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ n: number; }'. + Object literal may only specify known properties, and 's' does not exist in type '{ n: number; }'. tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(22,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'w' must be of type 'A', but here has type 'C'. +tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(24,3): error TS2345: Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ n: number; }'. + Object literal may only specify known properties, and 's' does not exist in type '{ n: number; }'. -==== tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts (1 errors) ==== +==== tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts (3 errors) ==== interface A { (x: { s: string }): string (x: { n: number }): number @@ -21,10 +25,16 @@ tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(22,5): error TS240 var v: B; v({ s: "", n: 0 }).toLowerCase(); + ~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ n: number; }'. +!!! error TS2345: Object literal may only specify known properties, and 's' does not exist in type '{ n: number; }'. var w: A; var w: C; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'w' must be of type 'A', but here has type 'C'. - w({ s: "", n: 0 }).toLowerCase(); \ No newline at end of file + w({ s: "", n: 0 }).toLowerCase(); + ~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ n: number; }'. +!!! error TS2345: Object literal may only specify known properties, and 's' does not exist in type '{ n: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/parenthesizedContexualTyping1.types b/tests/baselines/reference/parenthesizedContexualTyping1.types index 61ec1a24ec5bb..1423901a28fcb 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping1.types +++ b/tests/baselines/reference/parenthesizedContexualTyping1.types @@ -149,8 +149,8 @@ var i = fun((Math.random() < 0.5 ? x => x : x => undefined), 10); >i : number >fun((Math.random() < 0.5 ? x => x : x => undefined), 10) : number >fun : { (g: (x: T) => T, x: T): T; (g: (x: T) => T, h: (y: T) => T, x: T): T; } ->(Math.random() < 0.5 ? x => x : x => undefined) : (x: number) => any ->Math.random() < 0.5 ? x => x : x => undefined : (x: number) => any +>(Math.random() < 0.5 ? x => x : x => undefined) : ((x: number) => number) | ((x: number) => any) +>Math.random() < 0.5 ? x => x : x => undefined : ((x: number) => number) | ((x: number) => any) >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -169,8 +169,8 @@ var j = fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), 10); >j : number >fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), 10) : number >fun : { (g: (x: T) => T, x: T): T; (g: (x: T) => T, h: (y: T) => T, x: T): T; } ->(Math.random() < 0.5 ? (x => x) : (x => undefined)) : (x: number) => any ->Math.random() < 0.5 ? (x => x) : (x => undefined) : (x: number) => any +>(Math.random() < 0.5 ? (x => x) : (x => undefined)) : ((x: number) => number) | ((x: number) => any) +>Math.random() < 0.5 ? (x => x) : (x => undefined) : ((x: number) => number) | ((x: number) => any) >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -191,8 +191,8 @@ var k = fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), x => x, 10); >k : number >fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), x => x, 10) : number >fun : { (g: (x: T) => T, x: T): T; (g: (x: T) => T, h: (y: T) => T, x: T): T; } ->(Math.random() < 0.5 ? (x => x) : (x => undefined)) : (x: number) => any ->Math.random() < 0.5 ? (x => x) : (x => undefined) : (x: number) => any +>(Math.random() < 0.5 ? (x => x) : (x => undefined)) : ((x: number) => number) | ((x: number) => any) +>Math.random() < 0.5 ? (x => x) : (x => undefined) : ((x: number) => number) | ((x: number) => any) >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -216,9 +216,9 @@ var l = fun(((Math.random() < 0.5 ? ((x => x)) : ((x => undefined)))), ((x => x) >l : number >fun(((Math.random() < 0.5 ? ((x => x)) : ((x => undefined)))), ((x => x)), 10) : number >fun : { (g: (x: T) => T, x: T): T; (g: (x: T) => T, h: (y: T) => T, x: T): T; } ->((Math.random() < 0.5 ? ((x => x)) : ((x => undefined)))) : (x: number) => any ->(Math.random() < 0.5 ? ((x => x)) : ((x => undefined))) : (x: number) => any ->Math.random() < 0.5 ? ((x => x)) : ((x => undefined)) : (x: number) => any +>((Math.random() < 0.5 ? ((x => x)) : ((x => undefined)))) : ((x: number) => number) | ((x: number) => any) +>(Math.random() < 0.5 ? ((x => x)) : ((x => undefined))) : ((x: number) => number) | ((x: number) => any) +>Math.random() < 0.5 ? ((x => x)) : ((x => undefined)) : ((x: number) => number) | ((x: number) => any) >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number diff --git a/tests/baselines/reference/parenthesizedContexualTyping2.types b/tests/baselines/reference/parenthesizedContexualTyping2.types index a055f2f1bbd6f..344933ea1fc8c 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping2.types +++ b/tests/baselines/reference/parenthesizedContexualTyping2.types @@ -186,8 +186,8 @@ var i = fun((Math.random() < 0.5 ? x => { x(undefined); return x; } : x >i : number >fun((Math.random() < 0.5 ? x => { x(undefined); return x; } : x => undefined), 10) : number >fun : { (f: (x: (p: T) => T) => (p: T) => T, x: T): T; (f: (x: (p: T) => T) => (p: T) => T, g: (x: (p: T) => T) => (p: T) => T, x: T): T; } ->(Math.random() < 0.5 ? x => { x(undefined); return x; } : x => undefined) : (x: (p: T) => T) => any ->Math.random() < 0.5 ? x => { x(undefined); return x; } : x => undefined : (x: (p: T) => T) => any +>(Math.random() < 0.5 ? x => { x(undefined); return x; } : x => undefined) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) +>Math.random() < 0.5 ? x => { x(undefined); return x; } : x => undefined : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -209,8 +209,8 @@ var j = fun((Math.random() < 0.5 ? (x => { x(undefined); return x; }) : >j : number >fun((Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)), 10) : number >fun : { (f: (x: (p: T) => T) => (p: T) => T, x: T): T; (f: (x: (p: T) => T) => (p: T) => T, g: (x: (p: T) => T) => (p: T) => T, x: T): T; } ->(Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)) : (x: (p: T) => T) => any ->Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined) : (x: (p: T) => T) => any +>(Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) +>Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -234,8 +234,8 @@ var k = fun((Math.random() < 0.5 ? (x => { x(undefined); return x; }) : >k : number >fun((Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)), x => { x(undefined); return x; }, 10) : number >fun : { (f: (x: (p: T) => T) => (p: T) => T, x: T): T; (f: (x: (p: T) => T) => (p: T) => T, g: (x: (p: T) => T) => (p: T) => T, x: T): T; } ->(Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)) : (x: (p: T) => T) => any ->Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined) : (x: (p: T) => T) => any +>(Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) +>Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -265,9 +265,9 @@ var l = fun(((Math.random() < 0.5 ? ((x => { x(undefined); return x; })) >l : number >fun(((Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined)))),((x => { x(undefined); return x; })), 10) : number >fun : { (f: (x: (p: T) => T) => (p: T) => T, x: T): T; (f: (x: (p: T) => T) => (p: T) => T, g: (x: (p: T) => T) => (p: T) => T, x: T): T; } ->((Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined)))) : (x: (p: T) => T) => any ->(Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined))) : (x: (p: T) => T) => any ->Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined)) : (x: (p: T) => T) => any +>((Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined)))) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) +>(Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined))) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) +>Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined)) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt index e3dfd6133c933..e6cba35be257e 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt @@ -22,9 +22,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(71,5): error TS2411: Property 'foo' of type '() => string' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(73,5): error TS2411: Property '"4.0"' of type 'number' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(74,5): error TS2411: Property 'f' of type 'MyString' is not assignable to string index type 'string'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: string]: string | number | MyString | (() => void); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: string]: string | number | (() => void) | MyString | (() => string); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. Index signatures are incompatible. - Type 'string | number | MyString | (() => void)' is not assignable to type 'string'. + Type 'string | number | (() => void) | MyString | (() => string)' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -160,9 +160,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon // error var b: { [x: string]: string; } = { ~ -!!! error TS2322: Type '{ [x: string]: string | number | MyString | (() => void); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. +!!! error TS2322: Type '{ [x: string]: string | number | (() => void) | MyString | (() => string); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'string | number | MyString | (() => void)' is not assignable to type 'string'. +!!! error TS2322: Type 'string | number | (() => void) | MyString | (() => string)' is not assignable to type 'string'. !!! error TS2322: Type 'number' is not assignable to type 'string'. a: '', b: 1, diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt index faef790545368..13d5adcf1f5ed 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt @@ -4,10 +4,11 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(24,5): error TS2411: Property 'd' of type 'string' is not assignable to string index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(31,5): error TS2411: Property 'c' of type 'number' is not assignable to string index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(32,5): error TS2411: Property 'd' of type 'string' is not assignable to string index type 'A'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(36,5): error TS2322: Type '{ [x: string]: typeof A; a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(36,5): error TS2322: Type '{ [x: string]: typeof A | typeof B; a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. Index signatures are incompatible. - Type 'typeof A' is not assignable to type 'A'. - Property 'foo' is missing in type 'typeof A'. + Type 'typeof A | typeof B' is not assignable to type 'A'. + Type 'typeof A' is not assignable to type 'A'. + Property 'foo' is missing in type 'typeof A'. ==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts (7 errors) ==== @@ -60,10 +61,11 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon // error var b: { [x: string]: A } = { ~ -!!! error TS2322: Type '{ [x: string]: typeof A; a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. +!!! error TS2322: Type '{ [x: string]: typeof A | typeof B; a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'typeof A' is not assignable to type 'A'. -!!! error TS2322: Property 'foo' is missing in type 'typeof A'. +!!! error TS2322: Type 'typeof A | typeof B' is not assignable to type 'A'. +!!! error TS2322: Type 'typeof A' is not assignable to type 'A'. +!!! error TS2322: Property 'foo' is missing in type 'typeof A'. a: A, b: B } \ No newline at end of file diff --git a/tests/baselines/reference/subtypesOfUnion.errors.txt b/tests/baselines/reference/subtypesOfUnion.errors.txt index fade5377814f4..7c2e88ec8fd14 100644 --- a/tests/baselines/reference/subtypesOfUnion.errors.txt +++ b/tests/baselines/reference/subtypesOfUnion.errors.txt @@ -12,21 +12,21 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(28,5): error TS2411: Property 'foo16' of type 'T' is not assignable to string index type 'string | number'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(29,5): error TS2411: Property 'foo17' of type 'Object' is not assignable to string index type 'string | number'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(30,5): error TS2411: Property 'foo18' of type '{}' is not assignable to string index type 'string | number'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(35,5): error TS2411: Property 'foo2' of type 'string' is not assignable to string index type 'number | E'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(37,5): error TS2411: Property 'foo4' of type 'boolean' is not assignable to string index type 'number | E'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(39,5): error TS2411: Property 'foo6' of type 'Date' is not assignable to string index type 'number | E'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(40,5): error TS2411: Property 'foo7' of type 'RegExp' is not assignable to string index type 'number | E'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(41,5): error TS2411: Property 'foo8' of type '{ bar: number; }' is not assignable to string index type 'number | E'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(42,5): error TS2411: Property 'foo9' of type 'I8' is not assignable to string index type 'number | E'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(43,5): error TS2411: Property 'foo10' of type 'A' is not assignable to string index type 'number | E'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(44,5): error TS2411: Property 'foo11' of type 'A2' is not assignable to string index type 'number | E'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(45,5): error TS2411: Property 'foo12' of type '(x: any) => number' is not assignable to string index type 'number | E'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(46,5): error TS2411: Property 'foo13' of type '(x: T) => T' is not assignable to string index type 'number | E'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(47,5): error TS2411: Property 'foo14' of type 'typeof f' is not assignable to string index type 'number | E'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(48,5): error TS2411: Property 'foo15' of type 'typeof c' is not assignable to string index type 'number | E'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(49,5): error TS2411: Property 'foo16' of type 'T' is not assignable to string index type 'number | E'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(50,5): error TS2411: Property 'foo17' of type 'Object' is not assignable to string index type 'number | E'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(51,5): error TS2411: Property 'foo18' of type '{}' is not assignable to string index type 'number | E'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(35,5): error TS2411: Property 'foo2' of type 'string' is not assignable to string index type 'E | number'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(37,5): error TS2411: Property 'foo4' of type 'boolean' is not assignable to string index type 'E | number'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(39,5): error TS2411: Property 'foo6' of type 'Date' is not assignable to string index type 'E | number'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(40,5): error TS2411: Property 'foo7' of type 'RegExp' is not assignable to string index type 'E | number'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(41,5): error TS2411: Property 'foo8' of type '{ bar: number; }' is not assignable to string index type 'E | number'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(42,5): error TS2411: Property 'foo9' of type 'I8' is not assignable to string index type 'E | number'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(43,5): error TS2411: Property 'foo10' of type 'A' is not assignable to string index type 'E | number'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(44,5): error TS2411: Property 'foo11' of type 'A2' is not assignable to string index type 'E | number'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(45,5): error TS2411: Property 'foo12' of type '(x: any) => number' is not assignable to string index type 'E | number'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(46,5): error TS2411: Property 'foo13' of type '(x: T) => T' is not assignable to string index type 'E | number'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(47,5): error TS2411: Property 'foo14' of type 'typeof f' is not assignable to string index type 'E | number'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(48,5): error TS2411: Property 'foo15' of type 'typeof c' is not assignable to string index type 'E | number'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(49,5): error TS2411: Property 'foo16' of type 'T' is not assignable to string index type 'E | number'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(50,5): error TS2411: Property 'foo17' of type 'Object' is not assignable to string index type 'E | number'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(51,5): error TS2411: Property 'foo18' of type '{}' is not assignable to string index type 'E | number'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts (29 errors) ==== @@ -94,49 +94,49 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf foo: any; // ok foo2: string; // error ~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo2' of type 'string' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo2' of type 'string' is not assignable to string index type 'E | number'. foo3: number; // ok foo4: boolean; // error ~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo4' of type 'boolean' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo4' of type 'boolean' is not assignable to string index type 'E | number'. foo5: E; // ok foo6: Date; // error ~~~~~~~~~~~ -!!! error TS2411: Property 'foo6' of type 'Date' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo6' of type 'Date' is not assignable to string index type 'E | number'. foo7: RegExp; // error ~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo7' of type 'RegExp' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo7' of type 'RegExp' is not assignable to string index type 'E | number'. foo8: { bar: number }; // error ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo8' of type '{ bar: number; }' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo8' of type '{ bar: number; }' is not assignable to string index type 'E | number'. foo9: I8; // error ~~~~~~~~~ -!!! error TS2411: Property 'foo9' of type 'I8' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo9' of type 'I8' is not assignable to string index type 'E | number'. foo10: A; // error ~~~~~~~~~ -!!! error TS2411: Property 'foo10' of type 'A' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo10' of type 'A' is not assignable to string index type 'E | number'. foo11: A2; // error ~~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo11' of type 'A2' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo11' of type 'A2' is not assignable to string index type 'E | number'. foo12: (x) => number; //error ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo12' of type '(x: any) => number' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo12' of type '(x: any) => number' is not assignable to string index type 'E | number'. foo13: (x: T) => T; // error ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo13' of type '(x: T) => T' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo13' of type '(x: T) => T' is not assignable to string index type 'E | number'. foo14: typeof f; // error ~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo14' of type 'typeof f' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo14' of type 'typeof f' is not assignable to string index type 'E | number'. foo15: typeof c; // error ~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo15' of type 'typeof c' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo15' of type 'typeof c' is not assignable to string index type 'E | number'. foo16: T; // error ~~~~~~~~~ -!!! error TS2411: Property 'foo16' of type 'T' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo16' of type 'T' is not assignable to string index type 'E | number'. foo17: Object; // error ~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo17' of type 'Object' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo17' of type 'Object' is not assignable to string index type 'E | number'. foo18: {}; // error ~~~~~~~~~~ -!!! error TS2411: Property 'foo18' of type '{}' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo18' of type '{}' is not assignable to string index type 'E | number'. } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithCallSignatures2.types b/tests/baselines/reference/subtypingWithCallSignatures2.types index 8a56e05a9c212..e43382766acae 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures2.types +++ b/tests/baselines/reference/subtypingWithCallSignatures2.types @@ -331,14 +331,14 @@ var r1 = foo1(r1arg1); // any, return types are not subtype of first overload >r1arg1 : (x: T) => T[] var r1a = [r1arg2, r1arg1]; // generic signature, subtype in both directions ->r1a : ((x: T) => T[])[] ->[r1arg2, r1arg1] : ((x: T) => T[])[] +>r1a : (((x: number) => number[]) | ((x: T) => T[]))[] +>[r1arg2, r1arg1] : (((x: number) => number[]) | ((x: T) => T[]))[] >r1arg2 : (x: number) => number[] >r1arg1 : (x: T) => T[] var r1b = [r1arg1, r1arg2]; // generic signature, subtype in both directions ->r1b : ((x: T) => T[])[] ->[r1arg1, r1arg2] : ((x: T) => T[])[] +>r1b : (((x: T) => T[]) | ((x: number) => number[]))[] +>[r1arg1, r1arg2] : (((x: T) => T[]) | ((x: number) => number[]))[] >r1arg1 : (x: T) => T[] >r1arg2 : (x: number) => number[] @@ -365,14 +365,14 @@ var r2 = foo2(r2arg1); >r2arg1 : (x: T) => string[] var r2a = [r2arg1, r2arg2]; ->r2a : ((x: T) => string[])[] ->[r2arg1, r2arg2] : ((x: T) => string[])[] +>r2a : (((x: T) => string[]) | ((x: number) => string[]))[] +>[r2arg1, r2arg2] : (((x: T) => string[]) | ((x: number) => string[]))[] >r2arg1 : (x: T) => string[] >r2arg2 : (x: number) => string[] var r2b = [r2arg2, r2arg1]; ->r2b : ((x: T) => string[])[] ->[r2arg2, r2arg1] : ((x: T) => string[])[] +>r2b : (((x: number) => string[]) | ((x: T) => string[]))[] +>[r2arg2, r2arg1] : (((x: number) => string[]) | ((x: T) => string[]))[] >r2arg2 : (x: number) => string[] >r2arg1 : (x: T) => string[] @@ -396,14 +396,14 @@ var r3 = foo3(r3arg1); >r3arg1 : (x: T) => T var r3a = [r3arg1, r3arg2]; ->r3a : ((x: T) => T)[] ->[r3arg1, r3arg2] : ((x: T) => T)[] +>r3a : (((x: T) => T) | ((x: number) => void))[] +>[r3arg1, r3arg2] : (((x: T) => T) | ((x: number) => void))[] >r3arg1 : (x: T) => T >r3arg2 : (x: number) => void var r3b = [r3arg2, r3arg1]; ->r3b : ((x: T) => T)[] ->[r3arg2, r3arg1] : ((x: T) => T)[] +>r3b : (((x: number) => void) | ((x: T) => T))[] +>[r3arg2, r3arg1] : (((x: number) => void) | ((x: T) => T))[] >r3arg2 : (x: number) => void >r3arg1 : (x: T) => T @@ -432,14 +432,14 @@ var r4 = foo4(r4arg1); // any >r4arg1 : (x: T, y: U) => T var r4a = [r4arg1, r4arg2]; ->r4a : ((x: T, y: U) => T)[] ->[r4arg1, r4arg2] : ((x: T, y: U) => T)[] +>r4a : (((x: T, y: U) => T) | ((x: string, y: number) => string))[] +>[r4arg1, r4arg2] : (((x: T, y: U) => T) | ((x: string, y: number) => string))[] >r4arg1 : (x: T, y: U) => T >r4arg2 : (x: string, y: number) => string var r4b = [r4arg2, r4arg1]; ->r4b : ((x: T, y: U) => T)[] ->[r4arg2, r4arg1] : ((x: T, y: U) => T)[] +>r4b : (((x: string, y: number) => string) | ((x: T, y: U) => T))[] +>[r4arg2, r4arg1] : (((x: string, y: number) => string) | ((x: T, y: U) => T))[] >r4arg2 : (x: string, y: number) => string >r4arg1 : (x: T, y: U) => T @@ -470,14 +470,14 @@ var r5 = foo5(r5arg1); // any >r5arg1 : (x: (arg: T) => U) => T var r5a = [r5arg1, r5arg2]; ->r5a : ((x: (arg: T) => U) => T)[] ->[r5arg1, r5arg2] : ((x: (arg: T) => U) => T)[] +>r5a : (((x: (arg: T) => U) => T) | ((x: (arg: string) => number) => string))[] +>[r5arg1, r5arg2] : (((x: (arg: T) => U) => T) | ((x: (arg: string) => number) => string))[] >r5arg1 : (x: (arg: T) => U) => T >r5arg2 : (x: (arg: string) => number) => string var r5b = [r5arg2, r5arg1]; ->r5b : ((x: (arg: T) => U) => T)[] ->[r5arg2, r5arg1] : ((x: (arg: T) => U) => T)[] +>r5b : (((x: (arg: string) => number) => string) | ((x: (arg: T) => U) => T))[] +>[r5arg2, r5arg1] : (((x: (arg: string) => number) => string) | ((x: (arg: T) => U) => T))[] >r5arg2 : (x: (arg: string) => number) => string >r5arg1 : (x: (arg: T) => U) => T @@ -514,14 +514,14 @@ var r6 = foo6(r6arg1); // any >r6arg1 : (x: (arg: T) => U) => T var r6a = [r6arg1, r6arg2]; ->r6a : ((x: (arg: T) => U) => T)[] ->[r6arg1, r6arg2] : ((x: (arg: T) => U) => T)[] +>r6a : (((x: (arg: T) => U) => T) | ((x: (arg: Base) => Derived) => Base))[] +>[r6arg1, r6arg2] : (((x: (arg: T) => U) => T) | ((x: (arg: Base) => Derived) => Base))[] >r6arg1 : (x: (arg: T) => U) => T >r6arg2 : (x: (arg: Base) => Derived) => Base var r6b = [r6arg2, r6arg1]; ->r6b : ((x: (arg: T) => U) => T)[] ->[r6arg2, r6arg1] : ((x: (arg: T) => U) => T)[] +>r6b : (((x: (arg: Base) => Derived) => Base) | ((x: (arg: T) => U) => T))[] +>[r6arg2, r6arg1] : (((x: (arg: Base) => Derived) => Base) | ((x: (arg: T) => U) => T))[] >r6arg2 : (x: (arg: Base) => Derived) => Base >r6arg1 : (x: (arg: T) => U) => T @@ -564,14 +564,14 @@ var r7 = foo7(r7arg1); // any >r7arg1 : (x: (arg: T) => U) => (r: T) => U var r7a = [r7arg1, r7arg2]; ->r7a : ((x: (arg: T) => U) => (r: T) => U)[] ->[r7arg1, r7arg2] : ((x: (arg: T) => U) => (r: T) => U)[] +>r7a : (((x: (arg: T) => U) => (r: T) => U) | ((x: (arg: Base) => Derived) => (r: Base) => Derived))[] +>[r7arg1, r7arg2] : (((x: (arg: T) => U) => (r: T) => U) | ((x: (arg: Base) => Derived) => (r: Base) => Derived))[] >r7arg1 : (x: (arg: T) => U) => (r: T) => U >r7arg2 : (x: (arg: Base) => Derived) => (r: Base) => Derived var r7b = [r7arg2, r7arg1]; ->r7b : ((x: (arg: T) => U) => (r: T) => U)[] ->[r7arg2, r7arg1] : ((x: (arg: T) => U) => (r: T) => U)[] +>r7b : (((x: (arg: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U) => (r: T) => U))[] +>[r7arg2, r7arg1] : (((x: (arg: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U) => (r: T) => U))[] >r7arg2 : (x: (arg: Base) => Derived) => (r: Base) => Derived >r7arg1 : (x: (arg: T) => U) => (r: T) => U @@ -622,14 +622,14 @@ var r8 = foo8(r8arg1); // any >r8arg1 : (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U var r8a = [r8arg1, r8arg2]; ->r8a : ((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U)[] ->[r8arg1, r8arg2] : ((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U)[] +>r8a : (((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] +>[r8arg1, r8arg2] : (((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] >r8arg1 : (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U >r8arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived var r8b = [r8arg2, r8arg1]; ->r8b : ((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U)[] ->[r8arg2, r8arg1] : ((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U)[] +>r8b : (((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U))[] +>[r8arg2, r8arg1] : (((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U))[] >r8arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived >r8arg1 : (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U @@ -681,14 +681,14 @@ var r9 = foo9(r9arg1); // any >r9arg1 : (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U var r9a = [r9arg1, r9arg2]; ->r9a : ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U)[] ->[r9arg1, r9arg2] : ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U)[] +>r9a : (((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] +>[r9arg1, r9arg2] : (((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] >r9arg1 : (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U >r9arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived var r9b = [r9arg2, r9arg1]; ->r9b : ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U)[] ->[r9arg2, r9arg1] : ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U)[] +>r9b : (((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U))[] +>[r9arg2, r9arg1] : (((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U))[] >r9arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived >r9arg1 : (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U @@ -719,14 +719,14 @@ var r10 = foo10(r10arg1); // any >r10arg1 : (...x: T[]) => T var r10a = [r10arg1, r10arg2]; ->r10a : ((...x: T[]) => T)[] ->[r10arg1, r10arg2] : ((...x: T[]) => T)[] +>r10a : (((...x: T[]) => T) | ((...x: Derived[]) => Derived))[] +>[r10arg1, r10arg2] : (((...x: T[]) => T) | ((...x: Derived[]) => Derived))[] >r10arg1 : (...x: T[]) => T >r10arg2 : (...x: Derived[]) => Derived var r10b = [r10arg2, r10arg1]; ->r10b : ((...x: T[]) => T)[] ->[r10arg2, r10arg1] : ((...x: T[]) => T)[] +>r10b : (((...x: Derived[]) => Derived) | ((...x: T[]) => T))[] +>[r10arg2, r10arg1] : (((...x: Derived[]) => Derived) | ((...x: T[]) => T))[] >r10arg2 : (...x: Derived[]) => Derived >r10arg1 : (...x: T[]) => T @@ -760,14 +760,14 @@ var r11 = foo11(r11arg1); // any >r11arg1 : (x: T, y: T) => T var r11a = [r11arg1, r11arg2]; ->r11a : ((x: T, y: T) => T)[] ->[r11arg1, r11arg2] : ((x: T, y: T) => T)[] +>r11a : (((x: T, y: T) => T) | ((x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] +>[r11arg1, r11arg2] : (((x: T, y: T) => T) | ((x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] >r11arg1 : (x: T, y: T) => T >r11arg2 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base var r11b = [r11arg2, r11arg1]; ->r11b : ((x: T, y: T) => T)[] ->[r11arg2, r11arg1] : ((x: T, y: T) => T)[] +>r11b : (((x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | ((x: T, y: T) => T))[] +>[r11arg2, r11arg1] : (((x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | ((x: T, y: T) => T))[] >r11arg2 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base >r11arg1 : (x: T, y: T) => T @@ -808,14 +808,14 @@ var r12 = foo12(r12arg1); // any >r12arg1 : (x: Base[], y: T) => Derived[] var r12a = [r12arg1, r12arg2]; ->r12a : ((x: Base[], y: T) => Derived[])[] ->[r12arg1, r12arg2] : ((x: Base[], y: T) => Derived[])[] +>r12a : (((x: Base[], y: T) => Derived[]) | ((x: Base[], y: Derived2[]) => Derived[]))[] +>[r12arg1, r12arg2] : (((x: Base[], y: T) => Derived[]) | ((x: Base[], y: Derived2[]) => Derived[]))[] >r12arg1 : (x: Base[], y: T) => Derived[] >r12arg2 : (x: Base[], y: Derived2[]) => Derived[] var r12b = [r12arg2, r12arg1]; ->r12b : ((x: Base[], y: T) => Derived[])[] ->[r12arg2, r12arg1] : ((x: Base[], y: T) => Derived[])[] +>r12b : (((x: Base[], y: Derived2[]) => Derived[]) | ((x: Base[], y: T) => Derived[]))[] +>[r12arg2, r12arg1] : (((x: Base[], y: Derived2[]) => Derived[]) | ((x: Base[], y: T) => Derived[]))[] >r12arg2 : (x: Base[], y: Derived2[]) => Derived[] >r12arg1 : (x: Base[], y: T) => Derived[] @@ -853,14 +853,14 @@ var r13 = foo13(r13arg1); // any >r13arg1 : (x: Base[], y: T) => T var r13a = [r13arg1, r13arg2]; ->r13a : ((x: Base[], y: T) => T)[] ->[r13arg1, r13arg2] : ((x: Base[], y: T) => T)[] +>r13a : (((x: Base[], y: T) => T) | ((x: Base[], y: Derived[]) => Derived[]))[] +>[r13arg1, r13arg2] : (((x: Base[], y: T) => T) | ((x: Base[], y: Derived[]) => Derived[]))[] >r13arg1 : (x: Base[], y: T) => T >r13arg2 : (x: Base[], y: Derived[]) => Derived[] var r13b = [r13arg2, r13arg1]; ->r13b : ((x: Base[], y: T) => T)[] ->[r13arg2, r13arg1] : ((x: Base[], y: T) => T)[] +>r13b : (((x: Base[], y: Derived[]) => Derived[]) | ((x: Base[], y: T) => T))[] +>[r13arg2, r13arg1] : (((x: Base[], y: Derived[]) => Derived[]) | ((x: Base[], y: T) => T))[] >r13arg2 : (x: Base[], y: Derived[]) => Derived[] >r13arg1 : (x: Base[], y: T) => T @@ -894,14 +894,14 @@ var r14 = foo14(r14arg1); // any >r14arg1 : (x: { a: T; b: T; }) => T var r14a = [r14arg1, r14arg2]; ->r14a : ((x: { a: T; b: T; }) => T)[] ->[r14arg1, r14arg2] : ((x: { a: T; b: T; }) => T)[] +>r14a : (((x: { a: T; b: T; }) => T) | ((x: { a: string; b: number; }) => Object))[] +>[r14arg1, r14arg2] : (((x: { a: T; b: T; }) => T) | ((x: { a: string; b: number; }) => Object))[] >r14arg1 : (x: { a: T; b: T; }) => T >r14arg2 : (x: { a: string; b: number; }) => Object var r14b = [r14arg2, r14arg1]; ->r14b : ((x: { a: T; b: T; }) => T)[] ->[r14arg2, r14arg1] : ((x: { a: T; b: T; }) => T)[] +>r14b : (((x: { a: string; b: number; }) => Object) | ((x: { a: T; b: T; }) => T))[] +>[r14arg2, r14arg1] : (((x: { a: string; b: number; }) => Object) | ((x: { a: T; b: T; }) => T))[] >r14arg2 : (x: { a: string; b: number; }) => Object >r14arg1 : (x: { a: T; b: T; }) => T diff --git a/tests/baselines/reference/subtypingWithCallSignatures3.types b/tests/baselines/reference/subtypingWithCallSignatures3.types index 379810b2541f0..0d3a84ac99c2e 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures3.types +++ b/tests/baselines/reference/subtypingWithCallSignatures3.types @@ -219,8 +219,8 @@ module Errors { >null : null var r1a = [(x: number) => [''], (x: T) => null]; ->r1a : ((x: T) => U[])[] ->[(x: number) => [''], (x: T) => null] : ((x: T) => U[])[] +>r1a : (((x: number) => string[]) | ((x: T) => U[]))[] +>[(x: number) => [''], (x: T) => null] : (((x: number) => string[]) | ((x: T) => U[]))[] >(x: number) => [''] : (x: number) => string[] >x : number >[''] : string[] @@ -235,8 +235,8 @@ module Errors { >null : null var r1b = [(x: T) => null, (x: number) => ['']]; ->r1b : ((x: T) => U[])[] ->[(x: T) => null, (x: number) => ['']] : ((x: T) => U[])[] +>r1b : (((x: T) => U[]) | ((x: number) => string[]))[] +>[(x: T) => null, (x: number) => ['']] : (((x: T) => U[]) | ((x: number) => string[]))[] >(x: T) => null : (x: T) => U[] >T : T >U : U @@ -291,14 +291,14 @@ module Errors { >r2arg : (x: (arg: T) => U) => (r: T) => V var r2a = [r2arg2, r2arg]; ->r2a : ((x: (arg: T) => U) => (r: T) => V)[] ->[r2arg2, r2arg] : ((x: (arg: T) => U) => (r: T) => V)[] +>r2a : (((x: (arg: Base) => Derived) => (r: Base) => Derived2) | ((x: (arg: T) => U) => (r: T) => V))[] +>[r2arg2, r2arg] : (((x: (arg: Base) => Derived) => (r: Base) => Derived2) | ((x: (arg: T) => U) => (r: T) => V))[] >r2arg2 : (x: (arg: Base) => Derived) => (r: Base) => Derived2 >r2arg : (x: (arg: T) => U) => (r: T) => V var r2b = [r2arg, r2arg2]; ->r2b : ((x: (arg: T) => U) => (r: T) => V)[] ->[r2arg, r2arg2] : ((x: (arg: T) => U) => (r: T) => V)[] +>r2b : (((x: (arg: T) => U) => (r: T) => V) | ((x: (arg: Base) => Derived) => (r: Base) => Derived2))[] +>[r2arg, r2arg2] : (((x: (arg: T) => U) => (r: T) => V) | ((x: (arg: Base) => Derived) => (r: Base) => Derived2))[] >r2arg : (x: (arg: T) => U) => (r: T) => V >r2arg2 : (x: (arg: Base) => Derived) => (r: Base) => Derived2 @@ -349,8 +349,8 @@ module Errors { >r3arg : (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U var r3a = [r3arg2, r3arg]; ->r3a : (((x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] ->[r3arg2, r3arg] : (((x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] +>r3a : (((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U))[] +>[r3arg2, r3arg] : (((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U))[] >r3arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived >r3arg : (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U @@ -387,14 +387,14 @@ module Errors { >r4arg : (...x: T[]) => T var r4a = [r4arg2, r4arg]; ->r4a : ((...x: T[]) => T)[] ->[r4arg2, r4arg] : ((...x: T[]) => T)[] +>r4a : (((...x: Base[]) => Base) | ((...x: T[]) => T))[] +>[r4arg2, r4arg] : (((...x: Base[]) => Base) | ((...x: T[]) => T))[] >r4arg2 : (...x: Base[]) => Base >r4arg : (...x: T[]) => T var r4b = [r4arg, r4arg2]; ->r4b : ((...x: T[]) => T)[] ->[r4arg, r4arg2] : ((...x: T[]) => T)[] +>r4b : (((...x: T[]) => T) | ((...x: Base[]) => Base))[] +>[r4arg, r4arg2] : (((...x: T[]) => T) | ((...x: Base[]) => Base))[] >r4arg : (...x: T[]) => T >r4arg2 : (...x: Base[]) => Base @@ -430,14 +430,14 @@ module Errors { >r5arg : (x: T, y: T) => T var r5a = [r5arg2, r5arg]; ->r5a : ((x: T, y: T) => T)[] ->[r5arg2, r5arg] : ((x: T, y: T) => T)[] +>r5a : (((x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | ((x: T, y: T) => T))[] +>[r5arg2, r5arg] : (((x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | ((x: T, y: T) => T))[] >r5arg2 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base >r5arg : (x: T, y: T) => T var r5b = [r5arg, r5arg2]; ->r5b : ((x: T, y: T) => T)[] ->[r5arg, r5arg2] : ((x: T, y: T) => T)[] +>r5b : (((x: T, y: T) => T) | ((x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] +>[r5arg, r5arg2] : (((x: T, y: T) => T) | ((x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] >r5arg : (x: T, y: T) => T >r5arg2 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base @@ -478,14 +478,14 @@ module Errors { >r6arg : (x: Base[], y: Derived2[]) => Derived[] var r6a = [r6arg2, r6arg]; ->r6a : ((x: Base[], y: Base[]) => T)[] ->[r6arg2, r6arg] : ((x: Base[], y: Base[]) => T)[] +>r6a : (((x: Base[], y: Base[]) => T) | ((x: Base[], y: Derived2[]) => Derived[]))[] +>[r6arg2, r6arg] : (((x: Base[], y: Base[]) => T) | ((x: Base[], y: Derived2[]) => Derived[]))[] >r6arg2 : (x: Base[], y: Base[]) => T >r6arg : (x: Base[], y: Derived2[]) => Derived[] var r6b = [r6arg, r6arg2]; ->r6b : ((x: Base[], y: Base[]) => T)[] ->[r6arg, r6arg2] : ((x: Base[], y: Base[]) => T)[] +>r6b : (((x: Base[], y: Derived2[]) => Derived[]) | ((x: Base[], y: Base[]) => T))[] +>[r6arg, r6arg2] : (((x: Base[], y: Derived2[]) => Derived[]) | ((x: Base[], y: Base[]) => T))[] >r6arg : (x: Base[], y: Derived2[]) => Derived[] >r6arg2 : (x: Base[], y: Base[]) => T @@ -517,14 +517,14 @@ module Errors { >r7arg : (x: { a: T; b: T; }) => T var r7a = [r7arg2, r7arg]; ->r7a : ((x: { a: T; b: T; }) => T)[] ->[r7arg2, r7arg] : ((x: { a: T; b: T; }) => T)[] +>r7a : (((x: { a: string; b: number; }) => number) | ((x: { a: T; b: T; }) => T))[] +>[r7arg2, r7arg] : (((x: { a: string; b: number; }) => number) | ((x: { a: T; b: T; }) => T))[] >r7arg2 : (x: { a: string; b: number; }) => number >r7arg : (x: { a: T; b: T; }) => T var r7b = [r7arg, r7arg2]; ->r7b : ((x: { a: T; b: T; }) => T)[] ->[r7arg, r7arg2] : ((x: { a: T; b: T; }) => T)[] +>r7b : (((x: { a: T; b: T; }) => T) | ((x: { a: string; b: number; }) => number))[] +>[r7arg, r7arg2] : (((x: { a: T; b: T; }) => T) | ((x: { a: string; b: number; }) => number))[] >r7arg : (x: { a: T; b: T; }) => T >r7arg2 : (x: { a: string; b: number; }) => number @@ -547,14 +547,14 @@ module Errors { >r7arg3 : (x: { a: T; b: T; }) => number var r7d = [r7arg2, r7arg3]; ->r7d : ((x: { a: string; b: number; }) => number)[] ->[r7arg2, r7arg3] : ((x: { a: string; b: number; }) => number)[] +>r7d : (((x: { a: string; b: number; }) => number) | ((x: { a: T; b: T; }) => number))[] +>[r7arg2, r7arg3] : (((x: { a: string; b: number; }) => number) | ((x: { a: T; b: T; }) => number))[] >r7arg2 : (x: { a: string; b: number; }) => number >r7arg3 : (x: { a: T; b: T; }) => number var r7e = [r7arg3, r7arg2]; ->r7e : ((x: { a: string; b: number; }) => number)[] ->[r7arg3, r7arg2] : ((x: { a: string; b: number; }) => number)[] +>r7e : (((x: { a: T; b: T; }) => number) | ((x: { a: string; b: number; }) => number))[] +>[r7arg3, r7arg2] : (((x: { a: T; b: T; }) => number) | ((x: { a: string; b: number; }) => number))[] >r7arg3 : (x: { a: T; b: T; }) => number >r7arg2 : (x: { a: string; b: number; }) => number diff --git a/tests/baselines/reference/subtypingWithCallSignatures4.types b/tests/baselines/reference/subtypingWithCallSignatures4.types index e76d36114e961..830f065f556b0 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures4.types +++ b/tests/baselines/reference/subtypingWithCallSignatures4.types @@ -317,14 +317,14 @@ var r3 = foo3(r3arg); >r3arg : (x: T) => T var r3a = [r3arg, r3arg2]; ->r3a : ((x: T) => T)[] ->[r3arg, r3arg2] : ((x: T) => T)[] +>r3a : (((x: T) => T) | ((x: T) => void))[] +>[r3arg, r3arg2] : (((x: T) => T) | ((x: T) => void))[] >r3arg : (x: T) => T >r3arg2 : (x: T) => void var r3b = [r3arg2, r3arg]; ->r3b : ((x: T) => T)[] ->[r3arg2, r3arg] : ((x: T) => T)[] +>r3b : (((x: T) => void) | ((x: T) => T))[] +>[r3arg2, r3arg] : (((x: T) => void) | ((x: T) => T))[] >r3arg2 : (x: T) => void >r3arg : (x: T) => T @@ -447,14 +447,14 @@ var r6 = foo6(r6arg); >r6arg : (x: (arg: T) => U) => T var r6a = [r6arg, r6arg2]; ->r6a : ((x: (arg: T) => U) => T)[] ->[r6arg, r6arg2] : ((x: (arg: T) => U) => T)[] +>r6a : (((x: (arg: T) => U) => T) | ((x: (arg: T) => Derived) => T))[] +>[r6arg, r6arg2] : (((x: (arg: T) => U) => T) | ((x: (arg: T) => Derived) => T))[] >r6arg : (x: (arg: T) => U) => T >r6arg2 : (x: (arg: T) => Derived) => T var r6b = [r6arg2, r6arg]; ->r6b : ((x: (arg: T) => U) => T)[] ->[r6arg2, r6arg] : ((x: (arg: T) => U) => T)[] +>r6b : (((x: (arg: T) => Derived) => T) | ((x: (arg: T) => U) => T))[] +>[r6arg2, r6arg] : (((x: (arg: T) => Derived) => T) | ((x: (arg: T) => U) => T))[] >r6arg2 : (x: (arg: T) => Derived) => T >r6arg : (x: (arg: T) => U) => T @@ -498,14 +498,14 @@ var r11 = foo11(r11arg); >r11arg : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base var r11a = [r11arg, r11arg2]; ->r11a : ((x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] ->[r11arg, r11arg2] : ((x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] +>r11a : (((x: { foo: T; }, y: { foo: U; bar: U; }) => Base) | ((x: { foo: T; }, y: { foo: T; bar: T; }) => Base))[] +>[r11arg, r11arg2] : (((x: { foo: T; }, y: { foo: U; bar: U; }) => Base) | ((x: { foo: T; }, y: { foo: T; bar: T; }) => Base))[] >r11arg : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base >r11arg2 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base var r11b = [r11arg2, r11arg]; ->r11b : ((x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] ->[r11arg2, r11arg] : ((x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] +>r11b : (((x: { foo: T; }, y: { foo: T; bar: T; }) => Base) | ((x: { foo: T; }, y: { foo: U; bar: U; }) => Base))[] +>[r11arg2, r11arg] : (((x: { foo: T; }, y: { foo: T; bar: T; }) => Base) | ((x: { foo: T; }, y: { foo: U; bar: U; }) => Base))[] >r11arg2 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base >r11arg : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base @@ -543,14 +543,14 @@ var r15 = foo15(r15arg); >r15arg : (x: { a: U; b: V; }) => U[] var r15a = [r15arg, r15arg2]; ->r15a : ((x: { a: U; b: V; }) => U[])[] ->[r15arg, r15arg2] : ((x: { a: U; b: V; }) => U[])[] +>r15a : (((x: { a: U; b: V; }) => U[]) | ((x: { a: T; b: T; }) => T[]))[] +>[r15arg, r15arg2] : (((x: { a: U; b: V; }) => U[]) | ((x: { a: T; b: T; }) => T[]))[] >r15arg : (x: { a: U; b: V; }) => U[] >r15arg2 : (x: { a: T; b: T; }) => T[] var r15b = [r15arg2, r15arg]; ->r15b : ((x: { a: U; b: V; }) => U[])[] ->[r15arg2, r15arg] : ((x: { a: U; b: V; }) => U[])[] +>r15b : (((x: { a: T; b: T; }) => T[]) | ((x: { a: U; b: V; }) => U[]))[] +>[r15arg2, r15arg] : (((x: { a: T; b: T; }) => T[]) | ((x: { a: U; b: V; }) => U[]))[] >r15arg2 : (x: { a: T; b: T; }) => T[] >r15arg : (x: { a: U; b: V; }) => U[] diff --git a/tests/baselines/reference/subtypingWithConstructSignatures2.types b/tests/baselines/reference/subtypingWithConstructSignatures2.types index d723a367ecb3d..f00ad0332ca9a 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures2.types +++ b/tests/baselines/reference/subtypingWithConstructSignatures2.types @@ -326,14 +326,14 @@ var r1 = foo1(r1arg1); // any, return types are not subtype of first overload >r1arg1 : new (x: T) => T[] var r1a = [r1arg2, r1arg1]; // generic signature, subtype in both directions ->r1a : (new (x: T) => T[])[] ->[r1arg2, r1arg1] : (new (x: T) => T[])[] +>r1a : ((new (x: number) => number[]) | (new (x: T) => T[]))[] +>[r1arg2, r1arg1] : ((new (x: number) => number[]) | (new (x: T) => T[]))[] >r1arg2 : new (x: number) => number[] >r1arg1 : new (x: T) => T[] var r1b = [r1arg1, r1arg2]; // generic signature, subtype in both directions ->r1b : (new (x: T) => T[])[] ->[r1arg1, r1arg2] : (new (x: T) => T[])[] +>r1b : ((new (x: T) => T[]) | (new (x: number) => number[]))[] +>[r1arg1, r1arg2] : ((new (x: T) => T[]) | (new (x: number) => number[]))[] >r1arg1 : new (x: T) => T[] >r1arg2 : new (x: number) => number[] @@ -354,14 +354,14 @@ var r2 = foo2(r2arg1); >r2arg1 : new (x: T) => string[] var r2a = [r2arg1, r2arg2]; ->r2a : (new (x: T) => string[])[] ->[r2arg1, r2arg2] : (new (x: T) => string[])[] +>r2a : ((new (x: T) => string[]) | (new (x: number) => string[]))[] +>[r2arg1, r2arg2] : ((new (x: T) => string[]) | (new (x: number) => string[]))[] >r2arg1 : new (x: T) => string[] >r2arg2 : new (x: number) => string[] var r2b = [r2arg2, r2arg1]; ->r2b : (new (x: T) => string[])[] ->[r2arg2, r2arg1] : (new (x: T) => string[])[] +>r2b : ((new (x: number) => string[]) | (new (x: T) => string[]))[] +>[r2arg2, r2arg1] : ((new (x: number) => string[]) | (new (x: T) => string[]))[] >r2arg2 : new (x: number) => string[] >r2arg1 : new (x: T) => string[] @@ -383,14 +383,14 @@ var r3 = foo3(r3arg1); >r3arg1 : new (x: T) => T var r3a = [r3arg1, r3arg2]; ->r3a : (new (x: T) => T)[] ->[r3arg1, r3arg2] : (new (x: T) => T)[] +>r3a : ((new (x: T) => T) | (new (x: number) => void))[] +>[r3arg1, r3arg2] : ((new (x: T) => T) | (new (x: number) => void))[] >r3arg1 : new (x: T) => T >r3arg2 : new (x: number) => void var r3b = [r3arg2, r3arg1]; ->r3b : (new (x: T) => T)[] ->[r3arg2, r3arg1] : (new (x: T) => T)[] +>r3b : ((new (x: number) => void) | (new (x: T) => T))[] +>[r3arg2, r3arg1] : ((new (x: number) => void) | (new (x: T) => T))[] >r3arg2 : new (x: number) => void >r3arg1 : new (x: T) => T @@ -416,14 +416,14 @@ var r4 = foo4(r4arg1); // any >r4arg1 : new (x: T, y: U) => T var r4a = [r4arg1, r4arg2]; ->r4a : (new (x: T, y: U) => T)[] ->[r4arg1, r4arg2] : (new (x: T, y: U) => T)[] +>r4a : ((new (x: T, y: U) => T) | (new (x: string, y: number) => string))[] +>[r4arg1, r4arg2] : ((new (x: T, y: U) => T) | (new (x: string, y: number) => string))[] >r4arg1 : new (x: T, y: U) => T >r4arg2 : new (x: string, y: number) => string var r4b = [r4arg2, r4arg1]; ->r4b : (new (x: T, y: U) => T)[] ->[r4arg2, r4arg1] : (new (x: T, y: U) => T)[] +>r4b : ((new (x: string, y: number) => string) | (new (x: T, y: U) => T))[] +>[r4arg2, r4arg1] : ((new (x: string, y: number) => string) | (new (x: T, y: U) => T))[] >r4arg2 : new (x: string, y: number) => string >r4arg1 : new (x: T, y: U) => T @@ -449,14 +449,14 @@ var r5 = foo5(r5arg1); // any >r5arg1 : new (x: new (arg: T) => U) => T var r5a = [r5arg1, r5arg2]; ->r5a : (new (x: new (arg: T) => U) => T)[] ->[r5arg1, r5arg2] : (new (x: new (arg: T) => U) => T)[] +>r5a : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: string) => number) => string))[] +>[r5arg1, r5arg2] : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: string) => number) => string))[] >r5arg1 : new (x: new (arg: T) => U) => T >r5arg2 : new (x: new (arg: string) => number) => string var r5b = [r5arg2, r5arg1]; ->r5b : (new (x: new (arg: T) => U) => T)[] ->[r5arg2, r5arg1] : (new (x: new (arg: T) => U) => T)[] +>r5b : ((new (x: new (arg: string) => number) => string) | (new (x: new (arg: T) => U) => T))[] +>[r5arg2, r5arg1] : ((new (x: new (arg: string) => number) => string) | (new (x: new (arg: T) => U) => T))[] >r5arg2 : new (x: new (arg: string) => number) => string >r5arg1 : new (x: new (arg: T) => U) => T @@ -487,14 +487,14 @@ var r6 = foo6(r6arg1); // any >r6arg1 : new (x: new (arg: T) => U) => T var r6a = [r6arg1, r6arg2]; ->r6a : (new (x: new (arg: T) => U) => T)[] ->[r6arg1, r6arg2] : (new (x: new (arg: T) => U) => T)[] +>r6a : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: Base) => Derived) => Base))[] +>[r6arg1, r6arg2] : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: Base) => Derived) => Base))[] >r6arg1 : new (x: new (arg: T) => U) => T >r6arg2 : new (x: new (arg: Base) => Derived) => Base var r6b = [r6arg2, r6arg1]; ->r6b : (new (x: new (arg: T) => U) => T)[] ->[r6arg2, r6arg1] : (new (x: new (arg: T) => U) => T)[] +>r6b : ((new (x: new (arg: Base) => Derived) => Base) | (new (x: new (arg: T) => U) => T))[] +>[r6arg2, r6arg1] : ((new (x: new (arg: Base) => Derived) => Base) | (new (x: new (arg: T) => U) => T))[] >r6arg2 : new (x: new (arg: Base) => Derived) => Base >r6arg1 : new (x: new (arg: T) => U) => T @@ -529,14 +529,14 @@ var r7 = foo7(r7arg1); // any >r7arg1 : new (x: new (arg: T) => U) => new (r: T) => U var r7a = [r7arg1, r7arg2]; ->r7a : (new (x: new (arg: T) => U) => new (r: T) => U)[] ->[r7arg1, r7arg2] : (new (x: new (arg: T) => U) => new (r: T) => U)[] +>r7a : ((new (x: new (arg: T) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived) => new (r: Base) => Derived))[] +>[r7arg1, r7arg2] : ((new (x: new (arg: T) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived) => new (r: Base) => Derived))[] >r7arg1 : new (x: new (arg: T) => U) => new (r: T) => U >r7arg2 : new (x: new (arg: Base) => Derived) => new (r: Base) => Derived var r7b = [r7arg2, r7arg1]; ->r7b : (new (x: new (arg: T) => U) => new (r: T) => U)[] ->[r7arg2, r7arg1] : (new (x: new (arg: T) => U) => new (r: T) => U)[] +>r7b : ((new (x: new (arg: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U) => new (r: T) => U))[] +>[r7arg2, r7arg1] : ((new (x: new (arg: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U) => new (r: T) => U))[] >r7arg2 : new (x: new (arg: Base) => Derived) => new (r: Base) => Derived >r7arg1 : new (x: new (arg: T) => U) => new (r: T) => U @@ -579,14 +579,14 @@ var r8 = foo8(r8arg1); // any >r8arg1 : new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U var r8a = [r8arg1, r8arg2]; ->r8a : (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U)[] ->[r8arg1, r8arg2] : (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U)[] +>r8a : ((new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived))[] +>[r8arg1, r8arg2] : ((new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived))[] >r8arg1 : new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U >r8arg2 : new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived var r8b = [r8arg2, r8arg1]; ->r8b : (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U)[] ->[r8arg2, r8arg1] : (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U)[] +>r8b : ((new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U))[] +>[r8arg2, r8arg1] : ((new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U))[] >r8arg2 : new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived >r8arg1 : new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U @@ -636,8 +636,8 @@ var r9a = [r9arg1, r9arg2]; >r9arg2 : new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived var r9b = [r9arg2, r9arg1]; ->r9b : ((new (x: new (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived))[] ->[r9arg2, r9arg1] : ((new (x: new (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived))[] +>r9b : ((new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => new (r: T) => U))[] +>[r9arg2, r9arg1] : ((new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => new (r: T) => U))[] >r9arg2 : new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived >r9arg1 : new (x: new (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => new (r: T) => U @@ -662,14 +662,14 @@ var r10 = foo10(r10arg1); // any >r10arg1 : new (...x: T[]) => T var r10a = [r10arg1, r10arg2]; ->r10a : (new (...x: T[]) => T)[] ->[r10arg1, r10arg2] : (new (...x: T[]) => T)[] +>r10a : ((new (...x: T[]) => T) | (new (...x: Derived[]) => Derived))[] +>[r10arg1, r10arg2] : ((new (...x: T[]) => T) | (new (...x: Derived[]) => Derived))[] >r10arg1 : new (...x: T[]) => T >r10arg2 : new (...x: Derived[]) => Derived var r10b = [r10arg2, r10arg1]; ->r10b : (new (...x: T[]) => T)[] ->[r10arg2, r10arg1] : (new (...x: T[]) => T)[] +>r10b : ((new (...x: Derived[]) => Derived) | (new (...x: T[]) => T))[] +>[r10arg2, r10arg1] : ((new (...x: Derived[]) => Derived) | (new (...x: T[]) => T))[] >r10arg2 : new (...x: Derived[]) => Derived >r10arg1 : new (...x: T[]) => T @@ -699,14 +699,14 @@ var r11 = foo11(r11arg1); // any >r11arg1 : new (x: T, y: T) => T var r11a = [r11arg1, r11arg2]; ->r11a : (new (x: T, y: T) => T)[] ->[r11arg1, r11arg2] : (new (x: T, y: T) => T)[] +>r11a : ((new (x: T, y: T) => T) | (new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] +>[r11arg1, r11arg2] : ((new (x: T, y: T) => T) | (new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] >r11arg1 : new (x: T, y: T) => T >r11arg2 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base var r11b = [r11arg2, r11arg1]; ->r11b : (new (x: T, y: T) => T)[] ->[r11arg2, r11arg1] : (new (x: T, y: T) => T)[] +>r11b : ((new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | (new (x: T, y: T) => T))[] +>[r11arg2, r11arg1] : ((new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | (new (x: T, y: T) => T))[] >r11arg2 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base >r11arg1 : new (x: T, y: T) => T @@ -741,14 +741,14 @@ var r12 = foo12(r12arg1); // any >r12arg1 : new (x: Base[], y: T) => Derived[] var r12a = [r12arg1, r12arg2]; ->r12a : (new (x: Base[], y: T) => Derived[])[] ->[r12arg1, r12arg2] : (new (x: Base[], y: T) => Derived[])[] +>r12a : ((new (x: Base[], y: T) => Derived[]) | (new (x: Base[], y: Derived2[]) => Derived[]))[] +>[r12arg1, r12arg2] : ((new (x: Base[], y: T) => Derived[]) | (new (x: Base[], y: Derived2[]) => Derived[]))[] >r12arg1 : new (x: Base[], y: T) => Derived[] >r12arg2 : new (x: Base[], y: Derived2[]) => Derived[] var r12b = [r12arg2, r12arg1]; ->r12b : (new (x: Base[], y: T) => Derived[])[] ->[r12arg2, r12arg1] : (new (x: Base[], y: T) => Derived[])[] +>r12b : ((new (x: Base[], y: Derived2[]) => Derived[]) | (new (x: Base[], y: T) => Derived[]))[] +>[r12arg2, r12arg1] : ((new (x: Base[], y: Derived2[]) => Derived[]) | (new (x: Base[], y: T) => Derived[]))[] >r12arg2 : new (x: Base[], y: Derived2[]) => Derived[] >r12arg1 : new (x: Base[], y: T) => Derived[] @@ -782,14 +782,14 @@ var r13 = foo13(r13arg1); // any >r13arg1 : new (x: Base[], y: T) => T var r13a = [r13arg1, r13arg2]; ->r13a : (new (x: Base[], y: T) => T)[] ->[r13arg1, r13arg2] : (new (x: Base[], y: T) => T)[] +>r13a : ((new (x: Base[], y: T) => T) | (new (x: Base[], y: Derived[]) => Derived[]))[] +>[r13arg1, r13arg2] : ((new (x: Base[], y: T) => T) | (new (x: Base[], y: Derived[]) => Derived[]))[] >r13arg1 : new (x: Base[], y: T) => T >r13arg2 : new (x: Base[], y: Derived[]) => Derived[] var r13b = [r13arg2, r13arg1]; ->r13b : (new (x: Base[], y: T) => T)[] ->[r13arg2, r13arg1] : (new (x: Base[], y: T) => T)[] +>r13b : ((new (x: Base[], y: Derived[]) => Derived[]) | (new (x: Base[], y: T) => T))[] +>[r13arg2, r13arg1] : ((new (x: Base[], y: Derived[]) => Derived[]) | (new (x: Base[], y: T) => T))[] >r13arg2 : new (x: Base[], y: Derived[]) => Derived[] >r13arg1 : new (x: Base[], y: T) => T @@ -817,14 +817,14 @@ var r14 = foo14(r14arg1); // any >r14arg1 : new (x: { a: T; b: T; }) => T var r14a = [r14arg1, r14arg2]; ->r14a : (new (x: { a: T; b: T; }) => T)[] ->[r14arg1, r14arg2] : (new (x: { a: T; b: T; }) => T)[] +>r14a : ((new (x: { a: T; b: T; }) => T) | (new (x: { a: string; b: number; }) => Object))[] +>[r14arg1, r14arg2] : ((new (x: { a: T; b: T; }) => T) | (new (x: { a: string; b: number; }) => Object))[] >r14arg1 : new (x: { a: T; b: T; }) => T >r14arg2 : new (x: { a: string; b: number; }) => Object var r14b = [r14arg2, r14arg1]; ->r14b : (new (x: { a: T; b: T; }) => T)[] ->[r14arg2, r14arg1] : (new (x: { a: T; b: T; }) => T)[] +>r14b : ((new (x: { a: string; b: number; }) => Object) | (new (x: { a: T; b: T; }) => T))[] +>[r14arg2, r14arg1] : ((new (x: { a: string; b: number; }) => Object) | (new (x: { a: T; b: T; }) => T))[] >r14arg2 : new (x: { a: string; b: number; }) => Object >r14arg1 : new (x: { a: T; b: T; }) => T diff --git a/tests/baselines/reference/subtypingWithConstructSignatures3.types b/tests/baselines/reference/subtypingWithConstructSignatures3.types index b0f0680c7a088..b7c90d8697e4e 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures3.types +++ b/tests/baselines/reference/subtypingWithConstructSignatures3.types @@ -224,14 +224,14 @@ module Errors { >r1arg1 : new (x: T) => U[] var r1a = [r1arg2, r1arg1]; ->r1a : (new (x: T) => U[])[] ->[r1arg2, r1arg1] : (new (x: T) => U[])[] +>r1a : ((new (x: number) => string[]) | (new (x: T) => U[]))[] +>[r1arg2, r1arg1] : ((new (x: number) => string[]) | (new (x: T) => U[]))[] >r1arg2 : new (x: number) => string[] >r1arg1 : new (x: T) => U[] var r1b = [r1arg1, r1arg2]; ->r1b : (new (x: T) => U[])[] ->[r1arg1, r1arg2] : (new (x: T) => U[])[] +>r1b : ((new (x: T) => U[]) | (new (x: number) => string[]))[] +>[r1arg1, r1arg2] : ((new (x: T) => U[]) | (new (x: number) => string[]))[] >r1arg1 : new (x: T) => U[] >r1arg2 : new (x: number) => string[] @@ -268,14 +268,14 @@ module Errors { >r2arg1 : new (x: new (arg: T) => U) => new (r: T) => V var r2a = [r2arg2, r2arg1]; ->r2a : (new (x: new (arg: T) => U) => new (r: T) => V)[] ->[r2arg2, r2arg1] : (new (x: new (arg: T) => U) => new (r: T) => V)[] +>r2a : ((new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2) | (new (x: new (arg: T) => U) => new (r: T) => V))[] +>[r2arg2, r2arg1] : ((new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2) | (new (x: new (arg: T) => U) => new (r: T) => V))[] >r2arg2 : new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2 >r2arg1 : new (x: new (arg: T) => U) => new (r: T) => V var r2b = [r2arg1, r2arg2]; ->r2b : (new (x: new (arg: T) => U) => new (r: T) => V)[] ->[r2arg1, r2arg2] : (new (x: new (arg: T) => U) => new (r: T) => V)[] +>r2b : ((new (x: new (arg: T) => U) => new (r: T) => V) | (new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2))[] +>[r2arg1, r2arg2] : ((new (x: new (arg: T) => U) => new (r: T) => V) | (new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2))[] >r2arg1 : new (x: new (arg: T) => U) => new (r: T) => V >r2arg2 : new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2 @@ -318,8 +318,8 @@ module Errors { >r3arg1 : new (x: new (arg: T) => U, y: (arg2: { foo: number; }) => U) => new (r: T) => U var r3a = [r3arg2, r3arg1]; ->r3a : ((new (x: new (arg: T) => U, y: (arg2: { foo: number; }) => U) => new (r: T) => U) | (new (x: (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived))[] ->[r3arg2, r3arg1] : ((new (x: new (arg: T) => U, y: (arg2: { foo: number; }) => U) => new (r: T) => U) | (new (x: (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived))[] +>r3a : ((new (x: (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U, y: (arg2: { foo: number; }) => U) => new (r: T) => U))[] +>[r3arg2, r3arg1] : ((new (x: (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U, y: (arg2: { foo: number; }) => U) => new (r: T) => U))[] >r3arg2 : new (x: (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived >r3arg1 : new (x: new (arg: T) => U, y: (arg2: { foo: number; }) => U) => new (r: T) => U @@ -350,14 +350,14 @@ module Errors { >r4arg1 : new (...x: T[]) => T var r4a = [r4arg2, r4arg1]; ->r4a : (new (...x: T[]) => T)[] ->[r4arg2, r4arg1] : (new (...x: T[]) => T)[] +>r4a : ((new (...x: Base[]) => Base) | (new (...x: T[]) => T))[] +>[r4arg2, r4arg1] : ((new (...x: Base[]) => Base) | (new (...x: T[]) => T))[] >r4arg2 : new (...x: Base[]) => Base >r4arg1 : new (...x: T[]) => T var r4b = [r4arg1, r4arg2]; ->r4b : (new (...x: T[]) => T)[] ->[r4arg1, r4arg2] : (new (...x: T[]) => T)[] +>r4b : ((new (...x: T[]) => T) | (new (...x: Base[]) => Base))[] +>[r4arg1, r4arg2] : ((new (...x: T[]) => T) | (new (...x: Base[]) => Base))[] >r4arg1 : new (...x: T[]) => T >r4arg2 : new (...x: Base[]) => Base @@ -387,14 +387,14 @@ module Errors { >r5arg1 : new (x: T, y: T) => T var r5a = [r5arg2, r5arg1]; ->r5a : (new (x: T, y: T) => T)[] ->[r5arg2, r5arg1] : (new (x: T, y: T) => T)[] +>r5a : ((new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | (new (x: T, y: T) => T))[] +>[r5arg2, r5arg1] : ((new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | (new (x: T, y: T) => T))[] >r5arg2 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base >r5arg1 : new (x: T, y: T) => T var r5b = [r5arg1, r5arg2]; ->r5b : (new (x: T, y: T) => T)[] ->[r5arg1, r5arg2] : (new (x: T, y: T) => T)[] +>r5b : ((new (x: T, y: T) => T) | (new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] +>[r5arg1, r5arg2] : ((new (x: T, y: T) => T) | (new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] >r5arg1 : new (x: T, y: T) => T >r5arg2 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base @@ -429,14 +429,14 @@ module Errors { >r6arg1 : new (x: Base[], y: Derived2[]) => Derived[] var r6a = [r6arg2, r6arg1]; ->r6a : (new (x: Base[], y: Base[]) => T)[] ->[r6arg2, r6arg1] : (new (x: Base[], y: Base[]) => T)[] +>r6a : ((new (x: Base[], y: Base[]) => T) | (new (x: Base[], y: Derived2[]) => Derived[]))[] +>[r6arg2, r6arg1] : ((new (x: Base[], y: Base[]) => T) | (new (x: Base[], y: Derived2[]) => Derived[]))[] >r6arg2 : new (x: Base[], y: Base[]) => T >r6arg1 : new (x: Base[], y: Derived2[]) => Derived[] var r6b = [r6arg1, r6arg2]; ->r6b : (new (x: Base[], y: Base[]) => T)[] ->[r6arg1, r6arg2] : (new (x: Base[], y: Base[]) => T)[] +>r6b : ((new (x: Base[], y: Derived2[]) => Derived[]) | (new (x: Base[], y: Base[]) => T))[] +>[r6arg1, r6arg2] : ((new (x: Base[], y: Derived2[]) => Derived[]) | (new (x: Base[], y: Base[]) => T))[] >r6arg1 : new (x: Base[], y: Derived2[]) => Derived[] >r6arg2 : new (x: Base[], y: Base[]) => T @@ -463,14 +463,14 @@ module Errors { >r7arg1 : new (x: { a: T; b: T; }) => T var r7a = [r7arg2, r7arg1]; ->r7a : (new (x: { a: T; b: T; }) => T)[] ->[r7arg2, r7arg1] : (new (x: { a: T; b: T; }) => T)[] +>r7a : ((new (x: { a: string; b: number; }) => number) | (new (x: { a: T; b: T; }) => T))[] +>[r7arg2, r7arg1] : ((new (x: { a: string; b: number; }) => number) | (new (x: { a: T; b: T; }) => T))[] >r7arg2 : new (x: { a: string; b: number; }) => number >r7arg1 : new (x: { a: T; b: T; }) => T var r7b = [r7arg1, r7arg2]; ->r7b : (new (x: { a: T; b: T; }) => T)[] ->[r7arg1, r7arg2] : (new (x: { a: T; b: T; }) => T)[] +>r7b : ((new (x: { a: T; b: T; }) => T) | (new (x: { a: string; b: number; }) => number))[] +>[r7arg1, r7arg2] : ((new (x: { a: T; b: T; }) => T) | (new (x: { a: string; b: number; }) => number))[] >r7arg1 : new (x: { a: T; b: T; }) => T >r7arg2 : new (x: { a: string; b: number; }) => number @@ -491,14 +491,14 @@ module Errors { >r7arg3 : new (x: { a: T; b: T; }) => number var r7d = [r7arg2, r7arg3]; ->r7d : (new (x: { a: string; b: number; }) => number)[] ->[r7arg2, r7arg3] : (new (x: { a: string; b: number; }) => number)[] +>r7d : ((new (x: { a: string; b: number; }) => number) | (new (x: { a: T; b: T; }) => number))[] +>[r7arg2, r7arg3] : ((new (x: { a: string; b: number; }) => number) | (new (x: { a: T; b: T; }) => number))[] >r7arg2 : new (x: { a: string; b: number; }) => number >r7arg3 : new (x: { a: T; b: T; }) => number var r7e = [r7arg3, r7arg2]; ->r7e : (new (x: { a: string; b: number; }) => number)[] ->[r7arg3, r7arg2] : (new (x: { a: string; b: number; }) => number)[] +>r7e : ((new (x: { a: T; b: T; }) => number) | (new (x: { a: string; b: number; }) => number))[] +>[r7arg3, r7arg2] : ((new (x: { a: T; b: T; }) => number) | (new (x: { a: string; b: number; }) => number))[] >r7arg3 : new (x: { a: T; b: T; }) => number >r7arg2 : new (x: { a: string; b: number; }) => number diff --git a/tests/baselines/reference/subtypingWithConstructSignatures4.types b/tests/baselines/reference/subtypingWithConstructSignatures4.types index 21a40ecf7fcc1..328dadad41c8c 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures4.types +++ b/tests/baselines/reference/subtypingWithConstructSignatures4.types @@ -301,14 +301,14 @@ var r3 = foo3(r3arg); >r3arg : new (x: T) => T var r3a = [r3arg, r3arg2]; ->r3a : (new (x: T) => T)[] ->[r3arg, r3arg2] : (new (x: T) => T)[] +>r3a : ((new (x: T) => T) | (new (x: T) => void))[] +>[r3arg, r3arg2] : ((new (x: T) => T) | (new (x: T) => void))[] >r3arg : new (x: T) => T >r3arg2 : new (x: T) => void var r3b = [r3arg2, r3arg]; ->r3b : (new (x: T) => T)[] ->[r3arg2, r3arg] : (new (x: T) => T)[] +>r3b : ((new (x: T) => void) | (new (x: T) => T))[] +>[r3arg2, r3arg] : ((new (x: T) => void) | (new (x: T) => T))[] >r3arg2 : new (x: T) => void >r3arg : new (x: T) => T @@ -415,14 +415,14 @@ var r6 = foo6(r6arg); >r6arg : new (x: new (arg: T) => U) => T var r6a = [r6arg, r6arg2]; ->r6a : (new (x: new (arg: T) => U) => T)[] ->[r6arg, r6arg2] : (new (x: new (arg: T) => U) => T)[] +>r6a : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: T) => Derived) => T))[] +>[r6arg, r6arg2] : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: T) => Derived) => T))[] >r6arg : new (x: new (arg: T) => U) => T >r6arg2 : new (x: new (arg: T) => Derived) => T var r6b = [r6arg2, r6arg]; ->r6b : (new (x: new (arg: T) => U) => T)[] ->[r6arg2, r6arg] : (new (x: new (arg: T) => U) => T)[] +>r6b : ((new (x: new (arg: T) => Derived) => T) | (new (x: new (arg: T) => U) => T))[] +>[r6arg2, r6arg] : ((new (x: new (arg: T) => Derived) => T) | (new (x: new (arg: T) => U) => T))[] >r6arg2 : new (x: new (arg: T) => Derived) => T >r6arg : new (x: new (arg: T) => U) => T @@ -460,14 +460,14 @@ var r11 = foo11(r11arg); >r11arg : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base var r11a = [r11arg, r11arg2]; ->r11a : (new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] ->[r11arg, r11arg2] : (new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] +>r11a : ((new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base) | (new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base))[] +>[r11arg, r11arg2] : ((new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base) | (new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base))[] >r11arg : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base >r11arg2 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base var r11b = [r11arg2, r11arg]; ->r11b : (new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] ->[r11arg2, r11arg] : (new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] +>r11b : ((new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base) | (new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base))[] +>[r11arg2, r11arg] : ((new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base) | (new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base))[] >r11arg2 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base >r11arg : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base @@ -499,14 +499,14 @@ var r15 = foo15(r15arg); >r15arg : new (x: { a: U; b: V; }) => U[] var r15a = [r15arg, r15arg2]; ->r15a : (new (x: { a: U; b: V; }) => U[])[] ->[r15arg, r15arg2] : (new (x: { a: U; b: V; }) => U[])[] +>r15a : ((new (x: { a: U; b: V; }) => U[]) | (new (x: { a: T; b: T; }) => T[]))[] +>[r15arg, r15arg2] : ((new (x: { a: U; b: V; }) => U[]) | (new (x: { a: T; b: T; }) => T[]))[] >r15arg : new (x: { a: U; b: V; }) => U[] >r15arg2 : new (x: { a: T; b: T; }) => T[] var r15b = [r15arg2, r15arg]; ->r15b : (new (x: { a: U; b: V; }) => U[])[] ->[r15arg2, r15arg] : (new (x: { a: U; b: V; }) => U[])[] +>r15b : ((new (x: { a: T; b: T; }) => T[]) | (new (x: { a: U; b: V; }) => U[]))[] +>[r15arg2, r15arg] : ((new (x: { a: T; b: T; }) => T[]) | (new (x: { a: U; b: V; }) => U[]))[] >r15arg2 : new (x: { a: T; b: T; }) => T[] >r15arg : new (x: { a: U; b: V; }) => U[] diff --git a/tests/baselines/reference/subtypingWithObjectMembersOptionality.types b/tests/baselines/reference/subtypingWithObjectMembersOptionality.types index 815f2d60740ca..0d55d78e266b8 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersOptionality.types +++ b/tests/baselines/reference/subtypingWithObjectMembersOptionality.types @@ -85,8 +85,8 @@ var b = { Foo: null }; >null : null var r = true ? a : b; ->r : { Foo?: Base; } ->true ? a : b : { Foo?: Base; } +>r : { Foo?: Base; } | { Foo: Derived; } +>true ? a : b : { Foo?: Base; } | { Foo: Derived; } >true : boolean >a : { Foo?: Base; } >b : { Foo: Derived; } @@ -156,8 +156,8 @@ module TwoLevels { >null : null var r = true ? a : b; ->r : { Foo?: Base; } ->true ? a : b : { Foo?: Base; } +>r : { Foo?: Base; } | { Foo: Derived2; } +>true ? a : b : { Foo?: Base; } | { Foo: Derived2; } >true : boolean >a : { Foo?: Base; } >b : { Foo: Derived2; } diff --git a/tests/baselines/reference/switchStatements.errors.txt b/tests/baselines/reference/switchStatements.errors.txt new file mode 100644 index 0000000000000..aa5b796e252c7 --- /dev/null +++ b/tests/baselines/reference/switchStatements.errors.txt @@ -0,0 +1,63 @@ +tests/cases/conformance/statements/switchStatements/switchStatements.ts(35,10): error TS2322: Type '{ id: number; name: string; }' is not assignable to type 'C'. + Object literal may only specify known properties, and 'name' does not exist in type 'C'. + + +==== tests/cases/conformance/statements/switchStatements/switchStatements.ts (1 errors) ==== + module M { + export function fn(x: number) { + return ''; + } + } + + var x: any; + switch (x) { + case '': + case 12: + case true: + case null: + case undefined: + case new Date(12): + case new Object(): + case /[a-z]/: + case[]: + case {}: + case { id: 12 }: + case['a']: + case typeof x: + case typeof M: + case M.fn(1): + case (x: number) => '': + case ((x: number) => '')(2): + default: + } + + // basic assignable check, rest covered in tests for 'assignement compatibility' + class C { id: number; } + class D extends C { name: string } + + switch (new C()) { + case new D(): + case { id: 12, name: '' }: + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type 'C'. +!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type 'C'. + case new C(): + } + + switch ('') { } + switch (12) { } + switch (true) { } + switch (null) { } + switch (undefined) { } + switch (new Date(12)) { } + switch (new Object()) { } + switch (/[a-z]/) { } + switch ([]) { } + switch ({}) { } + switch ({ id: 12 }) { } + switch (['a']) { } + switch ((x: number) => '') { } + switch (((x: T) => '')(1)) { } + + + \ No newline at end of file diff --git a/tests/baselines/reference/switchStatements.symbols b/tests/baselines/reference/switchStatements.symbols deleted file mode 100644 index fc8f076a12ccc..0000000000000 --- a/tests/baselines/reference/switchStatements.symbols +++ /dev/null @@ -1,115 +0,0 @@ -=== tests/cases/conformance/statements/switchStatements/switchStatements.ts === -module M { ->M : Symbol(M, Decl(switchStatements.ts, 0, 0)) - - export function fn(x: number) { ->fn : Symbol(fn, Decl(switchStatements.ts, 0, 10)) ->x : Symbol(x, Decl(switchStatements.ts, 1, 23)) - - return ''; - } -} - -var x: any; ->x : Symbol(x, Decl(switchStatements.ts, 6, 3)) - -switch (x) { ->x : Symbol(x, Decl(switchStatements.ts, 6, 3)) - - case '': - case 12: - case true: - case null: - case undefined: ->undefined : Symbol(undefined) - - case new Date(12): ->Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11)) - - case new Object(): ->Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11)) - - case /[a-z]/: - case[]: - case {}: - case { id: 12 }: ->id : Symbol(id, Decl(switchStatements.ts, 18, 10)) - - case['a']: - case typeof x: ->x : Symbol(x, Decl(switchStatements.ts, 6, 3)) - - case typeof M: ->M : Symbol(M, Decl(switchStatements.ts, 0, 0)) - - case M.fn(1): ->M.fn : Symbol(M.fn, Decl(switchStatements.ts, 0, 10)) ->M : Symbol(M, Decl(switchStatements.ts, 0, 0)) ->fn : Symbol(M.fn, Decl(switchStatements.ts, 0, 10)) - - case (x: number) => '': ->T : Symbol(T, Decl(switchStatements.ts, 23, 10)) ->x : Symbol(x, Decl(switchStatements.ts, 23, 13)) - - case ((x: number) => '')(2): ->T : Symbol(T, Decl(switchStatements.ts, 24, 11)) ->x : Symbol(x, Decl(switchStatements.ts, 24, 14)) - - default: -} - -// basic assignable check, rest covered in tests for 'assignement compatibility' -class C { id: number; } ->C : Symbol(C, Decl(switchStatements.ts, 26, 1)) ->id : Symbol(id, Decl(switchStatements.ts, 29, 9)) - -class D extends C { name: string } ->D : Symbol(D, Decl(switchStatements.ts, 29, 23)) ->C : Symbol(C, Decl(switchStatements.ts, 26, 1)) ->name : Symbol(name, Decl(switchStatements.ts, 30, 19)) - -switch (new C()) { ->C : Symbol(C, Decl(switchStatements.ts, 26, 1)) - - case new D(): ->D : Symbol(D, Decl(switchStatements.ts, 29, 23)) - - case { id: 12, name: '' }: ->id : Symbol(id, Decl(switchStatements.ts, 34, 10)) ->name : Symbol(name, Decl(switchStatements.ts, 34, 18)) - - case new C(): ->C : Symbol(C, Decl(switchStatements.ts, 26, 1)) -} - -switch ('') { } -switch (12) { } -switch (true) { } -switch (null) { } -switch (undefined) { } ->undefined : Symbol(undefined) - -switch (new Date(12)) { } ->Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11)) - -switch (new Object()) { } ->Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11)) - -switch (/[a-z]/) { } -switch ([]) { } -switch ({}) { } -switch ({ id: 12 }) { } ->id : Symbol(id, Decl(switchStatements.ts, 48, 9)) - -switch (['a']) { } -switch ((x: number) => '') { } ->T : Symbol(T, Decl(switchStatements.ts, 50, 9)) ->x : Symbol(x, Decl(switchStatements.ts, 50, 12)) - -switch (((x: T) => '')(1)) { } ->T : Symbol(T, Decl(switchStatements.ts, 51, 10)) ->x : Symbol(x, Decl(switchStatements.ts, 51, 13)) ->T : Symbol(T, Decl(switchStatements.ts, 51, 10)) - - - diff --git a/tests/baselines/reference/switchStatements.types b/tests/baselines/reference/switchStatements.types deleted file mode 100644 index a5679547c1292..0000000000000 --- a/tests/baselines/reference/switchStatements.types +++ /dev/null @@ -1,184 +0,0 @@ -=== tests/cases/conformance/statements/switchStatements/switchStatements.ts === -module M { ->M : typeof M - - export function fn(x: number) { ->fn : (x: number) => string ->x : number - - return ''; ->'' : string - } -} - -var x: any; ->x : any - -switch (x) { ->x : any - - case '': ->'' : string - - case 12: ->12 : number - - case true: ->true : boolean - - case null: ->null : null - - case undefined: ->undefined : undefined - - case new Date(12): ->new Date(12) : Date ->Date : DateConstructor ->12 : number - - case new Object(): ->new Object() : Object ->Object : ObjectConstructor - - case /[a-z]/: ->/[a-z]/ : RegExp - - case[]: ->[] : undefined[] - - case {}: ->{} : {} - - case { id: 12 }: ->{ id: 12 } : { id: number; } ->id : number ->12 : number - - case['a']: ->['a'] : string[] ->'a' : string - - case typeof x: ->typeof x : string ->x : any - - case typeof M: ->typeof M : string ->M : typeof M - - case M.fn(1): ->M.fn(1) : string ->M.fn : (x: number) => string ->M : typeof M ->fn : (x: number) => string ->1 : number - - case (x: number) => '': ->(x: number) => '' : (x: number) => string ->T : T ->x : number ->'' : string - - case ((x: number) => '')(2): ->((x: number) => '')(2) : string ->((x: number) => '') : (x: number) => string ->(x: number) => '' : (x: number) => string ->T : T ->x : number ->'' : string ->2 : number - - default: -} - -// basic assignable check, rest covered in tests for 'assignement compatibility' -class C { id: number; } ->C : C ->id : number - -class D extends C { name: string } ->D : D ->C : C ->name : string - -switch (new C()) { ->new C() : C ->C : typeof C - - case new D(): ->new D() : D ->D : typeof D - - case { id: 12, name: '' }: ->{ id: 12, name: '' } : { id: number; name: string; } ->id : number ->12 : number ->name : string ->'' : string - - case new C(): ->new C() : C ->C : typeof C -} - -switch ('') { } ->'' : string - -switch (12) { } ->12 : number - -switch (true) { } ->true : boolean - -switch (null) { } ->null : null - -switch (undefined) { } ->undefined : undefined - -switch (new Date(12)) { } ->new Date(12) : Date ->Date : DateConstructor ->12 : number - -switch (new Object()) { } ->new Object() : Object ->Object : ObjectConstructor - -switch (/[a-z]/) { } ->/[a-z]/ : RegExp - -switch ([]) { } ->[] : undefined[] - -switch ({}) { } ->{} : {} - -switch ({ id: 12 }) { } ->{ id: 12 } : { id: number; } ->id : number ->12 : number - -switch (['a']) { } ->['a'] : string[] ->'a' : string - -switch ((x: number) => '') { } ->(x: number) => '' : (x: number) => string ->T : T ->x : number ->'' : string - -switch (((x: T) => '')(1)) { } ->((x: T) => '')(1) : string ->((x: T) => '') : (x: T) => string ->(x: T) => '' : (x: T) => string ->T : T ->x : T ->T : T ->'' : string ->1 : number - - - diff --git a/tests/baselines/reference/symbolProperty21.errors.txt b/tests/baselines/reference/symbolProperty21.errors.txt new file mode 100644 index 0000000000000..b9162acc84fa0 --- /dev/null +++ b/tests/baselines/reference/symbolProperty21.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/es6/Symbols/symbolProperty21.ts(8,5): error TS2345: Argument of type '{ [Symbol.isConcatSpreadable]: string; [Symbol.toPrimitive]: number; [Symbol.unscopables]: boolean; }' is not assignable to parameter of type 'I'. + Object literal may only specify known properties, and '[Symbol.toPrimitive]' does not exist in type 'I'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty21.ts (1 errors) ==== + interface I { + [Symbol.unscopables]: T; + [Symbol.isConcatSpreadable]: U; + } + + declare function foo(p: I): { t: T; u: U }; + + foo({ + ~ + [Symbol.isConcatSpreadable]: "", + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + [Symbol.toPrimitive]: 0, + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + [Symbol.unscopables]: true + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + }); + ~ +!!! error TS2345: Argument of type '{ [Symbol.isConcatSpreadable]: string; [Symbol.toPrimitive]: number; [Symbol.unscopables]: boolean; }' is not assignable to parameter of type 'I'. +!!! error TS2345: Object literal may only specify known properties, and '[Symbol.toPrimitive]' does not exist in type 'I'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty21.symbols b/tests/baselines/reference/symbolProperty21.symbols deleted file mode 100644 index 09997f687d53f..0000000000000 --- a/tests/baselines/reference/symbolProperty21.symbols +++ /dev/null @@ -1,51 +0,0 @@ -=== tests/cases/conformance/es6/Symbols/symbolProperty21.ts === -interface I { ->I : Symbol(I, Decl(symbolProperty21.ts, 0, 0)) ->T : Symbol(T, Decl(symbolProperty21.ts, 0, 12)) ->U : Symbol(U, Decl(symbolProperty21.ts, 0, 14)) - - [Symbol.unscopables]: T; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) ->T : Symbol(T, Decl(symbolProperty21.ts, 0, 12)) - - [Symbol.isConcatSpreadable]: U; ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) ->U : Symbol(U, Decl(symbolProperty21.ts, 0, 14)) -} - -declare function foo(p: I): { t: T; u: U }; ->foo : Symbol(foo, Decl(symbolProperty21.ts, 3, 1)) ->T : Symbol(T, Decl(symbolProperty21.ts, 5, 21)) ->U : Symbol(U, Decl(symbolProperty21.ts, 5, 23)) ->p : Symbol(p, Decl(symbolProperty21.ts, 5, 27)) ->I : Symbol(I, Decl(symbolProperty21.ts, 0, 0)) ->T : Symbol(T, Decl(symbolProperty21.ts, 5, 21)) ->U : Symbol(U, Decl(symbolProperty21.ts, 5, 23)) ->t : Symbol(t, Decl(symbolProperty21.ts, 5, 41)) ->T : Symbol(T, Decl(symbolProperty21.ts, 5, 21)) ->u : Symbol(u, Decl(symbolProperty21.ts, 5, 47)) ->U : Symbol(U, Decl(symbolProperty21.ts, 5, 23)) - -foo({ ->foo : Symbol(foo, Decl(symbolProperty21.ts, 3, 1)) - - [Symbol.isConcatSpreadable]: "", ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) - - [Symbol.toPrimitive]: 0, ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) - - [Symbol.unscopables]: true ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) - -}); diff --git a/tests/baselines/reference/symbolProperty21.types b/tests/baselines/reference/symbolProperty21.types deleted file mode 100644 index e2cda0a896f03..0000000000000 --- a/tests/baselines/reference/symbolProperty21.types +++ /dev/null @@ -1,56 +0,0 @@ -=== tests/cases/conformance/es6/Symbols/symbolProperty21.ts === -interface I { ->I : I ->T : T ->U : U - - [Symbol.unscopables]: T; ->Symbol.unscopables : symbol ->Symbol : SymbolConstructor ->unscopables : symbol ->T : T - - [Symbol.isConcatSpreadable]: U; ->Symbol.isConcatSpreadable : symbol ->Symbol : SymbolConstructor ->isConcatSpreadable : symbol ->U : U -} - -declare function foo(p: I): { t: T; u: U }; ->foo : (p: I) => { t: T; u: U; } ->T : T ->U : U ->p : I ->I : I ->T : T ->U : U ->t : T ->T : T ->u : U ->U : U - -foo({ ->foo({ [Symbol.isConcatSpreadable]: "", [Symbol.toPrimitive]: 0, [Symbol.unscopables]: true}) : { t: boolean; u: string; } ->foo : (p: I) => { t: T; u: U; } ->{ [Symbol.isConcatSpreadable]: "", [Symbol.toPrimitive]: 0, [Symbol.unscopables]: true} : { [Symbol.isConcatSpreadable]: string; [Symbol.toPrimitive]: number; [Symbol.unscopables]: boolean; } - - [Symbol.isConcatSpreadable]: "", ->Symbol.isConcatSpreadable : symbol ->Symbol : SymbolConstructor ->isConcatSpreadable : symbol ->"" : string - - [Symbol.toPrimitive]: 0, ->Symbol.toPrimitive : symbol ->Symbol : SymbolConstructor ->toPrimitive : symbol ->0 : number - - [Symbol.unscopables]: true ->Symbol.unscopables : symbol ->Symbol : SymbolConstructor ->unscopables : symbol ->true : boolean - -}); diff --git a/tests/baselines/reference/symbolType11.types b/tests/baselines/reference/symbolType11.types index 903c4ec0ecc2b..a7de59a11b736 100644 --- a/tests/baselines/reference/symbolType11.types +++ b/tests/baselines/reference/symbolType11.types @@ -28,12 +28,12 @@ s || s; >s : symbol s || 1; ->s || 1 : number | symbol +>s || 1 : symbol | number >s : symbol >1 : number ({}) || s; ->({}) || s : {} +>({}) || s : {} | symbol >({}) : {} >{} : {} >s : symbol diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt index f3706ae8f17de..6464366d33de3 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(77,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. - Property 'z' is missing in type '{ x: number; y: string; }'. + Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; z: Date; }'. ==== tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts (2 errors) ==== @@ -89,7 +89,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference ~~~~~~~~~~~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. -!!! error TS2453: Property 'z' is missing in type '{ x: number; y: string; }'. +!!! error TS2453: Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; z: Date; }'. var a9e: {}; // Generic tag with multiple parameters of generic type passed arguments with a single best common type diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.errors.txt b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.errors.txt index 1a4a1dc5aac1f..be8c517d39cd6 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInferenceES6.ts(76,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. - Property 'z' is missing in type '{ x: number; y: string; }'. + Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; z: Date; }'. ==== tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInferenceES6.ts (2 errors) ==== @@ -88,7 +88,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference ~~~~~~~~~~~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. -!!! error TS2453: Property 'z' is missing in type '{ x: number; y: string; }'. +!!! error TS2453: Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; z: Date; }'. var a9e: {}; // Generic tag with multiple parameters of generic type passed arguments with a single best common type diff --git a/tests/baselines/reference/targetTypeTest2.types b/tests/baselines/reference/targetTypeTest2.types index 25b36f948c6c0..53381b9de43e8 100644 --- a/tests/baselines/reference/targetTypeTest2.types +++ b/tests/baselines/reference/targetTypeTest2.types @@ -4,7 +4,7 @@ var a : any[] = [1,2,"3"]; >a : any[] ->[1,2,"3"] : (string | number)[] +>[1,2,"3"] : (number | string)[] >1 : number >2 : number >"3" : string diff --git a/tests/baselines/reference/targetTypeTest3.errors.txt b/tests/baselines/reference/targetTypeTest3.errors.txt index f5dab732ed346..935a9b9e68eb5 100644 --- a/tests/baselines/reference/targetTypeTest3.errors.txt +++ b/tests/baselines/reference/targetTypeTest3.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/targetTypeTest3.ts(4,5): error TS2322: Type '(string | number)[]' is not assignable to type 'string[]'. - Type 'string | number' is not assignable to type 'string'. +tests/cases/compiler/targetTypeTest3.ts(4,5): error TS2322: Type '(number | string)[]' is not assignable to type 'string[]'. + Type 'number | string' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. @@ -9,8 +9,8 @@ tests/cases/compiler/targetTypeTest3.ts(4,5): error TS2322: Type '(string | numb var a : string[] = [1,2,"3"]; // should produce an error ~ -!!! error TS2322: Type '(string | number)[]' is not assignable to type 'string[]'. -!!! error TS2322: Type 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type '(number | string)[]' is not assignable to type 'string[]'. +!!! error TS2322: Type 'number | string' is not assignable to type 'string'. !!! error TS2322: Type 'number' is not assignable to type 'string'. diff --git a/tests/baselines/reference/templateStringInArray.types b/tests/baselines/reference/templateStringInArray.types index 04cc09a1005e7..aec30c02e002a 100644 --- a/tests/baselines/reference/templateStringInArray.types +++ b/tests/baselines/reference/templateStringInArray.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/templates/templateStringInArray.ts === var x = [1, 2, `abc${ 123 }def`]; ->x : (string | number)[] ->[1, 2, `abc${ 123 }def`] : (string | number)[] +>x : (number | string)[] +>[1, 2, `abc${ 123 }def`] : (number | string)[] >1 : number >2 : number >`abc${ 123 }def` : string diff --git a/tests/baselines/reference/templateStringWithEmbeddedConditional.types b/tests/baselines/reference/templateStringWithEmbeddedConditional.types index 7ec1ef97a3015..2a741dc271b10 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedConditional.types +++ b/tests/baselines/reference/templateStringWithEmbeddedConditional.types @@ -2,7 +2,7 @@ var x = `abc${ true ? false : " " }def`; >x : string >`abc${ true ? false : " " }def` : string ->true ? false : " " : string | boolean +>true ? false : " " : boolean | string >true : boolean >false : boolean >" " : string diff --git a/tests/baselines/reference/templateStringWithEmbeddedConditionalES6.types b/tests/baselines/reference/templateStringWithEmbeddedConditionalES6.types index 5453880ce16d1..d0a228ee6735f 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedConditionalES6.types +++ b/tests/baselines/reference/templateStringWithEmbeddedConditionalES6.types @@ -2,7 +2,7 @@ var x = `abc${ true ? false : " " }def`; >x : string >`abc${ true ? false : " " }def` : string ->true ? false : " " : string | boolean +>true ? false : " " : boolean | string >true : boolean >false : boolean >" " : string diff --git a/tests/baselines/reference/trailingCommaInHeterogenousArrayLiteral1.errors.txt b/tests/baselines/reference/trailingCommaInHeterogenousArrayLiteral1.errors.txt index b502eaad7e58d..498e74ce35022 100644 --- a/tests/baselines/reference/trailingCommaInHeterogenousArrayLiteral1.errors.txt +++ b/tests/baselines/reference/trailingCommaInHeterogenousArrayLiteral1.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/trailingCommaInHeterogenousArrayLiteral1.ts(5,19): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. - Type 'string | number' is not assignable to type 'number'. +tests/cases/compiler/trailingCommaInHeterogenousArrayLiteral1.ts(5,19): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. + Type 'number | string' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. -tests/cases/compiler/trailingCommaInHeterogenousArrayLiteral1.ts(6,19): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. - Type 'string | number' is not assignable to type 'number'. +tests/cases/compiler/trailingCommaInHeterogenousArrayLiteral1.ts(6,19): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. + Type 'number | string' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. @@ -13,13 +13,13 @@ tests/cases/compiler/trailingCommaInHeterogenousArrayLiteral1.ts(6,19): error TS // these two should give the same error this.test([1, 2, "hi", 5, ]); ~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. -!!! error TS2345: Type 'string | number' is not assignable to type 'number'. +!!! error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. +!!! error TS2345: Type 'number | string' is not assignable to type 'number'. !!! error TS2345: Type 'string' is not assignable to type 'number'. this.test([1, 2, "hi", 5]); ~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. -!!! error TS2345: Type 'string | number' is not assignable to type 'number'. +!!! error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. +!!! error TS2345: Type 'number | string' is not assignable to type 'number'. !!! error TS2345: Type 'string' is not assignable to type 'number'. } } diff --git a/tests/baselines/reference/tsxAttributeResolution9.symbols b/tests/baselines/reference/tsxAttributeResolution9.symbols deleted file mode 100644 index 081482d5d47a4..0000000000000 --- a/tests/baselines/reference/tsxAttributeResolution9.symbols +++ /dev/null @@ -1,47 +0,0 @@ -=== tests/cases/conformance/jsx/react.d.ts === - -declare module JSX { ->JSX : Symbol(JSX, Decl(react.d.ts, 0, 0)) - - interface Element { } ->Element : Symbol(Element, Decl(react.d.ts, 1, 20)) - - interface IntrinsicElements { ->IntrinsicElements : Symbol(IntrinsicElements, Decl(react.d.ts, 2, 22)) - } - interface ElementAttributesProperty { ->ElementAttributesProperty : Symbol(ElementAttributesProperty, Decl(react.d.ts, 4, 2)) - - props; ->props : Symbol(props, Decl(react.d.ts, 5, 38)) - } -} - -interface Props { ->Props : Symbol(Props, Decl(react.d.ts, 8, 1)) - - foo: string; ->foo : Symbol(foo, Decl(react.d.ts, 10, 17)) -} - -=== tests/cases/conformance/jsx/file.tsx === -export class MyComponent { ->MyComponent : Symbol(MyComponent, Decl(file.tsx, 0, 0)) - - render() { ->render : Symbol(render, Decl(file.tsx, 0, 26)) - } - - props: { foo: string; } ->props : Symbol(props, Decl(file.tsx, 2, 3)) ->foo : Symbol(foo, Decl(file.tsx, 4, 10)) -} - -; // ok ->MyComponent : Symbol(MyComponent, Decl(file.tsx, 0, 0)) ->foo : Symbol(unknown) - -; // should be an error ->MyComponent : Symbol(MyComponent, Decl(file.tsx, 0, 0)) ->foo : Symbol(unknown) - diff --git a/tests/baselines/reference/tsxAttributeResolution9.types b/tests/baselines/reference/tsxAttributeResolution9.types deleted file mode 100644 index 1b2c6d423896a..0000000000000 --- a/tests/baselines/reference/tsxAttributeResolution9.types +++ /dev/null @@ -1,49 +0,0 @@ -=== tests/cases/conformance/jsx/react.d.ts === - -declare module JSX { ->JSX : any - - interface Element { } ->Element : Element - - interface IntrinsicElements { ->IntrinsicElements : IntrinsicElements - } - interface ElementAttributesProperty { ->ElementAttributesProperty : ElementAttributesProperty - - props; ->props : any - } -} - -interface Props { ->Props : Props - - foo: string; ->foo : string -} - -=== tests/cases/conformance/jsx/file.tsx === -export class MyComponent { ->MyComponent : MyComponent - - render() { ->render : () => void - } - - props: { foo: string; } ->props : { foo: string; } ->foo : string -} - -; // ok -> : JSX.Element ->MyComponent : typeof MyComponent ->foo : any - -; // should be an error -> : JSX.Element ->MyComponent : typeof MyComponent ->foo : any - diff --git a/tests/baselines/reference/tsxElementResolution9.errors.txt b/tests/baselines/reference/tsxElementResolution9.errors.txt index f4412719b33b3..64514eebc005f 100644 --- a/tests/baselines/reference/tsxElementResolution9.errors.txt +++ b/tests/baselines/reference/tsxElementResolution9.errors.txt @@ -1,8 +1,9 @@ tests/cases/conformance/jsx/tsxElementResolution9.tsx(11,2): error TS2601: The return type of a JSX element constructor must return an object type. tests/cases/conformance/jsx/tsxElementResolution9.tsx(18,2): error TS2601: The return type of a JSX element constructor must return an object type. +tests/cases/conformance/jsx/tsxElementResolution9.tsx(25,2): error TS2601: The return type of a JSX element constructor must return an object type. -==== tests/cases/conformance/jsx/tsxElementResolution9.tsx (2 errors) ==== +==== tests/cases/conformance/jsx/tsxElementResolution9.tsx (3 errors) ==== declare module JSX { interface Element { } interface IntrinsicElements { } @@ -32,4 +33,6 @@ tests/cases/conformance/jsx/tsxElementResolution9.tsx(18,2): error TS2601: The r } var Obj3: Obj3; ; // OK + ~~~~ +!!! error TS2601: The return type of a JSX element constructor must return an object type. \ No newline at end of file diff --git a/tests/baselines/reference/tupleTypes.errors.txt b/tests/baselines/reference/tupleTypes.errors.txt index d1257be13ef95..8f418f9815761 100644 --- a/tests/baselines/reference/tupleTypes.errors.txt +++ b/tests/baselines/reference/tupleTypes.errors.txt @@ -9,13 +9,14 @@ tests/cases/compiler/tupleTypes.ts(17,1): error TS2322: Type '[string, number]' tests/cases/compiler/tupleTypes.ts(41,1): error TS2322: Type 'undefined[]' is not assignable to type '[number, string]'. tests/cases/compiler/tupleTypes.ts(47,1): error TS2322: Type '[number, string]' is not assignable to type 'number[]'. Types of property 'pop' are incompatible. - Type '() => string | number' is not assignable to type '() => number'. - Type 'string | number' is not assignable to type 'number'. + Type '() => number | string' is not assignable to type '() => number'. + Type 'number | string' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/tupleTypes.ts(49,1): error TS2322: Type '[number, {}]' is not assignable to type 'number[]'. Types of property 'pop' are incompatible. - Type '() => {}' is not assignable to type '() => number'. - Type '{}' is not assignable to type 'number'. + Type '() => number | {}' is not assignable to type '() => number'. + Type 'number | {}' is not assignable to type 'number'. + Type '{}' is not assignable to type 'number'. tests/cases/compiler/tupleTypes.ts(50,1): error TS2322: Type '[number, number]' is not assignable to type '[number, string]'. Types of property '1' are incompatible. Type 'number' is not assignable to type 'string'. @@ -89,16 +90,17 @@ tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is n ~ !!! error TS2322: Type '[number, string]' is not assignable to type 'number[]'. !!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => string | number' is not assignable to type '() => number'. -!!! error TS2322: Type 'string | number' is not assignable to type 'number'. +!!! error TS2322: Type '() => number | string' is not assignable to type '() => number'. +!!! error TS2322: Type 'number | string' is not assignable to type 'number'. !!! error TS2322: Type 'string' is not assignable to type 'number'. a = a2; a = a3; // Error ~ !!! error TS2322: Type '[number, {}]' is not assignable to type 'number[]'. !!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => {}' is not assignable to type '() => number'. -!!! error TS2322: Type '{}' is not assignable to type 'number'. +!!! error TS2322: Type '() => number | {}' is not assignable to type '() => number'. +!!! error TS2322: Type 'number | {}' is not assignable to type 'number'. +!!! error TS2322: Type '{}' is not assignable to type 'number'. a1 = a2; // Error ~~ !!! error TS2322: Type '[number, number]' is not assignable to type '[number, string]'. diff --git a/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.types b/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.types index 45ddf8cd949a4..eb0fcdcbbcae6 100644 --- a/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.types +++ b/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.types @@ -4,7 +4,7 @@ declare module m { // type alias declaration here shouldnt make the module declaration instantiated type Selector = string| string[] |Function; ->Selector : string | Function | string[] +>Selector : string | string[] | Function >Function : Function export interface IStatic { diff --git a/tests/baselines/reference/typeArgInference2.errors.txt b/tests/baselines/reference/typeArgInference2.errors.txt index dd2e227f2ff0f..71d2a13f4a1af 100644 --- a/tests/baselines/reference/typeArgInference2.errors.txt +++ b/tests/baselines/reference/typeArgInference2.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/typeArgInference2.ts(12,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate '{ name: string; a: number; }' is not a valid type argument because it is not a supertype of candidate '{ name: string; b: number; }'. - Property 'a' is missing in type '{ name: string; b: number; }'. + Object literal may only specify known properties, and 'b' does not exist in type '{ name: string; a: number; }'. ==== tests/cases/compiler/typeArgInference2.ts (1 errors) ==== @@ -19,4 +19,4 @@ tests/cases/compiler/typeArgInference2.ts(12,10): error TS2453: The type argumen ~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate '{ name: string; a: number; }' is not a valid type argument because it is not a supertype of candidate '{ name: string; b: number; }'. -!!! error TS2453: Property 'a' is missing in type '{ name: string; b: number; }'. \ No newline at end of file +!!! error TS2453: Object literal may only specify known properties, and 'b' does not exist in type '{ name: string; a: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentInference.errors.txt b/tests/baselines/reference/typeArgumentInference.errors.txt index 126fe3d772fe7..669ebadd28ab6 100644 --- a/tests/baselines/reference/typeArgumentInference.errors.txt +++ b/tests/baselines/reference/typeArgumentInference.errors.txt @@ -2,10 +2,12 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(68,11 Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. - Property 'z' is missing in type '{ x: number; y: string; }'. + Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; z: Date; }'. +tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(84,66): error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'. + Object literal may only specify known properties, and 'y' does not exist in type 'A92'. -==== tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts (2 errors) ==== +==== tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts (3 errors) ==== // Generic call with no parameters function noParams() { } noParams(); @@ -94,9 +96,12 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11 ~~~~~~~~~~~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. -!!! error TS2453: Property 'z' is missing in type '{ x: number; y: string; }'. +!!! error TS2453: Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; z: Date; }'. var a9e: {}; var a9f = someGenerics9(undefined, { x: 6, z: new Date() }, { x: 6, y: '' }); + ~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'. +!!! error TS2345: Object literal may only specify known properties, and 'y' does not exist in type 'A92'. var a9f: A92; // Generic call with multiple parameters of generic type passed arguments with a single best common type diff --git a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt index c82dab89e945e..305eee1c941c2 100644 --- a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt @@ -14,12 +14,14 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(118,9): error TS2304: Cannot find name 'Window'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(120,15): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. - Property 'z' is missing in type '{ x: number; y: string; }'. + Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; z: any; }'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(120,51): error TS2304: Cannot find name 'window'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(122,56): error TS2304: Cannot find name 'window'. +tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(122,66): error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'. + Object literal may only specify known properties, and 'y' does not exist in type 'A92'. -==== tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts (10 errors) ==== +==== tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts (11 errors) ==== // Generic call with no parameters interface NoParams { new (); @@ -164,13 +166,16 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct ~~~~~~~~~~~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. -!!! error TS2453: Property 'z' is missing in type '{ x: number; y: string; }'. +!!! error TS2453: Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; z: any; }'. ~~~~~~ !!! error TS2304: Cannot find name 'window'. var a9e: {}; var a9f = new someGenerics9(undefined, { x: 6, z: window }, { x: 6, y: '' }); ~~~~~~ !!! error TS2304: Cannot find name 'window'. + ~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'. +!!! error TS2345: Object literal may only specify known properties, and 'y' does not exist in type 'A92'. var a9f: A92; // Generic call with multiple parameters of generic type passed arguments with a single best common type diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt b/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt index 56370ac03d58a..6b81cd6f23290 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt @@ -19,12 +19,14 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(85,9): error TS2304: Cannot find name 'Window'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(87,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. - Property 'z' is missing in type '{ x: number; y: string; }'. + Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; z: any; }'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(87,47): error TS2304: Cannot find name 'window'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(89,52): error TS2304: Cannot find name 'window'. +tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(89,62): error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'. + Object literal may only specify known properties, and 'y' does not exist in type 'A92'. -==== tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts (15 errors) ==== +==== tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts (16 errors) ==== // Generic call with no parameters function noParams() { } noParams(); @@ -146,13 +148,16 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst ~~~~~~~~~~~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. -!!! error TS2453: Property 'z' is missing in type '{ x: number; y: string; }'. +!!! error TS2453: Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; z: any; }'. ~~~~~~ !!! error TS2304: Cannot find name 'window'. var a9e: {}; var a9f = someGenerics9(undefined, { x: 6, z: window }, { x: 6, y: '' }); ~~~~~~ !!! error TS2304: Cannot find name 'window'. + ~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'. +!!! error TS2345: Object literal may only specify known properties, and 'y' does not exist in type 'A92'. var a9f: A92; // Generic call with multiple parameters of generic type passed arguments with a single best common type diff --git a/tests/baselines/reference/typeGuardFunction.types b/tests/baselines/reference/typeGuardFunction.types index 6cc278f122f8c..50a5fcaf32411 100644 --- a/tests/baselines/reference/typeGuardFunction.types +++ b/tests/baselines/reference/typeGuardFunction.types @@ -216,7 +216,7 @@ acceptingTypeGuardFunction(isA); // Binary expressions let union2: C | B; ->union2 : B | C +>union2 : C | B >C : C >B : B @@ -226,6 +226,6 @@ let union3: boolean | B = isA(union2) || union2; >isA(union2) || union2 : boolean | B >isA(union2) : boolean >isA : (p1: any) => p1 is A ->union2 : B | C +>union2 : C | B >union2 : B diff --git a/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.types b/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.types index 6714ecf557097..10f50bed52e94 100644 --- a/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.types +++ b/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.types @@ -26,7 +26,7 @@ var c: C; >C : C var cOrBool: C| boolean; ->cOrBool : boolean | C +>cOrBool : C | boolean >C : C var strOrNumOrBoolOrC: string | number | boolean | C; @@ -108,7 +108,7 @@ if (typeof strOrNumOrBoolOrC !== "string" && typeof strOrNumOrBoolOrC !== "numbe cOrBool = strOrNumOrBoolOrC; // C | boolean >cOrBool = strOrNumOrBoolOrC : boolean | C ->cOrBool : boolean | C +>cOrBool : C | boolean >strOrNumOrBoolOrC : boolean | C bool = strOrNumOrBool; // boolean diff --git a/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.types b/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.types index 2cad437ddeb63..acd929a7ca118 100644 --- a/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.types +++ b/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.types @@ -26,7 +26,7 @@ var c: C; >C : C var cOrBool: C| boolean; ->cOrBool : boolean | C +>cOrBool : C | boolean >C : C var strOrNumOrBoolOrC: string | number | boolean | C; @@ -118,7 +118,7 @@ if (typeof strOrNumOrBoolOrC === "string" || typeof strOrNumOrBoolOrC === "numbe else { cOrBool = strOrNumOrBoolOrC; // C | boolean >cOrBool = strOrNumOrBoolOrC : boolean | C ->cOrBool : boolean | C +>cOrBool : C | boolean >strOrNumOrBoolOrC : boolean | C bool = strOrNumOrBool; // boolean diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOf.types b/tests/baselines/reference/typeGuardOfFormInstanceOf.types index 891e8c1bea276..c824e907733f2 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOf.types +++ b/tests/baselines/reference/typeGuardOfFormInstanceOf.types @@ -121,7 +121,7 @@ str = c2Ord1 instanceof D1 && c2Ord1.p1; // D1 >p1 : string var r2: D1 | C2 = c2Ord1 instanceof C1 && c2Ord1; // C2 | D1 ->r2 : C2 | D1 +>r2 : D1 | C2 >D1 : D1 >C2 : C2 >c2Ord1 instanceof C1 && c2Ord1 : D1 diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.types b/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.types index fe23d6d303e6f..20d1c1644fcd7 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.types +++ b/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.types @@ -151,7 +151,7 @@ str = c2Ord1 instanceof d1 && c2Ord1.p1; // D1 >p1 : string var r2: D1 | C2 = c2Ord1 instanceof c1 && c2Ord1; // C2 | D1 ->r2 : C2 | D1 +>r2 : D1 | C2 >D1 : D1 >C2 : C2 >c2Ord1 instanceof c1 && c2Ord1 : D1 diff --git a/tests/baselines/reference/typeGuardsDefeat.types b/tests/baselines/reference/typeGuardsDefeat.types index d3a017bd913c3..cc655d3ce0f36 100644 --- a/tests/baselines/reference/typeGuardsDefeat.types +++ b/tests/baselines/reference/typeGuardsDefeat.types @@ -2,21 +2,21 @@ // Also note that it is possible to defeat a type guard by calling a function that changes the // type of the guarded variable. function foo(x: number | string) { ->foo : (x: string | number) => number ->x : string | number +>foo : (x: number | string) => number +>x : number | string function f() { >f : () => void x = 10; >x = 10 : number ->x : string | number +>x : number | string >10 : number } if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : string | number +>x : number | string >"string" : string f(); @@ -35,13 +35,13 @@ function foo(x: number | string) { } } function foo2(x: number | string) { ->foo2 : (x: string | number) => number ->x : string | number +>foo2 : (x: number | string) => number +>x : number | string if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : string | number +>x : number | string >"string" : string return x.length; // string @@ -63,7 +63,7 @@ function foo2(x: number | string) { } x = "hello"; >x = "hello" : string ->x : string | number +>x : number | string >"hello" : string f(); @@ -71,13 +71,13 @@ function foo2(x: number | string) { >f : () => number } function foo3(x: number | string) { ->foo3 : (x: string | number) => number ->x : string | number +>foo3 : (x: number | string) => number +>x : number | string if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : string | number +>x : number | string >"string" : string return x.length; // string @@ -95,7 +95,7 @@ function foo3(x: number | string) { } x = "hello"; >x = "hello" : string ->x : string | number +>x : number | string >"hello" : string f(); diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.errors.txt b/tests/baselines/reference/typeGuardsInConditionalExpression.errors.txt new file mode 100644 index 0000000000000..37a662e007c0e --- /dev/null +++ b/tests/baselines/reference/typeGuardsInConditionalExpression.errors.txt @@ -0,0 +1,103 @@ +tests/cases/conformance/expressions/typeGuards/typeGuardsInConditionalExpression.ts(93,22): error TS2349: Cannot invoke an expression whose type lacks a call signature. + + +==== tests/cases/conformance/expressions/typeGuards/typeGuardsInConditionalExpression.ts (1 errors) ==== + // In the true expression of a conditional expression, + // the type of a variable or parameter is narrowed by any type guard in the condition when true, + // provided the true expression contains no assignments to the variable or parameter. + // In the false expression of a conditional expression, + // the type of a variable or parameter is narrowed by any type guard in the condition when false, + // provided the false expression contains no assignments to the variable or parameter. + + function foo(x: number | string) { + return typeof x === "string" + ? x.length // string + : x++; // number + } + function foo2(x: number | string) { + // x is assigned in the if true branch, the type is not narrowed + return typeof x === "string" + ? (x = 10 && x)// string | number + : x; // string | number + } + function foo3(x: number | string) { + // x is assigned in the if false branch, the type is not narrowed + // even though assigned using same type as narrowed expression + return typeof x === "string" + ? (x = "Hello" && x) // string | number + : x; // string | number + } + function foo4(x: number | string) { + // false branch updates the variable - so here it is not number + // even though assigned using same type as narrowed expression + return typeof x === "string" + ? x // string | number + : (x = 10 && x); // string | number + } + function foo5(x: number | string) { + // false branch updates the variable - so here it is not number + return typeof x === "string" + ? x // string | number + : (x = "hello" && x); // string | number + } + function foo6(x: number | string) { + // Modify in both branches + return typeof x === "string" + ? (x = 10 && x) // string | number + : (x = "hello" && x); // string | number + } + function foo7(x: number | string | boolean) { + return typeof x === "string" + ? x === "hello" // string + : typeof x === "boolean" + ? x // boolean + : x == 10; // number + } + function foo8(x: number | string | boolean) { + var b: number | boolean; + return typeof x === "string" + ? x === "hello" + : ((b = x) && // number | boolean + (typeof x === "boolean" + ? x // boolean + : x == 10)); // number + } + function foo9(x: number | string) { + var y = 10; + // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop + return typeof x === "string" + ? ((y = x.length) && x === "hello") // string + : x === 10; // number + } + function foo10(x: number | string | boolean) { + // Mixing typeguards + var b: boolean | number; + return typeof x === "string" + ? x // string + : ((b = x) // x is number | boolean + && typeof x === "number" + && x.toString()); // x is number + } + function foo11(x: number | string | boolean) { + // Mixing typeguards + // Assigning value to x deep inside another guard stops narrowing of type too + var b: number | boolean | string; + return typeof x === "string" + ? x // number | boolean | string - changed in the false branch + : ((b = x) // x is number | boolean | string - because the assignment changed it + && typeof x === "number" + && (x = 10) // assignment to x + && x); // x is number | boolean | string + } + function foo12(x: number | string | boolean) { + // Mixing typeguards + // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression + var b: number | boolean | string; + return typeof x === "string" + ? (x = 10 && x.toString().length) // number | boolean | string - changed here + ~~~~~~~~~~~~ +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. + : ((b = x) // x is number | boolean | string - changed in true branch + && typeof x === "number" + && x); // x is number + } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.symbols b/tests/baselines/reference/typeGuardsInConditionalExpression.symbols deleted file mode 100644 index 2a7eb47523f90..0000000000000 --- a/tests/baselines/reference/typeGuardsInConditionalExpression.symbols +++ /dev/null @@ -1,251 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardsInConditionalExpression.ts === -// In the true expression of a conditional expression, -// the type of a variable or parameter is narrowed by any type guard in the condition when true, -// provided the true expression contains no assignments to the variable or parameter. -// In the false expression of a conditional expression, -// the type of a variable or parameter is narrowed by any type guard in the condition when false, -// provided the false expression contains no assignments to the variable or parameter. - -function foo(x: number | string) { ->foo : Symbol(foo, Decl(typeGuardsInConditionalExpression.ts, 0, 0)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 7, 13)) - - return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 7, 13)) - - ? x.length // string ->x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 7, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) - - : x++; // number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 7, 13)) -} -function foo2(x: number | string) { ->foo2 : Symbol(foo2, Decl(typeGuardsInConditionalExpression.ts, 11, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 12, 14)) - - // x is assigned in the if true branch, the type is not narrowed - return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 12, 14)) - - ? (x = 10 && x)// string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 12, 14)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 12, 14)) - - : x; // string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 12, 14)) -} -function foo3(x: number | string) { ->foo3 : Symbol(foo3, Decl(typeGuardsInConditionalExpression.ts, 17, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 18, 14)) - - // x is assigned in the if false branch, the type is not narrowed - // even though assigned using same type as narrowed expression - return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 18, 14)) - - ? (x = "Hello" && x) // string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 18, 14)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 18, 14)) - - : x; // string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 18, 14)) -} -function foo4(x: number | string) { ->foo4 : Symbol(foo4, Decl(typeGuardsInConditionalExpression.ts, 24, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 25, 14)) - - // false branch updates the variable - so here it is not number - // even though assigned using same type as narrowed expression - return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 25, 14)) - - ? x // string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 25, 14)) - - : (x = 10 && x); // string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 25, 14)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 25, 14)) -} -function foo5(x: number | string) { ->foo5 : Symbol(foo5, Decl(typeGuardsInConditionalExpression.ts, 31, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) - - // false branch updates the variable - so here it is not number - return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) - - ? x // string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) - - : (x = "hello" && x); // string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) -} -function foo6(x: number | string) { ->foo6 : Symbol(foo6, Decl(typeGuardsInConditionalExpression.ts, 37, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) - - // Modify in both branches - return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) - - ? (x = 10 && x) // string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) - - : (x = "hello" && x); // string | number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) -} -function foo7(x: number | string | boolean) { ->foo7 : Symbol(foo7, Decl(typeGuardsInConditionalExpression.ts, 43, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) - - return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) - - ? x === "hello" // string ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) - - : typeof x === "boolean" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) - - ? x // boolean ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) - - : x == 10; // number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) -} -function foo8(x: number | string | boolean) { ->foo8 : Symbol(foo8, Decl(typeGuardsInConditionalExpression.ts, 50, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) - - var b: number | boolean; ->b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 52, 7)) - - return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) - - ? x === "hello" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) - - : ((b = x) && // number | boolean ->b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 52, 7)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) - - (typeof x === "boolean" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) - - ? x // boolean ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) - - : x == 10)); // number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) -} -function foo9(x: number | string) { ->foo9 : Symbol(foo9, Decl(typeGuardsInConditionalExpression.ts, 59, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 60, 14)) - - var y = 10; ->y : Symbol(y, Decl(typeGuardsInConditionalExpression.ts, 61, 7)) - - // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop - return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 60, 14)) - - ? ((y = x.length) && x === "hello") // string ->y : Symbol(y, Decl(typeGuardsInConditionalExpression.ts, 61, 7)) ->x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 60, 14)) ->length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 60, 14)) - - : x === 10; // number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 60, 14)) -} -function foo10(x: number | string | boolean) { ->foo10 : Symbol(foo10, Decl(typeGuardsInConditionalExpression.ts, 66, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) - - // Mixing typeguards - var b: boolean | number; ->b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 69, 7)) - - return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) - - ? x // string ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) - - : ((b = x) // x is number | boolean ->b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 69, 7)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) - - && typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) - - && x.toString()); // x is number ->x.toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) ->toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18)) -} -function foo11(x: number | string | boolean) { ->foo11 : Symbol(foo11, Decl(typeGuardsInConditionalExpression.ts, 75, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) - - // Mixing typeguards - // Assigning value to x deep inside another guard stops narrowing of type too - var b: number | boolean | string; ->b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 79, 7)) - - return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) - - ? x // number | boolean | string - changed in the false branch ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) - - : ((b = x) // x is number | boolean | string - because the assignment changed it ->b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 79, 7)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) - - && typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) - - && (x = 10) // assignment to x ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) - - && x); // x is number | boolean | string ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) -} -function foo12(x: number | string | boolean) { ->foo12 : Symbol(foo12, Decl(typeGuardsInConditionalExpression.ts, 86, 1)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) - - // Mixing typeguards - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - var b: number | boolean | string; ->b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 90, 7)) - - return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) - - ? (x = 10 && x.toString().length) // number | boolean | string - changed here ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) ->x.toString().length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) ->x.toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 96, 26)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) ->toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 96, 26)) ->length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) - - : ((b = x) // x is number | boolean | string - changed in true branch ->b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 90, 7)) ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) - - && typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) - - && x); // x is number ->x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) -} diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.types b/tests/baselines/reference/typeGuardsInConditionalExpression.types deleted file mode 100644 index 3965abfe9621f..0000000000000 --- a/tests/baselines/reference/typeGuardsInConditionalExpression.types +++ /dev/null @@ -1,388 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardsInConditionalExpression.ts === -// In the true expression of a conditional expression, -// the type of a variable or parameter is narrowed by any type guard in the condition when true, -// provided the true expression contains no assignments to the variable or parameter. -// In the false expression of a conditional expression, -// the type of a variable or parameter is narrowed by any type guard in the condition when false, -// provided the false expression contains no assignments to the variable or parameter. - -function foo(x: number | string) { ->foo : (x: string | number) => number ->x : string | number - - return typeof x === "string" ->typeof x === "string" ? x.length // string : x++ : number ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string - - ? x.length // string ->x.length : number ->x : string ->length : number - - : x++; // number ->x++ : number ->x : number -} -function foo2(x: number | string) { ->foo2 : (x: string | number) => string | number ->x : string | number - - // x is assigned in the if true branch, the type is not narrowed - return typeof x === "string" ->typeof x === "string" ? (x = 10 && x)// string | number : x : string | number ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string - - ? (x = 10 && x)// string | number ->(x = 10 && x) : string | number ->x = 10 && x : string | number ->x : string | number ->10 && x : string | number ->10 : number ->x : string | number - - : x; // string | number ->x : string | number -} -function foo3(x: number | string) { ->foo3 : (x: string | number) => string | number ->x : string | number - - // x is assigned in the if false branch, the type is not narrowed - // even though assigned using same type as narrowed expression - return typeof x === "string" ->typeof x === "string" ? (x = "Hello" && x) // string | number : x : string | number ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string - - ? (x = "Hello" && x) // string | number ->(x = "Hello" && x) : string | number ->x = "Hello" && x : string | number ->x : string | number ->"Hello" && x : string | number ->"Hello" : string ->x : string | number - - : x; // string | number ->x : string | number -} -function foo4(x: number | string) { ->foo4 : (x: string | number) => string | number ->x : string | number - - // false branch updates the variable - so here it is not number - // even though assigned using same type as narrowed expression - return typeof x === "string" ->typeof x === "string" ? x // string | number : (x = 10 && x) : string | number ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string - - ? x // string | number ->x : string | number - - : (x = 10 && x); // string | number ->(x = 10 && x) : string | number ->x = 10 && x : string | number ->x : string | number ->10 && x : string | number ->10 : number ->x : string | number -} -function foo5(x: number | string) { ->foo5 : (x: string | number) => string | number ->x : string | number - - // false branch updates the variable - so here it is not number - return typeof x === "string" ->typeof x === "string" ? x // string | number : (x = "hello" && x) : string | number ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string - - ? x // string | number ->x : string | number - - : (x = "hello" && x); // string | number ->(x = "hello" && x) : string | number ->x = "hello" && x : string | number ->x : string | number ->"hello" && x : string | number ->"hello" : string ->x : string | number -} -function foo6(x: number | string) { ->foo6 : (x: string | number) => string | number ->x : string | number - - // Modify in both branches - return typeof x === "string" ->typeof x === "string" ? (x = 10 && x) // string | number : (x = "hello" && x) : string | number ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string - - ? (x = 10 && x) // string | number ->(x = 10 && x) : string | number ->x = 10 && x : string | number ->x : string | number ->10 && x : string | number ->10 : number ->x : string | number - - : (x = "hello" && x); // string | number ->(x = "hello" && x) : string | number ->x = "hello" && x : string | number ->x : string | number ->"hello" && x : string | number ->"hello" : string ->x : string | number -} -function foo7(x: number | string | boolean) { ->foo7 : (x: string | number | boolean) => boolean ->x : string | number | boolean - - return typeof x === "string" ->typeof x === "string" ? x === "hello" // string : typeof x === "boolean" ? x // boolean : x == 10 : boolean ->typeof x === "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - ? x === "hello" // string ->x === "hello" : boolean ->x : string ->"hello" : string - - : typeof x === "boolean" ->typeof x === "boolean" ? x // boolean : x == 10 : boolean ->typeof x === "boolean" : boolean ->typeof x : string ->x : number | boolean ->"boolean" : string - - ? x // boolean ->x : boolean - - : x == 10; // number ->x == 10 : boolean ->x : number ->10 : number -} -function foo8(x: number | string | boolean) { ->foo8 : (x: string | number | boolean) => boolean ->x : string | number | boolean - - var b: number | boolean; ->b : number | boolean - - return typeof x === "string" ->typeof x === "string" ? x === "hello" : ((b = x) && // number | boolean (typeof x === "boolean" ? x // boolean : x == 10)) : boolean ->typeof x === "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - ? x === "hello" ->x === "hello" : boolean ->x : string ->"hello" : string - - : ((b = x) && // number | boolean ->((b = x) && // number | boolean (typeof x === "boolean" ? x // boolean : x == 10)) : boolean ->(b = x) && // number | boolean (typeof x === "boolean" ? x // boolean : x == 10) : boolean ->(b = x) : number | boolean ->b = x : number | boolean ->b : number | boolean ->x : number | boolean - - (typeof x === "boolean" ->(typeof x === "boolean" ? x // boolean : x == 10) : boolean ->typeof x === "boolean" ? x // boolean : x == 10 : boolean ->typeof x === "boolean" : boolean ->typeof x : string ->x : number | boolean ->"boolean" : string - - ? x // boolean ->x : boolean - - : x == 10)); // number ->x == 10 : boolean ->x : number ->10 : number -} -function foo9(x: number | string) { ->foo9 : (x: string | number) => boolean ->x : string | number - - var y = 10; ->y : number ->10 : number - - // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop - return typeof x === "string" ->typeof x === "string" ? ((y = x.length) && x === "hello") // string : x === 10 : boolean ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string - - ? ((y = x.length) && x === "hello") // string ->((y = x.length) && x === "hello") : boolean ->(y = x.length) && x === "hello" : boolean ->(y = x.length) : number ->y = x.length : number ->y : number ->x.length : number ->x : string ->length : number ->x === "hello" : boolean ->x : string ->"hello" : string - - : x === 10; // number ->x === 10 : boolean ->x : number ->10 : number -} -function foo10(x: number | string | boolean) { ->foo10 : (x: string | number | boolean) => string ->x : string | number | boolean - - // Mixing typeguards - var b: boolean | number; ->b : number | boolean - - return typeof x === "string" ->typeof x === "string" ? x // string : ((b = x) // x is number | boolean && typeof x === "number" && x.toString()) : string ->typeof x === "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - ? x // string ->x : string - - : ((b = x) // x is number | boolean ->((b = x) // x is number | boolean && typeof x === "number" && x.toString()) : string ->(b = x) // x is number | boolean && typeof x === "number" && x.toString() : string ->(b = x) // x is number | boolean && typeof x === "number" : boolean ->(b = x) : number | boolean ->b = x : number | boolean ->b : number | boolean ->x : number | boolean - - && typeof x === "number" ->typeof x === "number" : boolean ->typeof x : string ->x : number | boolean ->"number" : string - - && x.toString()); // x is number ->x.toString() : string ->x.toString : (radix?: number) => string ->x : number ->toString : (radix?: number) => string -} -function foo11(x: number | string | boolean) { ->foo11 : (x: string | number | boolean) => string | number | boolean ->x : string | number | boolean - - // Mixing typeguards - // Assigning value to x deep inside another guard stops narrowing of type too - var b: number | boolean | string; ->b : string | number | boolean - - return typeof x === "string" ->typeof x === "string" ? x // number | boolean | string - changed in the false branch : ((b = x) // x is number | boolean | string - because the assignment changed it && typeof x === "number" && (x = 10) // assignment to x && x) : string | number | boolean ->typeof x === "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - ? x // number | boolean | string - changed in the false branch ->x : string | number | boolean - - : ((b = x) // x is number | boolean | string - because the assignment changed it ->((b = x) // x is number | boolean | string - because the assignment changed it && typeof x === "number" && (x = 10) // assignment to x && x) : string | number | boolean ->(b = x) // x is number | boolean | string - because the assignment changed it && typeof x === "number" && (x = 10) // assignment to x && x : string | number | boolean ->(b = x) // x is number | boolean | string - because the assignment changed it && typeof x === "number" && (x = 10) : number ->(b = x) // x is number | boolean | string - because the assignment changed it && typeof x === "number" : boolean ->(b = x) : string | number | boolean ->b = x : string | number | boolean ->b : string | number | boolean ->x : string | number | boolean - - && typeof x === "number" ->typeof x === "number" : boolean ->typeof x : string ->x : string | number | boolean ->"number" : string - - && (x = 10) // assignment to x ->(x = 10) : number ->x = 10 : number ->x : string | number | boolean ->10 : number - - && x); // x is number | boolean | string ->x : string | number | boolean -} -function foo12(x: number | string | boolean) { ->foo12 : (x: string | number | boolean) => number ->x : string | number | boolean - - // Mixing typeguards - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - var b: number | boolean | string; ->b : string | number | boolean - - return typeof x === "string" ->typeof x === "string" ? (x = 10 && x.toString().length) // number | boolean | string - changed here : ((b = x) // x is number | boolean | string - changed in true branch && typeof x === "number" && x) : number ->typeof x === "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - ? (x = 10 && x.toString().length) // number | boolean | string - changed here ->(x = 10 && x.toString().length) : number ->x = 10 && x.toString().length : number ->x : string | number | boolean ->10 && x.toString().length : number ->10 : number ->x.toString().length : number ->x.toString() : string ->x.toString : (radix?: number) => string ->x : string | number | boolean ->toString : (radix?: number) => string ->length : number - - : ((b = x) // x is number | boolean | string - changed in true branch ->((b = x) // x is number | boolean | string - changed in true branch && typeof x === "number" && x) : number ->(b = x) // x is number | boolean | string - changed in true branch && typeof x === "number" && x : number ->(b = x) // x is number | boolean | string - changed in true branch && typeof x === "number" : boolean ->(b = x) : string | number | boolean ->b = x : string | number | boolean ->b : string | number | boolean ->x : string | number | boolean - - && typeof x === "number" ->typeof x === "number" : boolean ->typeof x : string ->x : string | number | boolean ->"number" : string - - && x); // x is number ->x : number -} diff --git a/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.types b/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.types index 600b272040420..0a084d6eb541d 100644 --- a/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.types +++ b/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.types @@ -2,14 +2,14 @@ // typeguards are scoped in function/module block function foo(x: number | string | boolean) { ->foo : (x: string | number | boolean) => string ->x : string | number | boolean +>foo : (x: number | string | boolean) => string +>x : number | string | boolean return typeof x === "string" >typeof x === "string" ? x : function f() { var b = x; // number | boolean return typeof x === "boolean" ? x.toString() // boolean : x.toString(); // number } () : string >typeof x === "string" : boolean >typeof x : string ->x : string | number | boolean +>x : number | string | boolean >"string" : string ? x @@ -46,14 +46,14 @@ function foo(x: number | string | boolean) { } (); } function foo2(x: number | string | boolean) { ->foo2 : (x: string | number | boolean) => string ->x : string | number | boolean +>foo2 : (x: number | string | boolean) => string +>x : number | string | boolean return typeof x === "string" >typeof x === "string" ? x : function f(a: number | boolean) { var b = x; // new scope - number | boolean return typeof x === "boolean" ? x.toString() // boolean : x.toString(); // number } (x) : string >typeof x === "string" : boolean >typeof x : string ->x : string | number | boolean +>x : number | string | boolean >"string" : string ? x @@ -92,14 +92,14 @@ function foo2(x: number | string | boolean) { >x : number | boolean } function foo3(x: number | string | boolean) { ->foo3 : (x: string | number | boolean) => string ->x : string | number | boolean +>foo3 : (x: number | string | boolean) => string +>x : number | string | boolean return typeof x === "string" >typeof x === "string" ? x : (() => { var b = x; // new scope - number | boolean return typeof x === "boolean" ? x.toString() // boolean : x.toString(); // number })() : string >typeof x === "string" : boolean >typeof x : string ->x : string | number | boolean +>x : number | string | boolean >"string" : string ? x @@ -136,14 +136,14 @@ function foo3(x: number | string | boolean) { })(); } function foo4(x: number | string | boolean) { ->foo4 : (x: string | number | boolean) => string ->x : string | number | boolean +>foo4 : (x: number | string | boolean) => string +>x : number | string | boolean return typeof x === "string" >typeof x === "string" ? x : ((a: number | boolean) => { var b = x; // new scope - number | boolean return typeof x === "boolean" ? x.toString() // boolean : x.toString(); // number })(x) : string >typeof x === "string" : boolean >typeof x : string ->x : string | number | boolean +>x : number | string | boolean >"string" : string ? x @@ -183,13 +183,13 @@ function foo4(x: number | string | boolean) { } // Type guards affect nested function expressions, but not nested function declarations function foo5(x: number | string | boolean) { ->foo5 : (x: string | number | boolean) => void ->x : string | number | boolean +>foo5 : (x: number | string | boolean) => void +>x : number | string | boolean if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : string | number | boolean +>x : number | string | boolean >"string" : string var y = x; // string; @@ -200,8 +200,8 @@ function foo5(x: number | string | boolean) { >foo : () => void var z = x; // number | string | boolean, type guard has no effect ->z : string | number | boolean ->x : string | number | boolean +>z : number | string | boolean +>x : number | string | boolean } } } @@ -209,14 +209,14 @@ module m { >m : typeof m var x: number | string | boolean; ->x : string | number | boolean +>x : number | string | boolean module m2 { >m2 : typeof m2 var b = x; // new scope - number | boolean | string ->b : string | number | boolean ->x : string | number | boolean +>b : number | string | boolean +>x : number | string | boolean var y: string; >y : string @@ -224,7 +224,7 @@ module m { if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : string | number | boolean +>x : number | string | boolean >"string" : string y = x // string; @@ -260,15 +260,15 @@ module m1 { >m1 : typeof m1 var x: number | string | boolean; ->x : string | number | boolean +>x : number | string | boolean module m2.m3 { >m2 : typeof m2 >m3 : typeof m3 var b = x; // new scope - number | boolean | string ->b : string | number | boolean ->x : string | number | boolean +>b : number | string | boolean +>x : number | string | boolean var y: string; >y : string @@ -276,7 +276,7 @@ module m1 { if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : string | number | boolean +>x : number | string | boolean >"string" : string y = x // string; diff --git a/tests/baselines/reference/typeGuardsInIfStatement.errors.txt b/tests/baselines/reference/typeGuardsInIfStatement.errors.txt new file mode 100644 index 0000000000000..e675daffd6e6c --- /dev/null +++ b/tests/baselines/reference/typeGuardsInIfStatement.errors.txt @@ -0,0 +1,160 @@ +tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(127,23): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(131,22): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(139,16): error TS2349: Cannot invoke an expression whose type lacks a call signature. + + +==== tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts (3 errors) ==== + // In the true branch statement of an �if� statement, + // the type of a variable or parameter is narrowed by any type guard in the �if� condition when true, + // provided the true branch statement contains no assignments to the variable or parameter. + // In the false branch statement of an �if� statement, + // the type of a variable or parameter is narrowed by any type guard in the �if� condition when false, + // provided the false branch statement contains no assignments to the variable or parameter + function foo(x: number | string) { + if (typeof x === "string") { + return x.length; // string + } + else { + return x++; // number + } + } + function foo2(x: number | string) { + // x is assigned in the if true branch, the type is not narrowed + if (typeof x === "string") { + x = 10; + return x; // string | number + } + else { + return x; // string | number + } + } + function foo3(x: number | string) { + // x is assigned in the if true branch, the type is not narrowed + if (typeof x === "string") { + x = "Hello"; // even though assigned using same type as narrowed expression + return x; // string | number + } + else { + return x; // string | number + } + } + function foo4(x: number | string) { + // false branch updates the variable - so here it is not number + if (typeof x === "string") { + return x; // string | number + } + else { + x = 10; // even though assigned number - this should result in x to be string | number + return x; // string | number + } + } + function foo5(x: number | string) { + // false branch updates the variable - so here it is not number + if (typeof x === "string") { + return x; // string | number + } + else { + x = "hello"; + return x; // string | number + } + } + function foo6(x: number | string) { + // Modify in both branches + if (typeof x === "string") { + x = 10; + return x; // string | number + } + else { + x = "hello"; + return x; // string | number + } + } + function foo7(x: number | string | boolean) { + if (typeof x === "string") { + return x === "hello"; // string + } + else if (typeof x === "boolean") { + return x; // boolean + } + else { + return x == 10; // number + } + } + function foo8(x: number | string | boolean) { + if (typeof x === "string") { + return x === "hello"; // string + } + else { + var b: number | boolean = x; // number | boolean + if (typeof x === "boolean") { + return x; // boolean + } + else { + return x == 10; // number + } + } + } + function foo9(x: number | string) { + var y = 10; + if (typeof x === "string") { + // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop + y = x.length; + return x === "hello"; // string + } + else { + return x == 10; // number + } + } + function foo10(x: number | string | boolean) { + // Mixing typeguard narrowing in if statement with conditional expression typeguard + if (typeof x === "string") { + return x === "hello"; // string + } + else { + var y: boolean | string; + var b = x; // number | boolean + return typeof x === "number" + ? x === 10 // number + : x; // x should be boolean + } + } + function foo11(x: number | string | boolean) { + // Mixing typeguard narrowing in if statement with conditional expression typeguard + // Assigning value to x deep inside another guard stops narrowing of type too + if (typeof x === "string") { + return x; // string | number | boolean - x changed in else branch + } + else { + var y: number| boolean | string; + var b = x; // number | boolean | string - because below we are changing value of x in if statement + return typeof x === "number" + ? ( + // change value of x + x = 10 && x.toString() // number | boolean | string + ~~~~~~~~~~~~ +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. + ) + : ( + // do not change value + y = x && x.toString() // number | boolean | string + ~~~~~~~~~~~~ +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. + ); + } + } + function foo12(x: number | string | boolean) { + // Mixing typeguard narrowing in if statement with conditional expression typeguard + // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression + if (typeof x === "string") { + return x.toString(); // string | number | boolean - x changed in else branch + ~~~~~~~~~~~~ +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. + } + else { + x = 10; + var b = x; // number | boolean | string + return typeof x === "number" + ? x.toString() // number + : x.toString(); // boolean | string + } + } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsInIfStatement.symbols b/tests/baselines/reference/typeGuardsInIfStatement.symbols deleted file mode 100644 index d81be08d1a0a3..0000000000000 --- a/tests/baselines/reference/typeGuardsInIfStatement.symbols +++ /dev/null @@ -1,304 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts === -// In the true branch statement of an �if� statement, -// the type of a variable or parameter is narrowed by any type guard in the �if� condition when true, -// provided the true branch statement contains no assignments to the variable or parameter. -// In the false branch statement of an �if� statement, -// the type of a variable or parameter is narrowed by any type guard in the �if� condition when false, -// provided the false branch statement contains no assignments to the variable or parameter -function foo(x: number | string) { ->foo : Symbol(foo, Decl(typeGuardsInIfStatement.ts, 0, 0)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 6, 13)) - - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 6, 13)) - - return x.length; // string ->x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 6, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) - } - else { - return x++; // number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 6, 13)) - } -} -function foo2(x: number | string) { ->foo2 : Symbol(foo2, Decl(typeGuardsInIfStatement.ts, 13, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 14, 14)) - - // x is assigned in the if true branch, the type is not narrowed - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 14, 14)) - - x = 10; ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 14, 14)) - - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 14, 14)) - } - else { - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 14, 14)) - } -} -function foo3(x: number | string) { ->foo3 : Symbol(foo3, Decl(typeGuardsInIfStatement.ts, 23, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 24, 14)) - - // x is assigned in the if true branch, the type is not narrowed - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 24, 14)) - - x = "Hello"; // even though assigned using same type as narrowed expression ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 24, 14)) - - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 24, 14)) - } - else { - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 24, 14)) - } -} -function foo4(x: number | string) { ->foo4 : Symbol(foo4, Decl(typeGuardsInIfStatement.ts, 33, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 34, 14)) - - // false branch updates the variable - so here it is not number - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 34, 14)) - - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 34, 14)) - } - else { - x = 10; // even though assigned number - this should result in x to be string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 34, 14)) - - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 34, 14)) - } -} -function foo5(x: number | string) { ->foo5 : Symbol(foo5, Decl(typeGuardsInIfStatement.ts, 43, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 44, 14)) - - // false branch updates the variable - so here it is not number - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 44, 14)) - - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 44, 14)) - } - else { - x = "hello"; ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 44, 14)) - - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 44, 14)) - } -} -function foo6(x: number | string) { ->foo6 : Symbol(foo6, Decl(typeGuardsInIfStatement.ts, 53, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) - - // Modify in both branches - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) - - x = 10; ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) - - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) - } - else { - x = "hello"; ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) - - return x; // string | number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) - } -} -function foo7(x: number | string | boolean) { ->foo7 : Symbol(foo7, Decl(typeGuardsInIfStatement.ts, 64, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) - - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) - - return x === "hello"; // string ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) - } - else if (typeof x === "boolean") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) - - return x; // boolean ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) - } - else { - return x == 10; // number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) - } -} -function foo8(x: number | string | boolean) { ->foo8 : Symbol(foo8, Decl(typeGuardsInIfStatement.ts, 75, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) - - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) - - return x === "hello"; // string ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) - } - else { - var b: number | boolean = x; // number | boolean ->b : Symbol(b, Decl(typeGuardsInIfStatement.ts, 81, 11)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) - - if (typeof x === "boolean") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) - - return x; // boolean ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) - } - else { - return x == 10; // number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) - } - } -} -function foo9(x: number | string) { ->foo9 : Symbol(foo9, Decl(typeGuardsInIfStatement.ts, 89, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 90, 14)) - - var y = 10; ->y : Symbol(y, Decl(typeGuardsInIfStatement.ts, 91, 7)) - - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 90, 14)) - - // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop - y = x.length; ->y : Symbol(y, Decl(typeGuardsInIfStatement.ts, 91, 7)) ->x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 90, 14)) ->length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) - - return x === "hello"; // string ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 90, 14)) - } - else { - return x == 10; // number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 90, 14)) - } -} -function foo10(x: number | string | boolean) { ->foo10 : Symbol(foo10, Decl(typeGuardsInIfStatement.ts, 100, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) - - // Mixing typeguard narrowing in if statement with conditional expression typeguard - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) - - return x === "hello"; // string ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) - } - else { - var y: boolean | string; ->y : Symbol(y, Decl(typeGuardsInIfStatement.ts, 107, 11)) - - var b = x; // number | boolean ->b : Symbol(b, Decl(typeGuardsInIfStatement.ts, 108, 11)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) - - return typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) - - ? x === 10 // number ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) - - : x; // x should be boolean ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) - } -} -function foo11(x: number | string | boolean) { ->foo11 : Symbol(foo11, Decl(typeGuardsInIfStatement.ts, 113, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) - - // Mixing typeguard narrowing in if statement with conditional expression typeguard - // Assigning value to x deep inside another guard stops narrowing of type too - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) - - return x; // string | number | boolean - x changed in else branch ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) - } - else { - var y: number| boolean | string; ->y : Symbol(y, Decl(typeGuardsInIfStatement.ts, 121, 11)) - - var b = x; // number | boolean | string - because below we are changing value of x in if statement ->b : Symbol(b, Decl(typeGuardsInIfStatement.ts, 122, 11)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) - - return typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) - - ? ( - // change value of x - x = 10 && x.toString() // number | boolean | string ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) ->x.toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 96, 26)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) ->toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 96, 26)) - - ) - : ( - // do not change value - y = x && x.toString() // number | boolean | string ->y : Symbol(y, Decl(typeGuardsInIfStatement.ts, 121, 11)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) ->x.toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 96, 26)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) ->toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 96, 26)) - - ); - } -} -function foo12(x: number | string | boolean) { ->foo12 : Symbol(foo12, Decl(typeGuardsInIfStatement.ts, 133, 1)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) - - // Mixing typeguard narrowing in if statement with conditional expression typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - if (typeof x === "string") { ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) - - return x.toString(); // string | number | boolean - x changed in else branch ->x.toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 96, 26)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) ->toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 96, 26)) - } - else { - x = 10; ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) - - var b = x; // number | boolean | string ->b : Symbol(b, Decl(typeGuardsInIfStatement.ts, 142, 11)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) - - return typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) - - ? x.toString() // number ->x.toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) ->toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18)) - - : x.toString(); // boolean | string ->x.toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) ->x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) ->toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) - } -} diff --git a/tests/baselines/reference/typeGuardsInIfStatement.types b/tests/baselines/reference/typeGuardsInIfStatement.types deleted file mode 100644 index 59a9ff512affa..0000000000000 --- a/tests/baselines/reference/typeGuardsInIfStatement.types +++ /dev/null @@ -1,405 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts === -// In the true branch statement of an �if� statement, -// the type of a variable or parameter is narrowed by any type guard in the �if� condition when true, -// provided the true branch statement contains no assignments to the variable or parameter. -// In the false branch statement of an �if� statement, -// the type of a variable or parameter is narrowed by any type guard in the �if� condition when false, -// provided the false branch statement contains no assignments to the variable or parameter -function foo(x: number | string) { ->foo : (x: string | number) => number ->x : string | number - - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string - - return x.length; // string ->x.length : number ->x : string ->length : number - } - else { - return x++; // number ->x++ : number ->x : number - } -} -function foo2(x: number | string) { ->foo2 : (x: string | number) => string | number ->x : string | number - - // x is assigned in the if true branch, the type is not narrowed - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string - - x = 10; ->x = 10 : number ->x : string | number ->10 : number - - return x; // string | number ->x : string | number - } - else { - return x; // string | number ->x : string | number - } -} -function foo3(x: number | string) { ->foo3 : (x: string | number) => string | number ->x : string | number - - // x is assigned in the if true branch, the type is not narrowed - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string - - x = "Hello"; // even though assigned using same type as narrowed expression ->x = "Hello" : string ->x : string | number ->"Hello" : string - - return x; // string | number ->x : string | number - } - else { - return x; // string | number ->x : string | number - } -} -function foo4(x: number | string) { ->foo4 : (x: string | number) => string | number ->x : string | number - - // false branch updates the variable - so here it is not number - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string - - return x; // string | number ->x : string | number - } - else { - x = 10; // even though assigned number - this should result in x to be string | number ->x = 10 : number ->x : string | number ->10 : number - - return x; // string | number ->x : string | number - } -} -function foo5(x: number | string) { ->foo5 : (x: string | number) => string | number ->x : string | number - - // false branch updates the variable - so here it is not number - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string - - return x; // string | number ->x : string | number - } - else { - x = "hello"; ->x = "hello" : string ->x : string | number ->"hello" : string - - return x; // string | number ->x : string | number - } -} -function foo6(x: number | string) { ->foo6 : (x: string | number) => string | number ->x : string | number - - // Modify in both branches - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string - - x = 10; ->x = 10 : number ->x : string | number ->10 : number - - return x; // string | number ->x : string | number - } - else { - x = "hello"; ->x = "hello" : string ->x : string | number ->"hello" : string - - return x; // string | number ->x : string | number - } -} -function foo7(x: number | string | boolean) { ->foo7 : (x: string | number | boolean) => boolean ->x : string | number | boolean - - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - return x === "hello"; // string ->x === "hello" : boolean ->x : string ->"hello" : string - } - else if (typeof x === "boolean") { ->typeof x === "boolean" : boolean ->typeof x : string ->x : number | boolean ->"boolean" : string - - return x; // boolean ->x : boolean - } - else { - return x == 10; // number ->x == 10 : boolean ->x : number ->10 : number - } -} -function foo8(x: number | string | boolean) { ->foo8 : (x: string | number | boolean) => boolean ->x : string | number | boolean - - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - return x === "hello"; // string ->x === "hello" : boolean ->x : string ->"hello" : string - } - else { - var b: number | boolean = x; // number | boolean ->b : number | boolean ->x : number | boolean - - if (typeof x === "boolean") { ->typeof x === "boolean" : boolean ->typeof x : string ->x : number | boolean ->"boolean" : string - - return x; // boolean ->x : boolean - } - else { - return x == 10; // number ->x == 10 : boolean ->x : number ->10 : number - } - } -} -function foo9(x: number | string) { ->foo9 : (x: string | number) => boolean ->x : string | number - - var y = 10; ->y : number ->10 : number - - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string - - // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop - y = x.length; ->y = x.length : number ->y : number ->x.length : number ->x : string ->length : number - - return x === "hello"; // string ->x === "hello" : boolean ->x : string ->"hello" : string - } - else { - return x == 10; // number ->x == 10 : boolean ->x : number ->10 : number - } -} -function foo10(x: number | string | boolean) { ->foo10 : (x: string | number | boolean) => boolean ->x : string | number | boolean - - // Mixing typeguard narrowing in if statement with conditional expression typeguard - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - return x === "hello"; // string ->x === "hello" : boolean ->x : string ->"hello" : string - } - else { - var y: boolean | string; ->y : string | boolean - - var b = x; // number | boolean ->b : number | boolean ->x : number | boolean - - return typeof x === "number" ->typeof x === "number" ? x === 10 // number : x : boolean ->typeof x === "number" : boolean ->typeof x : string ->x : number | boolean ->"number" : string - - ? x === 10 // number ->x === 10 : boolean ->x : number ->10 : number - - : x; // x should be boolean ->x : boolean - } -} -function foo11(x: number | string | boolean) { ->foo11 : (x: string | number | boolean) => string | number | boolean ->x : string | number | boolean - - // Mixing typeguard narrowing in if statement with conditional expression typeguard - // Assigning value to x deep inside another guard stops narrowing of type too - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - return x; // string | number | boolean - x changed in else branch ->x : string | number | boolean - } - else { - var y: number| boolean | string; ->y : string | number | boolean - - var b = x; // number | boolean | string - because below we are changing value of x in if statement ->b : string | number | boolean ->x : string | number | boolean - - return typeof x === "number" ->typeof x === "number" ? ( // change value of x x = 10 && x.toString() // number | boolean | string ) : ( // do not change value y = x && x.toString() // number | boolean | string ) : string ->typeof x === "number" : boolean ->typeof x : string ->x : string | number | boolean ->"number" : string - - ? ( ->( // change value of x x = 10 && x.toString() // number | boolean | string ) : string - - // change value of x - x = 10 && x.toString() // number | boolean | string ->x = 10 && x.toString() : string ->x : string | number | boolean ->10 && x.toString() : string ->10 : number ->x.toString() : string ->x.toString : () => string ->x : string | number | boolean ->toString : () => string - - ) - : ( ->( // do not change value y = x && x.toString() // number | boolean | string ) : string - - // do not change value - y = x && x.toString() // number | boolean | string ->y = x && x.toString() : string ->y : string | number | boolean ->x && x.toString() : string ->x : string | number | boolean ->x.toString() : string ->x.toString : () => string ->x : string | number | boolean ->toString : () => string - - ); - } -} -function foo12(x: number | string | boolean) { ->foo12 : (x: string | number | boolean) => string ->x : string | number | boolean - - // Mixing typeguard narrowing in if statement with conditional expression typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - if (typeof x === "string") { ->typeof x === "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - return x.toString(); // string | number | boolean - x changed in else branch ->x.toString() : string ->x.toString : () => string ->x : string | number | boolean ->toString : () => string - } - else { - x = 10; ->x = 10 : number ->x : string | number | boolean ->10 : number - - var b = x; // number | boolean | string ->b : string | number | boolean ->x : string | number | boolean - - return typeof x === "number" ->typeof x === "number" ? x.toString() // number : x.toString() : string ->typeof x === "number" : boolean ->typeof x : string ->x : string | number | boolean ->"number" : string - - ? x.toString() // number ->x.toString() : string ->x.toString : (radix?: number) => string ->x : number ->toString : (radix?: number) => string - - : x.toString(); // boolean | string ->x.toString() : string ->x.toString : () => string ->x : string | boolean ->toString : () => string - } -} diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.errors.txt b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.errors.txt new file mode 100644 index 0000000000000..f44e433a2c899 --- /dev/null +++ b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.errors.txt @@ -0,0 +1,64 @@ +tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts(43,22): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts(45,21): error TS2349: Cannot invoke an expression whose type lacks a call signature. + + +==== tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts (2 errors) ==== + // In the right operand of a && operation, + // the type of a variable or parameter is narrowed by any type guard in the left operand when true, + // provided the right operand contains no assignments to the variable or parameter. + function foo(x: number | string) { + return typeof x === "string" && x.length === 10; // string + } + function foo2(x: number | string) { + // modify x in right hand operand + return typeof x === "string" && ((x = 10) && x); // string | number + } + function foo3(x: number | string) { + // modify x in right hand operand with string type itself + return typeof x === "string" && ((x = "hello") && x); // string | number + } + function foo4(x: number | string | boolean) { + return typeof x !== "string" // string | number | boolean + && typeof x !== "number" // number | boolean + && x; // boolean + } + function foo5(x: number | string | boolean) { + // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop + var b: number | boolean; + return typeof x !== "string" // string | number | boolean + && ((b = x) && (typeof x !== "number" // number | boolean + && x)); // boolean + } + function foo6(x: number | string | boolean) { + // Mixing typeguard narrowing in if statement with conditional expression typeguard + return typeof x !== "string" // string | number | boolean + && (typeof x !== "number" // number | boolean + ? x // boolean + : x === 10) // number + } + function foo7(x: number | string | boolean) { + var y: number| boolean | string; + var z: number| boolean | string; + // Mixing typeguard narrowing + // Assigning value to x deep inside another guard stops narrowing of type too + return typeof x !== "string" + && ((z = x) // string | number | boolean - x changed deeper in conditional expression + && (typeof x === "number" + // change value of x + ? (x = 10 && x.toString()) // number | boolean | string + ~~~~~~~~~~~~ +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. + // do not change value + : (y = x && x.toString()))); // number | boolean | string + ~~~~~~~~~~~~ +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. + } + function foo8(x: number | string) { + // Mixing typeguard + // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression + return typeof x !== "string" + && (x = 10) // change x - number| string + && (typeof x === "number" + ? x // number + : x.length); // string + } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.symbols b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.symbols deleted file mode 100644 index 2a757460234d9..0000000000000 --- a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.symbols +++ /dev/null @@ -1,143 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts === -// In the right operand of a && operation, -// the type of a variable or parameter is narrowed by any type guard in the left operand when true, -// provided the right operand contains no assignments to the variable or parameter. -function foo(x: number | string) { ->foo : Symbol(foo, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 0, 0)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 3, 13)) - - return typeof x === "string" && x.length === 10; // string ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 3, 13)) ->x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 3, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) -} -function foo2(x: number | string) { ->foo2 : Symbol(foo2, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 5, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 6, 14)) - - // modify x in right hand operand - return typeof x === "string" && ((x = 10) && x); // string | number ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 6, 14)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 6, 14)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 6, 14)) -} -function foo3(x: number | string) { ->foo3 : Symbol(foo3, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 9, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 10, 14)) - - // modify x in right hand operand with string type itself - return typeof x === "string" && ((x = "hello") && x); // string | number ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 10, 14)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 10, 14)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 10, 14)) -} -function foo4(x: number | string | boolean) { ->foo4 : Symbol(foo4, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 13, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 14, 14)) - - return typeof x !== "string" // string | number | boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 14, 14)) - - && typeof x !== "number" // number | boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 14, 14)) - - && x; // boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 14, 14)) -} -function foo5(x: number | string | boolean) { ->foo5 : Symbol(foo5, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 18, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 19, 14)) - - // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop - var b: number | boolean; ->b : Symbol(b, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 21, 7)) - - return typeof x !== "string" // string | number | boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 19, 14)) - - && ((b = x) && (typeof x !== "number" // number | boolean ->b : Symbol(b, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 21, 7)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 19, 14)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 19, 14)) - - && x)); // boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 19, 14)) -} -function foo6(x: number | string | boolean) { ->foo6 : Symbol(foo6, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 25, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 26, 14)) - - // Mixing typeguard narrowing in if statement with conditional expression typeguard - return typeof x !== "string" // string | number | boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 26, 14)) - - && (typeof x !== "number" // number | boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 26, 14)) - - ? x // boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 26, 14)) - - : x === 10) // number ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 26, 14)) -} -function foo7(x: number | string | boolean) { ->foo7 : Symbol(foo7, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 32, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) - - var y: number| boolean | string; ->y : Symbol(y, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 34, 7)) - - var z: number| boolean | string; ->z : Symbol(z, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 35, 7)) - - // Mixing typeguard narrowing - // Assigning value to x deep inside another guard stops narrowing of type too - return typeof x !== "string" ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) - - && ((z = x) // string | number | boolean - x changed deeper in conditional expression ->z : Symbol(z, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 35, 7)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) - - && (typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) - - // change value of x - ? (x = 10 && x.toString()) // number | boolean | string ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) ->x.toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 96, 26)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) ->toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 96, 26)) - - // do not change value - : (y = x && x.toString()))); // number | boolean | string ->y : Symbol(y, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 34, 7)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) ->x.toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 96, 26)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) ->toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 96, 26)) -} -function foo8(x: number | string) { ->foo8 : Symbol(foo8, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 45, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) - - // Mixing typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - return typeof x !== "string" ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) - - && (x = 10) // change x - number| string ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) - - && (typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) - - ? x // number ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) - - : x.length); // string ->x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) ->length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) -} diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types deleted file mode 100644 index 10b72e3fbd1ce..0000000000000 --- a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types +++ /dev/null @@ -1,234 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts === -// In the right operand of a && operation, -// the type of a variable or parameter is narrowed by any type guard in the left operand when true, -// provided the right operand contains no assignments to the variable or parameter. -function foo(x: number | string) { ->foo : (x: string | number) => boolean ->x : string | number - - return typeof x === "string" && x.length === 10; // string ->typeof x === "string" && x.length === 10 : boolean ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string ->x.length === 10 : boolean ->x.length : number ->x : string ->length : number ->10 : number -} -function foo2(x: number | string) { ->foo2 : (x: string | number) => string | number ->x : string | number - - // modify x in right hand operand - return typeof x === "string" && ((x = 10) && x); // string | number ->typeof x === "string" && ((x = 10) && x) : string | number ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string ->((x = 10) && x) : string | number ->(x = 10) && x : string | number ->(x = 10) : number ->x = 10 : number ->x : string | number ->10 : number ->x : string | number -} -function foo3(x: number | string) { ->foo3 : (x: string | number) => string | number ->x : string | number - - // modify x in right hand operand with string type itself - return typeof x === "string" && ((x = "hello") && x); // string | number ->typeof x === "string" && ((x = "hello") && x) : string | number ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string ->((x = "hello") && x) : string | number ->(x = "hello") && x : string | number ->(x = "hello") : string ->x = "hello" : string ->x : string | number ->"hello" : string ->x : string | number -} -function foo4(x: number | string | boolean) { ->foo4 : (x: string | number | boolean) => boolean ->x : string | number | boolean - - return typeof x !== "string" // string | number | boolean ->typeof x !== "string" // string | number | boolean && typeof x !== "number" // number | boolean && x : boolean ->typeof x !== "string" // string | number | boolean && typeof x !== "number" : boolean ->typeof x !== "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - && typeof x !== "number" // number | boolean ->typeof x !== "number" : boolean ->typeof x : string ->x : number | boolean ->"number" : string - - && x; // boolean ->x : boolean -} -function foo5(x: number | string | boolean) { ->foo5 : (x: string | number | boolean) => boolean ->x : string | number | boolean - - // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop - var b: number | boolean; ->b : number | boolean - - return typeof x !== "string" // string | number | boolean ->typeof x !== "string" // string | number | boolean && ((b = x) && (typeof x !== "number" // number | boolean && x)) : boolean ->typeof x !== "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - && ((b = x) && (typeof x !== "number" // number | boolean ->((b = x) && (typeof x !== "number" // number | boolean && x)) : boolean ->(b = x) && (typeof x !== "number" // number | boolean && x) : boolean ->(b = x) : number | boolean ->b = x : number | boolean ->b : number | boolean ->x : number | boolean ->(typeof x !== "number" // number | boolean && x) : boolean ->typeof x !== "number" // number | boolean && x : boolean ->typeof x !== "number" : boolean ->typeof x : string ->x : number | boolean ->"number" : string - - && x)); // boolean ->x : boolean -} -function foo6(x: number | string | boolean) { ->foo6 : (x: string | number | boolean) => boolean ->x : string | number | boolean - - // Mixing typeguard narrowing in if statement with conditional expression typeguard - return typeof x !== "string" // string | number | boolean ->typeof x !== "string" // string | number | boolean && (typeof x !== "number" // number | boolean ? x // boolean : x === 10) : boolean ->typeof x !== "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - && (typeof x !== "number" // number | boolean ->(typeof x !== "number" // number | boolean ? x // boolean : x === 10) : boolean ->typeof x !== "number" // number | boolean ? x // boolean : x === 10 : boolean ->typeof x !== "number" : boolean ->typeof x : string ->x : number | boolean ->"number" : string - - ? x // boolean ->x : boolean - - : x === 10) // number ->x === 10 : boolean ->x : number ->10 : number -} -function foo7(x: number | string | boolean) { ->foo7 : (x: string | number | boolean) => string ->x : string | number | boolean - - var y: number| boolean | string; ->y : string | number | boolean - - var z: number| boolean | string; ->z : string | number | boolean - - // Mixing typeguard narrowing - // Assigning value to x deep inside another guard stops narrowing of type too - return typeof x !== "string" ->typeof x !== "string" && ((z = x) // string | number | boolean - x changed deeper in conditional expression && (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()))) : string ->typeof x !== "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - && ((z = x) // string | number | boolean - x changed deeper in conditional expression ->((z = x) // string | number | boolean - x changed deeper in conditional expression && (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()))) : string ->(z = x) // string | number | boolean - x changed deeper in conditional expression && (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString())) : string ->(z = x) : string | number | boolean ->z = x : string | number | boolean ->z : string | number | boolean ->x : string | number | boolean - - && (typeof x === "number" ->(typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString())) : string ->typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()) : string ->typeof x === "number" : boolean ->typeof x : string ->x : string | number | boolean ->"number" : string - - // change value of x - ? (x = 10 && x.toString()) // number | boolean | string ->(x = 10 && x.toString()) : string ->x = 10 && x.toString() : string ->x : string | number | boolean ->10 && x.toString() : string ->10 : number ->x.toString() : string ->x.toString : () => string ->x : string | number | boolean ->toString : () => string - - // do not change value - : (y = x && x.toString()))); // number | boolean | string ->(y = x && x.toString()) : string ->y = x && x.toString() : string ->y : string | number | boolean ->x && x.toString() : string ->x : string | number | boolean ->x.toString() : string ->x.toString : () => string ->x : string | number | boolean ->toString : () => string -} -function foo8(x: number | string) { ->foo8 : (x: string | number) => number ->x : string | number - - // Mixing typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - return typeof x !== "string" ->typeof x !== "string" && (x = 10) // change x - number| string && (typeof x === "number" ? x // number : x.length) : number ->typeof x !== "string" && (x = 10) : number ->typeof x !== "string" : boolean ->typeof x : string ->x : string | number ->"string" : string - - && (x = 10) // change x - number| string ->(x = 10) : number ->x = 10 : number ->x : string | number ->10 : number - - && (typeof x === "number" ->(typeof x === "number" ? x // number : x.length) : number ->typeof x === "number" ? x // number : x.length : number ->typeof x === "number" : boolean ->typeof x : string ->x : string | number ->"number" : string - - ? x // number ->x : number - - : x.length); // string ->x.length : number ->x : string ->length : number -} diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.errors.txt b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.errors.txt new file mode 100644 index 0000000000000..f34d035fa4063 --- /dev/null +++ b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.errors.txt @@ -0,0 +1,64 @@ +tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfOrOrOperator.ts(43,22): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfOrOrOperator.ts(45,21): error TS2349: Cannot invoke an expression whose type lacks a call signature. + + +==== tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfOrOrOperator.ts (2 errors) ==== + // In the right operand of a || operation, + // the type of a variable or parameter is narrowed by any type guard in the left operand when false, + // provided the right operand contains no assignments to the variable or parameter. + function foo(x: number | string) { + return typeof x !== "string" || x.length === 10; // string + } + function foo2(x: number | string) { + // modify x in right hand operand + return typeof x !== "string" || ((x = 10) || x); // string | number + } + function foo3(x: number | string) { + // modify x in right hand operand with string type itself + return typeof x !== "string" || ((x = "hello") || x); // string | number + } + function foo4(x: number | string | boolean) { + return typeof x === "string" // string | number | boolean + || typeof x === "number" // number | boolean + || x; // boolean + } + function foo5(x: number | string | boolean) { + // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop + var b: number | boolean; + return typeof x === "string" // string | number | boolean + || ((b = x) || (typeof x === "number" // number | boolean + || x)); // boolean + } + function foo6(x: number | string | boolean) { + // Mixing typeguard + return typeof x === "string" // string | number | boolean + || (typeof x !== "number" // number | boolean + ? x // boolean + : x === 10) // number + } + function foo7(x: number | string | boolean) { + var y: number| boolean | string; + var z: number| boolean | string; + // Mixing typeguard narrowing + // Assigning value to x deep inside another guard stops narrowing of type too + return typeof x === "string" + || ((z = x) // string | number | boolean - x changed deeper in conditional expression + || (typeof x === "number" + // change value of x + ? (x = 10 && x.toString()) // number | boolean | string + ~~~~~~~~~~~~ +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. + // do not change value + : (y = x && x.toString()))); // number | boolean | string + ~~~~~~~~~~~~ +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. + } + function foo8(x: number | string) { + // Mixing typeguard + // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression + return typeof x === "string" + || (x = 10) // change x - number| string + || (typeof x === "number" + ? x // number + : x.length); // string + } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.symbols b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.symbols deleted file mode 100644 index dd751b7d8ddf2..0000000000000 --- a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.symbols +++ /dev/null @@ -1,143 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfOrOrOperator.ts === -// In the right operand of a || operation, -// the type of a variable or parameter is narrowed by any type guard in the left operand when false, -// provided the right operand contains no assignments to the variable or parameter. -function foo(x: number | string) { ->foo : Symbol(foo, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 0, 0)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 3, 13)) - - return typeof x !== "string" || x.length === 10; // string ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 3, 13)) ->x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 3, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) -} -function foo2(x: number | string) { ->foo2 : Symbol(foo2, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 5, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 6, 14)) - - // modify x in right hand operand - return typeof x !== "string" || ((x = 10) || x); // string | number ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 6, 14)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 6, 14)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 6, 14)) -} -function foo3(x: number | string) { ->foo3 : Symbol(foo3, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 9, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 10, 14)) - - // modify x in right hand operand with string type itself - return typeof x !== "string" || ((x = "hello") || x); // string | number ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 10, 14)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 10, 14)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 10, 14)) -} -function foo4(x: number | string | boolean) { ->foo4 : Symbol(foo4, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 13, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 14, 14)) - - return typeof x === "string" // string | number | boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 14, 14)) - - || typeof x === "number" // number | boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 14, 14)) - - || x; // boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 14, 14)) -} -function foo5(x: number | string | boolean) { ->foo5 : Symbol(foo5, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 18, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 19, 14)) - - // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop - var b: number | boolean; ->b : Symbol(b, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 21, 7)) - - return typeof x === "string" // string | number | boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 19, 14)) - - || ((b = x) || (typeof x === "number" // number | boolean ->b : Symbol(b, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 21, 7)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 19, 14)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 19, 14)) - - || x)); // boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 19, 14)) -} -function foo6(x: number | string | boolean) { ->foo6 : Symbol(foo6, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 25, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 26, 14)) - - // Mixing typeguard - return typeof x === "string" // string | number | boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 26, 14)) - - || (typeof x !== "number" // number | boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 26, 14)) - - ? x // boolean ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 26, 14)) - - : x === 10) // number ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 26, 14)) -} -function foo7(x: number | string | boolean) { ->foo7 : Symbol(foo7, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 32, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) - - var y: number| boolean | string; ->y : Symbol(y, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 34, 7)) - - var z: number| boolean | string; ->z : Symbol(z, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 35, 7)) - - // Mixing typeguard narrowing - // Assigning value to x deep inside another guard stops narrowing of type too - return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) - - || ((z = x) // string | number | boolean - x changed deeper in conditional expression ->z : Symbol(z, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 35, 7)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) - - || (typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) - - // change value of x - ? (x = 10 && x.toString()) // number | boolean | string ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) ->x.toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 96, 26)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) ->toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 96, 26)) - - // do not change value - : (y = x && x.toString()))); // number | boolean | string ->y : Symbol(y, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 34, 7)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) ->x.toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 96, 26)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) ->toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 96, 26)) -} -function foo8(x: number | string) { ->foo8 : Symbol(foo8, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 45, 1)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) - - // Mixing typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - return typeof x === "string" ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) - - || (x = 10) // change x - number| string ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) - - || (typeof x === "number" ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) - - ? x // number ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) - - : x.length); // string ->x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) ->x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) ->length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) -} diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types deleted file mode 100644 index 8116032342964..0000000000000 --- a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types +++ /dev/null @@ -1,234 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfOrOrOperator.ts === -// In the right operand of a || operation, -// the type of a variable or parameter is narrowed by any type guard in the left operand when false, -// provided the right operand contains no assignments to the variable or parameter. -function foo(x: number | string) { ->foo : (x: string | number) => boolean ->x : string | number - - return typeof x !== "string" || x.length === 10; // string ->typeof x !== "string" || x.length === 10 : boolean ->typeof x !== "string" : boolean ->typeof x : string ->x : string | number ->"string" : string ->x.length === 10 : boolean ->x.length : number ->x : string ->length : number ->10 : number -} -function foo2(x: number | string) { ->foo2 : (x: string | number) => string | number | boolean ->x : string | number - - // modify x in right hand operand - return typeof x !== "string" || ((x = 10) || x); // string | number ->typeof x !== "string" || ((x = 10) || x) : string | number | boolean ->typeof x !== "string" : boolean ->typeof x : string ->x : string | number ->"string" : string ->((x = 10) || x) : string | number ->(x = 10) || x : string | number ->(x = 10) : number ->x = 10 : number ->x : string | number ->10 : number ->x : string | number -} -function foo3(x: number | string) { ->foo3 : (x: string | number) => string | number | boolean ->x : string | number - - // modify x in right hand operand with string type itself - return typeof x !== "string" || ((x = "hello") || x); // string | number ->typeof x !== "string" || ((x = "hello") || x) : string | number | boolean ->typeof x !== "string" : boolean ->typeof x : string ->x : string | number ->"string" : string ->((x = "hello") || x) : string | number ->(x = "hello") || x : string | number ->(x = "hello") : string ->x = "hello" : string ->x : string | number ->"hello" : string ->x : string | number -} -function foo4(x: number | string | boolean) { ->foo4 : (x: string | number | boolean) => boolean ->x : string | number | boolean - - return typeof x === "string" // string | number | boolean ->typeof x === "string" // string | number | boolean || typeof x === "number" // number | boolean || x : boolean ->typeof x === "string" // string | number | boolean || typeof x === "number" : boolean ->typeof x === "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - || typeof x === "number" // number | boolean ->typeof x === "number" : boolean ->typeof x : string ->x : number | boolean ->"number" : string - - || x; // boolean ->x : boolean -} -function foo5(x: number | string | boolean) { ->foo5 : (x: string | number | boolean) => number | boolean ->x : string | number | boolean - - // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop - var b: number | boolean; ->b : number | boolean - - return typeof x === "string" // string | number | boolean ->typeof x === "string" // string | number | boolean || ((b = x) || (typeof x === "number" // number | boolean || x)) : number | boolean ->typeof x === "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - || ((b = x) || (typeof x === "number" // number | boolean ->((b = x) || (typeof x === "number" // number | boolean || x)) : number | boolean ->(b = x) || (typeof x === "number" // number | boolean || x) : number | boolean ->(b = x) : number | boolean ->b = x : number | boolean ->b : number | boolean ->x : number | boolean ->(typeof x === "number" // number | boolean || x) : boolean ->typeof x === "number" // number | boolean || x : boolean ->typeof x === "number" : boolean ->typeof x : string ->x : number | boolean ->"number" : string - - || x)); // boolean ->x : boolean -} -function foo6(x: number | string | boolean) { ->foo6 : (x: string | number | boolean) => boolean ->x : string | number | boolean - - // Mixing typeguard - return typeof x === "string" // string | number | boolean ->typeof x === "string" // string | number | boolean || (typeof x !== "number" // number | boolean ? x // boolean : x === 10) : boolean ->typeof x === "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - || (typeof x !== "number" // number | boolean ->(typeof x !== "number" // number | boolean ? x // boolean : x === 10) : boolean ->typeof x !== "number" // number | boolean ? x // boolean : x === 10 : boolean ->typeof x !== "number" : boolean ->typeof x : string ->x : number | boolean ->"number" : string - - ? x // boolean ->x : boolean - - : x === 10) // number ->x === 10 : boolean ->x : number ->10 : number -} -function foo7(x: number | string | boolean) { ->foo7 : (x: string | number | boolean) => string | number | boolean ->x : string | number | boolean - - var y: number| boolean | string; ->y : string | number | boolean - - var z: number| boolean | string; ->z : string | number | boolean - - // Mixing typeguard narrowing - // Assigning value to x deep inside another guard stops narrowing of type too - return typeof x === "string" ->typeof x === "string" || ((z = x) // string | number | boolean - x changed deeper in conditional expression || (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()))) : string | number | boolean ->typeof x === "string" : boolean ->typeof x : string ->x : string | number | boolean ->"string" : string - - || ((z = x) // string | number | boolean - x changed deeper in conditional expression ->((z = x) // string | number | boolean - x changed deeper in conditional expression || (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()))) : string | number | boolean ->(z = x) // string | number | boolean - x changed deeper in conditional expression || (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString())) : string | number | boolean ->(z = x) : string | number | boolean ->z = x : string | number | boolean ->z : string | number | boolean ->x : string | number | boolean - - || (typeof x === "number" ->(typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString())) : string ->typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()) : string ->typeof x === "number" : boolean ->typeof x : string ->x : string | number | boolean ->"number" : string - - // change value of x - ? (x = 10 && x.toString()) // number | boolean | string ->(x = 10 && x.toString()) : string ->x = 10 && x.toString() : string ->x : string | number | boolean ->10 && x.toString() : string ->10 : number ->x.toString() : string ->x.toString : () => string ->x : string | number | boolean ->toString : () => string - - // do not change value - : (y = x && x.toString()))); // number | boolean | string ->(y = x && x.toString()) : string ->y = x && x.toString() : string ->y : string | number | boolean ->x && x.toString() : string ->x : string | number | boolean ->x.toString() : string ->x.toString : () => string ->x : string | number | boolean ->toString : () => string -} -function foo8(x: number | string) { ->foo8 : (x: string | number) => number | boolean ->x : string | number - - // Mixing typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - return typeof x === "string" ->typeof x === "string" || (x = 10) // change x - number| string || (typeof x === "number" ? x // number : x.length) : number | boolean ->typeof x === "string" || (x = 10) : number | boolean ->typeof x === "string" : boolean ->typeof x : string ->x : string | number ->"string" : string - - || (x = 10) // change x - number| string ->(x = 10) : number ->x = 10 : number ->x : string | number ->10 : number - - || (typeof x === "number" ->(typeof x === "number" ? x // number : x.length) : number ->typeof x === "number" ? x // number : x.length : number ->typeof x === "number" : boolean ->typeof x : string ->x : string | number ->"number" : string - - ? x // number ->x : number - - : x.length); // string ->x.length : number ->x : string ->length : number -} diff --git a/tests/baselines/reference/typeGuardsOnClassProperty.errors.txt b/tests/baselines/reference/typeGuardsOnClassProperty.errors.txt index 4e6a8b83ae349..91d6d6998bc49 100644 --- a/tests/baselines/reference/typeGuardsOnClassProperty.errors.txt +++ b/tests/baselines/reference/typeGuardsOnClassProperty.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts(14,70): error TS2339: Property 'join' does not exist on type 'string | string[]'. -tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts(26,44): error TS2339: Property 'toLowerCase' does not exist on type 'string | number'. +tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts(26,44): error TS2339: Property 'toLowerCase' does not exist on type 'number | string'. ==== tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts (2 errors) ==== @@ -32,6 +32,6 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts(26,4 if (typeof o.prop1 === "string" && o.prop1.toLowerCase()) {} ~~~~~~~~~~~ -!!! error TS2339: Property 'toLowerCase' does not exist on type 'string | number'. +!!! error TS2339: Property 'toLowerCase' does not exist on type 'number | string'. var prop1 = o.prop1; if (typeof prop1 === "string" && prop1.toLocaleLowerCase()) { } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt index 4960940d3ab0b..2f86b6797d70e 100644 --- a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt +++ b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt @@ -6,8 +6,8 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(85,10): error TS2339: Property 'bar' does not exist on type 'D'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(111,10): error TS2339: Property 'bar1' does not exist on type 'E1 | E2'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(112,10): error TS2339: Property 'bar2' does not exist on type 'E1 | E2'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(134,11): error TS2339: Property 'foo' does not exist on type 'string | F'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(135,11): error TS2339: Property 'bar' does not exist on type 'string | F'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(134,11): error TS2339: Property 'foo' does not exist on type 'F | string'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(135,11): error TS2339: Property 'bar' does not exist on type 'F | string'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(160,11): error TS2339: Property 'foo2' does not exist on type 'G1'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(182,11): error TS2339: Property 'bar' does not exist on type 'H'. @@ -164,10 +164,10 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru if (obj11 instanceof F) { // can't type narrowing, construct signature returns any. obj11.foo; ~~~ -!!! error TS2339: Property 'foo' does not exist on type 'string | F'. +!!! error TS2339: Property 'foo' does not exist on type 'F | string'. obj11.bar; ~~~ -!!! error TS2339: Property 'bar' does not exist on type 'string | F'. +!!! error TS2339: Property 'bar' does not exist on type 'F | string'. } var obj12: any; diff --git a/tests/baselines/reference/typeInfer1.errors.txt b/tests/baselines/reference/typeInfer1.errors.txt index cce736e253151..2550bb1fe8de3 100644 --- a/tests/baselines/reference/typeInfer1.errors.txt +++ b/tests/baselines/reference/typeInfer1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/typeInfer1.ts(11,5): error TS2322: Type '{ Moo: () => string; }' is not assignable to type 'ITextWriter2'. - Property 'Write' is missing in type '{ Moo: () => string; }'. + Object literal may only specify known properties, and 'Moo' does not exist in type 'ITextWriter2'. ==== tests/cases/compiler/typeInfer1.ts (1 errors) ==== @@ -16,6 +16,6 @@ tests/cases/compiler/typeInfer1.ts(11,5): error TS2322: Type '{ Moo: () => strin var yyyyyyyy: ITextWriter2 = { ~~~~~~~~ !!! error TS2322: Type '{ Moo: () => string; }' is not assignable to type 'ITextWriter2'. -!!! error TS2322: Property 'Write' is missing in type '{ Moo: () => string; }'. +!!! error TS2322: Object literal may only specify known properties, and 'Moo' does not exist in type 'ITextWriter2'. Moo: function() { return "cow"; } } \ No newline at end of file diff --git a/tests/baselines/reference/typeMatch2.errors.txt b/tests/baselines/reference/typeMatch2.errors.txt index 4db4828064e75..a497551c953e8 100644 --- a/tests/baselines/reference/typeMatch2.errors.txt +++ b/tests/baselines/reference/typeMatch2.errors.txt @@ -2,8 +2,10 @@ tests/cases/compiler/typeMatch2.ts(3,2): error TS2322: Type '{}' is not assignab Property 'x' is missing in type '{}'. tests/cases/compiler/typeMatch2.ts(4,5): error TS2322: Type '{ x: number; }' is not assignable to type '{ x: number; y: number; }'. Property 'y' is missing in type '{ x: number; }'. +tests/cases/compiler/typeMatch2.ts(5,2): error TS2322: Type '{ x: number; y: number; z: number; }' is not assignable to type '{ x: number; y: number; }'. + Object literal may only specify known properties, and 'z' does not exist in type '{ x: number; y: number; }'. tests/cases/compiler/typeMatch2.ts(6,5): error TS2322: Type '{ x: number; z: number; }' is not assignable to type '{ x: number; y: number; }'. - Property 'y' is missing in type '{ x: number; z: number; }'. + Object literal may only specify known properties, and 'z' does not exist in type '{ x: number; y: number; }'. tests/cases/compiler/typeMatch2.ts(18,5): error TS2322: Type 'Animal[]' is not assignable to type 'Giraffe[]'. Type 'Animal' is not assignable to type 'Giraffe'. Property 'g' is missing in type 'Animal'. @@ -11,11 +13,13 @@ tests/cases/compiler/typeMatch2.ts(22,5): error TS2322: Type '{ f1: number; f2: Types of property 'f2' are incompatible. Type 'Animal[]' is not assignable to type 'Giraffe[]'. Type 'Animal' is not assignable to type 'Giraffe'. +tests/cases/compiler/typeMatch2.ts(34,5): error TS2322: Type '{ x: number; y: any; z: number; }' is not assignable to type '{ x: number; y: number; }'. + Object literal may only specify known properties, and 'z' does not exist in type '{ x: number; y: number; }'. tests/cases/compiler/typeMatch2.ts(35,5): error TS2322: Type '{ x: number; }' is not assignable to type '{ x: number; y: number; }'. Property 'y' is missing in type '{ x: number; }'. -==== tests/cases/compiler/typeMatch2.ts (6 errors) ==== +==== tests/cases/compiler/typeMatch2.ts (8 errors) ==== function f1() { var a = { x: 1, y: 2 }; a = {}; // error @@ -27,10 +31,13 @@ tests/cases/compiler/typeMatch2.ts(35,5): error TS2322: Type '{ x: number; }' is !!! error TS2322: Type '{ x: number; }' is not assignable to type '{ x: number; y: number; }'. !!! error TS2322: Property 'y' is missing in type '{ x: number; }'. a = { x: 1, y: 2, z: 3 }; + ~ +!!! error TS2322: Type '{ x: number; y: number; z: number; }' is not assignable to type '{ x: number; y: number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'z' does not exist in type '{ x: number; y: number; }'. a = { x: 1, z: 3 }; // error ~ !!! error TS2322: Type '{ x: number; z: number; }' is not assignable to type '{ x: number; y: number; }'. -!!! error TS2322: Property 'y' is missing in type '{ x: number; z: number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'z' does not exist in type '{ x: number; y: number; }'. } class Animal { private a; } @@ -68,6 +75,9 @@ tests/cases/compiler/typeMatch2.ts(35,5): error TS2322: Type '{ x: number; }' is a = { x: 1, y: undefined }; a = { x: 1, y: _any }; a = { x: 1, y: _any, z:1 }; + ~ +!!! error TS2322: Type '{ x: number; y: any; z: number; }' is not assignable to type '{ x: number; y: number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'z' does not exist in type '{ x: number; y: number; }'. a = { x: 1 }; // error ~ !!! error TS2322: Type '{ x: number; }' is not assignable to type '{ x: number; y: number; }'. diff --git a/tests/baselines/reference/typeParameterAsElementType.types b/tests/baselines/reference/typeParameterAsElementType.types index 10e6787ae31ee..3b145b7f3cf33 100644 --- a/tests/baselines/reference/typeParameterAsElementType.types +++ b/tests/baselines/reference/typeParameterAsElementType.types @@ -8,8 +8,8 @@ function fee() { >T : T var arr = [t, ""]; ->arr : (string | T)[] ->[t, ""] : (string | T)[] +>arr : (T | string)[] +>[t, ""] : (T | string)[] >t : T >"" : string } diff --git a/tests/baselines/reference/underscoreTest1.js b/tests/baselines/reference/underscoreTest1.js index ddd5201b85810..687a210e6707c 100644 --- a/tests/baselines/reference/underscoreTest1.js +++ b/tests/baselines/reference/underscoreTest1.js @@ -385,6 +385,7 @@ module Underscore { evaluate?: RegExp; interpolate?: RegExp; escape?: RegExp; + variable?: string; } export interface Static { diff --git a/tests/baselines/reference/underscoreTest1.symbols b/tests/baselines/reference/underscoreTest1.symbols index 128ce83051a64..1ba7c97d3318f 100644 --- a/tests/baselines/reference/underscoreTest1.symbols +++ b/tests/baselines/reference/underscoreTest1.symbols @@ -9,9 +9,9 @@ declare function alert(x: string): void; >x : Symbol(x, Decl(underscoreTest1_underscoreTests.ts, 3, 23)) _.each([1, 2, 3], (num) => alert(num.toString())); ->_.each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 394, 43), Decl(underscoreTest1_underscore.ts, 396, 77)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 394, 43), Decl(underscoreTest1_underscore.ts, 396, 77)) +>_.each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 5, 19)) >alert : Symbol(alert, Decl(underscoreTest1_underscoreTests.ts, 2, 14)) >num.toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18)) @@ -19,9 +19,9 @@ _.each([1, 2, 3], (num) => alert(num.toString())); >toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18)) _.each({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => alert(value.toString())); ->_.each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 394, 43), Decl(underscoreTest1_underscore.ts, 396, 77)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 394, 43), Decl(underscoreTest1_underscore.ts, 396, 77)) +>_.each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) >one : Symbol(one, Decl(underscoreTest1_underscoreTests.ts, 6, 8)) >two : Symbol(two, Decl(underscoreTest1_underscoreTests.ts, 6, 16)) >three : Symbol(three, Decl(underscoreTest1_underscoreTests.ts, 6, 24)) @@ -33,16 +33,16 @@ _.each({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => alert(valu >toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18)) _.map([1, 2, 3], (num) => num * 3); ->_.map : Symbol(Underscore.Static.map, Decl(underscoreTest1_underscore.ts, 399, 90), Decl(underscoreTest1_underscore.ts, 401, 75)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->map : Symbol(Underscore.Static.map, Decl(underscoreTest1_underscore.ts, 399, 90), Decl(underscoreTest1_underscore.ts, 401, 75)) +>_.map : Symbol(Underscore.Static.map, Decl(underscoreTest1_underscore.ts, 400, 90), Decl(underscoreTest1_underscore.ts, 402, 75)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>map : Symbol(Underscore.Static.map, Decl(underscoreTest1_underscore.ts, 400, 90), Decl(underscoreTest1_underscore.ts, 402, 75)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 8, 18)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 8, 18)) _.map({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => value * 3); ->_.map : Symbol(Underscore.Static.map, Decl(underscoreTest1_underscore.ts, 399, 90), Decl(underscoreTest1_underscore.ts, 401, 75)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->map : Symbol(Underscore.Static.map, Decl(underscoreTest1_underscore.ts, 399, 90), Decl(underscoreTest1_underscore.ts, 401, 75)) +>_.map : Symbol(Underscore.Static.map, Decl(underscoreTest1_underscore.ts, 400, 90), Decl(underscoreTest1_underscore.ts, 402, 75)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>map : Symbol(Underscore.Static.map, Decl(underscoreTest1_underscore.ts, 400, 90), Decl(underscoreTest1_underscore.ts, 402, 75)) >one : Symbol(one, Decl(underscoreTest1_underscoreTests.ts, 9, 7)) >two : Symbol(two, Decl(underscoreTest1_underscoreTests.ts, 9, 15)) >three : Symbol(three, Decl(underscoreTest1_underscoreTests.ts, 9, 23)) @@ -52,9 +52,9 @@ _.map({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => value * 3); var sum = _.reduce([1, 2, 3], (memo, num) => memo + num, 0); >sum : Symbol(sum, Decl(underscoreTest1_underscoreTests.ts, 11, 3)) ->_.reduce : Symbol(Underscore.Static.reduce, Decl(underscoreTest1_underscore.ts, 404, 89), Decl(underscoreTest1_underscore.ts, 406, 90), Decl(underscoreTest1_underscore.ts, 407, 92), Decl(underscoreTest1_underscore.ts, 408, 100)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->reduce : Symbol(Underscore.Static.reduce, Decl(underscoreTest1_underscore.ts, 404, 89), Decl(underscoreTest1_underscore.ts, 406, 90), Decl(underscoreTest1_underscore.ts, 407, 92), Decl(underscoreTest1_underscore.ts, 408, 100)) +>_.reduce : Symbol(Underscore.Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 89), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>reduce : Symbol(Underscore.Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 89), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) >memo : Symbol(memo, Decl(underscoreTest1_underscoreTests.ts, 11, 31)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 11, 36)) >memo : Symbol(memo, Decl(underscoreTest1_underscoreTests.ts, 11, 31)) @@ -65,9 +65,9 @@ var list = [[0, 1], [2, 3], [4, 5]]; var flat = _.reduceRight(list, (a, b) => a.concat(b), []); >flat : Symbol(flat, Decl(underscoreTest1_underscoreTests.ts, 14, 3)) ->_.reduceRight : Symbol(Underscore.Static.reduceRight, Decl(underscoreTest1_underscore.ts, 417, 102), Decl(underscoreTest1_underscore.ts, 419, 95), Decl(underscoreTest1_underscore.ts, 420, 97), Decl(underscoreTest1_underscore.ts, 421, 105)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->reduceRight : Symbol(Underscore.Static.reduceRight, Decl(underscoreTest1_underscore.ts, 417, 102), Decl(underscoreTest1_underscore.ts, 419, 95), Decl(underscoreTest1_underscore.ts, 420, 97), Decl(underscoreTest1_underscore.ts, 421, 105)) +>_.reduceRight : Symbol(Underscore.Static.reduceRight, Decl(underscoreTest1_underscore.ts, 418, 102), Decl(underscoreTest1_underscore.ts, 420, 95), Decl(underscoreTest1_underscore.ts, 421, 97), Decl(underscoreTest1_underscore.ts, 422, 105)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>reduceRight : Symbol(Underscore.Static.reduceRight, Decl(underscoreTest1_underscore.ts, 418, 102), Decl(underscoreTest1_underscore.ts, 420, 95), Decl(underscoreTest1_underscore.ts, 421, 97), Decl(underscoreTest1_underscore.ts, 422, 105)) >list : Symbol(list, Decl(underscoreTest1_underscoreTests.ts, 13, 3)) >a : Symbol(a, Decl(underscoreTest1_underscoreTests.ts, 14, 32)) >b : Symbol(b, Decl(underscoreTest1_underscoreTests.ts, 14, 34)) @@ -78,17 +78,17 @@ var flat = _.reduceRight(list, (a, b) => a.concat(b), []); var even = _.find([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); >even : Symbol(even, Decl(underscoreTest1_underscoreTests.ts, 16, 3)) ->_.find : Symbol(Underscore.Static.find, Decl(underscoreTest1_underscore.ts, 426, 101), Decl(underscoreTest1_underscore.ts, 428, 77)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->find : Symbol(Underscore.Static.find, Decl(underscoreTest1_underscore.ts, 426, 101), Decl(underscoreTest1_underscore.ts, 428, 77)) +>_.find : Symbol(Underscore.Static.find, Decl(underscoreTest1_underscore.ts, 427, 101), Decl(underscoreTest1_underscore.ts, 429, 77)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>find : Symbol(Underscore.Static.find, Decl(underscoreTest1_underscore.ts, 427, 101), Decl(underscoreTest1_underscore.ts, 429, 77)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 16, 39)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 16, 39)) var evens = _.filter([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); >evens : Symbol(evens, Decl(underscoreTest1_underscoreTests.ts, 18, 3)) ->_.filter : Symbol(Underscore.Static.filter, Decl(underscoreTest1_underscore.ts, 431, 89), Decl(underscoreTest1_underscore.ts, 433, 81)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->filter : Symbol(Underscore.Static.filter, Decl(underscoreTest1_underscore.ts, 431, 89), Decl(underscoreTest1_underscore.ts, 433, 81)) +>_.filter : Symbol(Underscore.Static.filter, Decl(underscoreTest1_underscore.ts, 432, 89), Decl(underscoreTest1_underscore.ts, 434, 81)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>filter : Symbol(Underscore.Static.filter, Decl(underscoreTest1_underscore.ts, 432, 89), Decl(underscoreTest1_underscore.ts, 434, 81)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 18, 42)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 18, 42)) @@ -105,43 +105,43 @@ var listOfPlays = [{ title: "Cymbeline", author: "Shakespeare", year: 1611 }, { >year : Symbol(year, Decl(underscoreTest1_underscoreTests.ts, 20, 183)) _.where(listOfPlays, { author: "Shakespeare", year: 1611 }); ->_.where : Symbol(Underscore.Static.where, Decl(underscoreTest1_underscore.ts, 436, 91), Decl(underscoreTest1_underscore.ts, 438, 53)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->where : Symbol(Underscore.Static.where, Decl(underscoreTest1_underscore.ts, 436, 91), Decl(underscoreTest1_underscore.ts, 438, 53)) +>_.where : Symbol(Underscore.Static.where, Decl(underscoreTest1_underscore.ts, 437, 91), Decl(underscoreTest1_underscore.ts, 439, 53)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>where : Symbol(Underscore.Static.where, Decl(underscoreTest1_underscore.ts, 437, 91), Decl(underscoreTest1_underscore.ts, 439, 53)) >listOfPlays : Symbol(listOfPlays, Decl(underscoreTest1_underscoreTests.ts, 20, 3)) >author : Symbol(author, Decl(underscoreTest1_underscoreTests.ts, 21, 22)) >year : Symbol(year, Decl(underscoreTest1_underscoreTests.ts, 21, 45)) var odds = _.reject([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); >odds : Symbol(odds, Decl(underscoreTest1_underscoreTests.ts, 23, 3)) ->_.reject : Symbol(Underscore.Static.reject, Decl(underscoreTest1_underscore.ts, 442, 65), Decl(underscoreTest1_underscore.ts, 444, 81)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->reject : Symbol(Underscore.Static.reject, Decl(underscoreTest1_underscore.ts, 442, 65), Decl(underscoreTest1_underscore.ts, 444, 81)) +>_.reject : Symbol(Underscore.Static.reject, Decl(underscoreTest1_underscore.ts, 443, 65), Decl(underscoreTest1_underscore.ts, 445, 81)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>reject : Symbol(Underscore.Static.reject, Decl(underscoreTest1_underscore.ts, 443, 65), Decl(underscoreTest1_underscore.ts, 445, 81)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 23, 41)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 23, 41)) _.all([true, 1, null, 'yes'], _.identity); ->_.all : Symbol(Underscore.Static.all, Decl(underscoreTest1_underscore.ts, 448, 95), Decl(underscoreTest1_underscore.ts, 449, 83)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->all : Symbol(Underscore.Static.all, Decl(underscoreTest1_underscore.ts, 448, 95), Decl(underscoreTest1_underscore.ts, 449, 83)) ->_.identity : Symbol(Underscore.Static.identity, Decl(underscoreTest1_underscore.ts, 617, 29)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->identity : Symbol(Underscore.Static.identity, Decl(underscoreTest1_underscore.ts, 617, 29)) +>_.all : Symbol(Underscore.Static.all, Decl(underscoreTest1_underscore.ts, 449, 95), Decl(underscoreTest1_underscore.ts, 450, 83)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>all : Symbol(Underscore.Static.all, Decl(underscoreTest1_underscore.ts, 449, 95), Decl(underscoreTest1_underscore.ts, 450, 83)) +>_.identity : Symbol(Underscore.Static.identity, Decl(underscoreTest1_underscore.ts, 618, 29)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>identity : Symbol(Underscore.Static.identity, Decl(underscoreTest1_underscore.ts, 618, 29)) _.any([null, 0, 'yes', false]); ->_.any : Symbol(Underscore.Static.any, Decl(underscoreTest1_underscore.ts, 453, 94), Decl(underscoreTest1_underscore.ts, 454, 83)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->any : Symbol(Underscore.Static.any, Decl(underscoreTest1_underscore.ts, 453, 94), Decl(underscoreTest1_underscore.ts, 454, 83)) +>_.any : Symbol(Underscore.Static.any, Decl(underscoreTest1_underscore.ts, 454, 94), Decl(underscoreTest1_underscore.ts, 455, 83)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>any : Symbol(Underscore.Static.any, Decl(underscoreTest1_underscore.ts, 454, 94), Decl(underscoreTest1_underscore.ts, 455, 83)) _.contains([1, 2, 3], 3); ->_.contains : Symbol(Underscore.Static.contains, Decl(underscoreTest1_underscore.ts, 455, 93), Decl(underscoreTest1_underscore.ts, 457, 50)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->contains : Symbol(Underscore.Static.contains, Decl(underscoreTest1_underscore.ts, 455, 93), Decl(underscoreTest1_underscore.ts, 457, 50)) +>_.contains : Symbol(Underscore.Static.contains, Decl(underscoreTest1_underscore.ts, 456, 93), Decl(underscoreTest1_underscore.ts, 458, 50)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>contains : Symbol(Underscore.Static.contains, Decl(underscoreTest1_underscore.ts, 456, 93), Decl(underscoreTest1_underscore.ts, 458, 50)) _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); ->_.invoke : Symbol(Underscore.Static.invoke, Decl(underscoreTest1_underscore.ts, 460, 59), Decl(underscoreTest1_underscore.ts, 462, 71)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->invoke : Symbol(Underscore.Static.invoke, Decl(underscoreTest1_underscore.ts, 460, 59), Decl(underscoreTest1_underscore.ts, 462, 71)) +>_.invoke : Symbol(Underscore.Static.invoke, Decl(underscoreTest1_underscore.ts, 461, 59), Decl(underscoreTest1_underscore.ts, 463, 71)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>invoke : Symbol(Underscore.Static.invoke, Decl(underscoreTest1_underscore.ts, 461, 59), Decl(underscoreTest1_underscore.ts, 463, 71)) var stooges = [{ name: 'moe', age: 40 }, { name: 'larry', age: 50 }, { name: 'curly', age: 60 }]; >stooges : Symbol(stooges, Decl(underscoreTest1_underscoreTests.ts, 33, 3)) @@ -153,15 +153,15 @@ var stooges = [{ name: 'moe', age: 40 }, { name: 'larry', age: 50 }, { name: 'cu >age : Symbol(age, Decl(underscoreTest1_underscoreTests.ts, 33, 85)) _.pluck(stooges, 'name'); ->_.pluck : Symbol(Underscore.Static.pluck, Decl(underscoreTest1_underscore.ts, 463, 81), Decl(underscoreTest1_underscore.ts, 465, 56)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->pluck : Symbol(Underscore.Static.pluck, Decl(underscoreTest1_underscore.ts, 463, 81), Decl(underscoreTest1_underscore.ts, 465, 56)) +>_.pluck : Symbol(Underscore.Static.pluck, Decl(underscoreTest1_underscore.ts, 464, 81), Decl(underscoreTest1_underscore.ts, 466, 56)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>pluck : Symbol(Underscore.Static.pluck, Decl(underscoreTest1_underscore.ts, 464, 81), Decl(underscoreTest1_underscore.ts, 466, 56)) >stooges : Symbol(stooges, Decl(underscoreTest1_underscoreTests.ts, 33, 3)) _.max(stooges, (stooge) => stooge.age); ->_.max : Symbol(Underscore.Static.max, Decl(underscoreTest1_underscore.ts, 466, 66), Decl(underscoreTest1_underscore.ts, 468, 73)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->max : Symbol(Underscore.Static.max, Decl(underscoreTest1_underscore.ts, 466, 66), Decl(underscoreTest1_underscore.ts, 468, 73)) +>_.max : Symbol(Underscore.Static.max, Decl(underscoreTest1_underscore.ts, 467, 66), Decl(underscoreTest1_underscore.ts, 469, 73)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>max : Symbol(Underscore.Static.max, Decl(underscoreTest1_underscore.ts, 467, 66), Decl(underscoreTest1_underscore.ts, 469, 73)) >stooges : Symbol(stooges, Decl(underscoreTest1_underscoreTests.ts, 33, 3)) >stooge : Symbol(stooge, Decl(underscoreTest1_underscoreTests.ts, 36, 16)) >stooge.age : Symbol(age, Decl(underscoreTest1_underscoreTests.ts, 33, 29)) @@ -172,15 +172,15 @@ var numbers = [10, 5, 100, 2, 1000]; >numbers : Symbol(numbers, Decl(underscoreTest1_underscoreTests.ts, 38, 3)) _.min(numbers); ->_.min : Symbol(Underscore.Static.min, Decl(underscoreTest1_underscore.ts, 469, 83), Decl(underscoreTest1_underscore.ts, 471, 73)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->min : Symbol(Underscore.Static.min, Decl(underscoreTest1_underscore.ts, 469, 83), Decl(underscoreTest1_underscore.ts, 471, 73)) +>_.min : Symbol(Underscore.Static.min, Decl(underscoreTest1_underscore.ts, 470, 83), Decl(underscoreTest1_underscore.ts, 472, 73)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>min : Symbol(Underscore.Static.min, Decl(underscoreTest1_underscore.ts, 470, 83), Decl(underscoreTest1_underscore.ts, 472, 73)) >numbers : Symbol(numbers, Decl(underscoreTest1_underscoreTests.ts, 38, 3)) _.sortBy([1, 2, 3, 4, 5, 6], (num) => Math.sin(num)); ->_.sortBy : Symbol(Underscore.Static.sortBy, Decl(underscoreTest1_underscore.ts, 472, 83), Decl(underscoreTest1_underscore.ts, 474, 77), Decl(underscoreTest1_underscore.ts, 475, 87), Decl(underscoreTest1_underscore.ts, 476, 56)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->sortBy : Symbol(Underscore.Static.sortBy, Decl(underscoreTest1_underscore.ts, 472, 83), Decl(underscoreTest1_underscore.ts, 474, 77), Decl(underscoreTest1_underscore.ts, 475, 87), Decl(underscoreTest1_underscore.ts, 476, 56)) +>_.sortBy : Symbol(Underscore.Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 83), Decl(underscoreTest1_underscore.ts, 475, 77), Decl(underscoreTest1_underscore.ts, 476, 87), Decl(underscoreTest1_underscore.ts, 477, 56)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>sortBy : Symbol(Underscore.Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 83), Decl(underscoreTest1_underscore.ts, 475, 77), Decl(underscoreTest1_underscore.ts, 476, 87), Decl(underscoreTest1_underscore.ts, 477, 56)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 41, 30)) >Math.sin : Symbol(Math.sin, Decl(lib.d.ts, 615, 29)) >Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11)) @@ -191,7 +191,7 @@ _.sortBy([1, 2, 3, 4, 5, 6], (num) => Math.sin(num)); // not sure how this is typechecking at all.. Math.floor(e) is number not string..? _([1.3, 2.1, 2.4]).groupBy((e: number, i?: number, list?: number[]) => Math.floor(e)); >_([1.3, 2.1, 2.4]).groupBy : Symbol(Underscore.WrappedArray.groupBy, Decl(underscoreTest1_underscore.ts, 112, 42), Decl(underscoreTest1_underscore.ts, 113, 77)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) >groupBy : Symbol(Underscore.WrappedArray.groupBy, Decl(underscoreTest1_underscore.ts, 112, 42), Decl(underscoreTest1_underscore.ts, 113, 77)) >e : Symbol(e, Decl(underscoreTest1_underscoreTests.ts, 45, 28)) >i : Symbol(i, Decl(underscoreTest1_underscoreTests.ts, 45, 38)) @@ -202,9 +202,9 @@ _([1.3, 2.1, 2.4]).groupBy((e: number, i?: number, list?: number[]) => Math.floo >e : Symbol(e, Decl(underscoreTest1_underscoreTests.ts, 45, 28)) _.groupBy([1.3, 2.1, 2.4], (num: number) => Math.floor(num)); ->_.groupBy : Symbol(Underscore.Static.groupBy, Decl(underscoreTest1_underscore.ts, 477, 66), Decl(underscoreTest1_underscore.ts, 479, 91), Decl(underscoreTest1_underscore.ts, 480, 101), Decl(underscoreTest1_underscore.ts, 481, 69)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->groupBy : Symbol(Underscore.Static.groupBy, Decl(underscoreTest1_underscore.ts, 477, 66), Decl(underscoreTest1_underscore.ts, 479, 91), Decl(underscoreTest1_underscore.ts, 480, 101), Decl(underscoreTest1_underscore.ts, 481, 69)) +>_.groupBy : Symbol(Underscore.Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>groupBy : Symbol(Underscore.Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 46, 28)) >Math.floor : Symbol(Math.floor, Decl(lib.d.ts, 582, 27)) >Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11)) @@ -212,28 +212,28 @@ _.groupBy([1.3, 2.1, 2.4], (num: number) => Math.floor(num)); >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 46, 28)) _.groupBy(['one', 'two', 'three'], 'length'); ->_.groupBy : Symbol(Underscore.Static.groupBy, Decl(underscoreTest1_underscore.ts, 477, 66), Decl(underscoreTest1_underscore.ts, 479, 91), Decl(underscoreTest1_underscore.ts, 480, 101), Decl(underscoreTest1_underscore.ts, 481, 69)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->groupBy : Symbol(Underscore.Static.groupBy, Decl(underscoreTest1_underscore.ts, 477, 66), Decl(underscoreTest1_underscore.ts, 479, 91), Decl(underscoreTest1_underscore.ts, 480, 101), Decl(underscoreTest1_underscore.ts, 481, 69)) +>_.groupBy : Symbol(Underscore.Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>groupBy : Symbol(Underscore.Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) _.countBy([1, 2, 3, 4, 5], (num) => num % 2 == 0 ? 'even' : 'odd'); ->_.countBy : Symbol(Underscore.Static.countBy, Decl(underscoreTest1_underscore.ts, 482, 79), Decl(underscoreTest1_underscore.ts, 484, 94), Decl(underscoreTest1_underscore.ts, 485, 104), Decl(underscoreTest1_underscore.ts, 486, 72)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->countBy : Symbol(Underscore.Static.countBy, Decl(underscoreTest1_underscore.ts, 482, 79), Decl(underscoreTest1_underscore.ts, 484, 94), Decl(underscoreTest1_underscore.ts, 485, 104), Decl(underscoreTest1_underscore.ts, 486, 72)) +>_.countBy : Symbol(Underscore.Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 94), Decl(underscoreTest1_underscore.ts, 486, 104), Decl(underscoreTest1_underscore.ts, 487, 72)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>countBy : Symbol(Underscore.Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 94), Decl(underscoreTest1_underscore.ts, 486, 104), Decl(underscoreTest1_underscore.ts, 487, 72)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 49, 28)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 49, 28)) _.shuffle([1, 2, 3, 4, 5, 6]); ->_.shuffle : Symbol(Underscore.Static.shuffle, Decl(underscoreTest1_underscore.ts, 487, 82), Decl(underscoreTest1_underscore.ts, 489, 35)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->shuffle : Symbol(Underscore.Static.shuffle, Decl(underscoreTest1_underscore.ts, 487, 82), Decl(underscoreTest1_underscore.ts, 489, 35)) +>_.shuffle : Symbol(Underscore.Static.shuffle, Decl(underscoreTest1_underscore.ts, 488, 82), Decl(underscoreTest1_underscore.ts, 490, 35)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>shuffle : Symbol(Underscore.Static.shuffle, Decl(underscoreTest1_underscore.ts, 488, 82), Decl(underscoreTest1_underscore.ts, 490, 35)) // (function(){ return _.toArray(arguments).slice(1); })(1, 2, 3, 4); _.size({ one: 1, two: 2, three: 3 }); ->_.size : Symbol(Underscore.Static.size, Decl(underscoreTest1_underscore.ts, 493, 45), Decl(underscoreTest1_underscore.ts, 495, 35)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->size : Symbol(Underscore.Static.size, Decl(underscoreTest1_underscore.ts, 493, 45), Decl(underscoreTest1_underscore.ts, 495, 35)) +>_.size : Symbol(Underscore.Static.size, Decl(underscoreTest1_underscore.ts, 494, 45), Decl(underscoreTest1_underscore.ts, 496, 35)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>size : Symbol(Underscore.Static.size, Decl(underscoreTest1_underscore.ts, 494, 45), Decl(underscoreTest1_underscore.ts, 496, 35)) >one : Symbol(one, Decl(underscoreTest1_underscoreTests.ts, 55, 8)) >two : Symbol(two, Decl(underscoreTest1_underscoreTests.ts, 55, 16)) >three : Symbol(three, Decl(underscoreTest1_underscoreTests.ts, 55, 24)) @@ -241,130 +241,130 @@ _.size({ one: 1, two: 2, three: 3 }); /////////////////////////////////////////////////////////////////////////////////////// _.first([5, 4, 3, 2, 1]); ->_.first : Symbol(Underscore.Static.first, Decl(underscoreTest1_underscore.ts, 496, 45), Decl(underscoreTest1_underscore.ts, 498, 31)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->first : Symbol(Underscore.Static.first, Decl(underscoreTest1_underscore.ts, 496, 45), Decl(underscoreTest1_underscore.ts, 498, 31)) +>_.first : Symbol(Underscore.Static.first, Decl(underscoreTest1_underscore.ts, 497, 45), Decl(underscoreTest1_underscore.ts, 499, 31)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>first : Symbol(Underscore.Static.first, Decl(underscoreTest1_underscore.ts, 497, 45), Decl(underscoreTest1_underscore.ts, 499, 31)) _.initial([5, 4, 3, 2, 1]); ->_.initial : Symbol(Underscore.Static.initial, Decl(underscoreTest1_underscore.ts, 503, 47), Decl(underscoreTest1_underscore.ts, 505, 33)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->initial : Symbol(Underscore.Static.initial, Decl(underscoreTest1_underscore.ts, 503, 47), Decl(underscoreTest1_underscore.ts, 505, 33)) +>_.initial : Symbol(Underscore.Static.initial, Decl(underscoreTest1_underscore.ts, 504, 47), Decl(underscoreTest1_underscore.ts, 506, 33)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>initial : Symbol(Underscore.Static.initial, Decl(underscoreTest1_underscore.ts, 504, 47), Decl(underscoreTest1_underscore.ts, 506, 33)) _.last([5, 4, 3, 2, 1]); ->_.last : Symbol(Underscore.Static.last, Decl(underscoreTest1_underscore.ts, 506, 50), Decl(underscoreTest1_underscore.ts, 508, 30)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->last : Symbol(Underscore.Static.last, Decl(underscoreTest1_underscore.ts, 506, 50), Decl(underscoreTest1_underscore.ts, 508, 30)) +>_.last : Symbol(Underscore.Static.last, Decl(underscoreTest1_underscore.ts, 507, 50), Decl(underscoreTest1_underscore.ts, 509, 30)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>last : Symbol(Underscore.Static.last, Decl(underscoreTest1_underscore.ts, 507, 50), Decl(underscoreTest1_underscore.ts, 509, 30)) _.rest([5, 4, 3, 2, 1]); ->_.rest : Symbol(Underscore.Static.rest, Decl(underscoreTest1_underscore.ts, 509, 47)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->rest : Symbol(Underscore.Static.rest, Decl(underscoreTest1_underscore.ts, 509, 47)) +>_.rest : Symbol(Underscore.Static.rest, Decl(underscoreTest1_underscore.ts, 510, 47)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>rest : Symbol(Underscore.Static.rest, Decl(underscoreTest1_underscore.ts, 510, 47)) _.compact([0, 1, false, 2, '', 3]); ->_.compact : Symbol(Underscore.Static.compact, Decl(underscoreTest1_underscore.ts, 511, 48)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->compact : Symbol(Underscore.Static.compact, Decl(underscoreTest1_underscore.ts, 511, 48)) +>_.compact : Symbol(Underscore.Static.compact, Decl(underscoreTest1_underscore.ts, 512, 48)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>compact : Symbol(Underscore.Static.compact, Decl(underscoreTest1_underscore.ts, 512, 48)) _.flatten([1, 2, 3, 4]); ->_.flatten : Symbol(Underscore.Static.flatten, Decl(underscoreTest1_underscore.ts, 513, 35), Decl(underscoreTest1_underscore.ts, 515, 37)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->flatten : Symbol(Underscore.Static.flatten, Decl(underscoreTest1_underscore.ts, 513, 35), Decl(underscoreTest1_underscore.ts, 515, 37)) +>_.flatten : Symbol(Underscore.Static.flatten, Decl(underscoreTest1_underscore.ts, 514, 35), Decl(underscoreTest1_underscore.ts, 516, 37)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>flatten : Symbol(Underscore.Static.flatten, Decl(underscoreTest1_underscore.ts, 514, 35), Decl(underscoreTest1_underscore.ts, 516, 37)) _.flatten([1, [2]]); ->_.flatten : Symbol(Underscore.Static.flatten, Decl(underscoreTest1_underscore.ts, 513, 35), Decl(underscoreTest1_underscore.ts, 515, 37)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->flatten : Symbol(Underscore.Static.flatten, Decl(underscoreTest1_underscore.ts, 513, 35), Decl(underscoreTest1_underscore.ts, 515, 37)) +>_.flatten : Symbol(Underscore.Static.flatten, Decl(underscoreTest1_underscore.ts, 514, 35), Decl(underscoreTest1_underscore.ts, 516, 37)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>flatten : Symbol(Underscore.Static.flatten, Decl(underscoreTest1_underscore.ts, 514, 35), Decl(underscoreTest1_underscore.ts, 516, 37)) // typescript doesn't like the elements being different _.flatten([1, [2], [3, [[4]]]]); ->_.flatten : Symbol(Underscore.Static.flatten, Decl(underscoreTest1_underscore.ts, 513, 35), Decl(underscoreTest1_underscore.ts, 515, 37)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->flatten : Symbol(Underscore.Static.flatten, Decl(underscoreTest1_underscore.ts, 513, 35), Decl(underscoreTest1_underscore.ts, 515, 37)) +>_.flatten : Symbol(Underscore.Static.flatten, Decl(underscoreTest1_underscore.ts, 514, 35), Decl(underscoreTest1_underscore.ts, 516, 37)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>flatten : Symbol(Underscore.Static.flatten, Decl(underscoreTest1_underscore.ts, 514, 35), Decl(underscoreTest1_underscore.ts, 516, 37)) _.flatten([1, [2], [3, [[4]]]], true); ->_.flatten : Symbol(Underscore.Static.flatten, Decl(underscoreTest1_underscore.ts, 513, 35), Decl(underscoreTest1_underscore.ts, 515, 37)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->flatten : Symbol(Underscore.Static.flatten, Decl(underscoreTest1_underscore.ts, 513, 35), Decl(underscoreTest1_underscore.ts, 515, 37)) +>_.flatten : Symbol(Underscore.Static.flatten, Decl(underscoreTest1_underscore.ts, 514, 35), Decl(underscoreTest1_underscore.ts, 516, 37)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>flatten : Symbol(Underscore.Static.flatten, Decl(underscoreTest1_underscore.ts, 514, 35), Decl(underscoreTest1_underscore.ts, 516, 37)) _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ->_.without : Symbol(Underscore.Static.without, Decl(underscoreTest1_underscore.ts, 516, 57)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->without : Symbol(Underscore.Static.without, Decl(underscoreTest1_underscore.ts, 516, 57)) +>_.without : Symbol(Underscore.Static.without, Decl(underscoreTest1_underscore.ts, 517, 57)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>without : Symbol(Underscore.Static.without, Decl(underscoreTest1_underscore.ts, 517, 57)) _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ->_.union : Symbol(Underscore.Static.union, Decl(underscoreTest1_underscore.ts, 518, 51)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->union : Symbol(Underscore.Static.union, Decl(underscoreTest1_underscore.ts, 518, 51)) +>_.union : Symbol(Underscore.Static.union, Decl(underscoreTest1_underscore.ts, 519, 51)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>union : Symbol(Underscore.Static.union, Decl(underscoreTest1_underscore.ts, 519, 51)) _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ->_.intersection : Symbol(Underscore.Static.intersection, Decl(underscoreTest1_underscore.ts, 520, 40)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->intersection : Symbol(Underscore.Static.intersection, Decl(underscoreTest1_underscore.ts, 520, 40)) +>_.intersection : Symbol(Underscore.Static.intersection, Decl(underscoreTest1_underscore.ts, 521, 40)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>intersection : Symbol(Underscore.Static.intersection, Decl(underscoreTest1_underscore.ts, 521, 40)) _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ->_.difference : Symbol(Underscore.Static.difference, Decl(underscoreTest1_underscore.ts, 522, 47)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->difference : Symbol(Underscore.Static.difference, Decl(underscoreTest1_underscore.ts, 522, 47)) +>_.difference : Symbol(Underscore.Static.difference, Decl(underscoreTest1_underscore.ts, 523, 47)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>difference : Symbol(Underscore.Static.difference, Decl(underscoreTest1_underscore.ts, 523, 47)) _.uniq([1, 2, 1, 3, 1, 4]); ->_.uniq : Symbol(Underscore.Static.uniq, Decl(underscoreTest1_underscore.ts, 524, 56), Decl(underscoreTest1_underscore.ts, 526, 52)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->uniq : Symbol(Underscore.Static.uniq, Decl(underscoreTest1_underscore.ts, 524, 56), Decl(underscoreTest1_underscore.ts, 526, 52)) +>_.uniq : Symbol(Underscore.Static.uniq, Decl(underscoreTest1_underscore.ts, 525, 56), Decl(underscoreTest1_underscore.ts, 527, 52)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>uniq : Symbol(Underscore.Static.uniq, Decl(underscoreTest1_underscore.ts, 525, 56), Decl(underscoreTest1_underscore.ts, 527, 52)) _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); ->_.zip : Symbol(Underscore.Static.zip, Decl(underscoreTest1_underscore.ts, 529, 97), Decl(underscoreTest1_underscore.ts, 531, 58), Decl(underscoreTest1_underscore.ts, 532, 76), Decl(underscoreTest1_underscore.ts, 533, 94)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->zip : Symbol(Underscore.Static.zip, Decl(underscoreTest1_underscore.ts, 529, 97), Decl(underscoreTest1_underscore.ts, 531, 58), Decl(underscoreTest1_underscore.ts, 532, 76), Decl(underscoreTest1_underscore.ts, 533, 94)) +>_.zip : Symbol(Underscore.Static.zip, Decl(underscoreTest1_underscore.ts, 530, 97), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>zip : Symbol(Underscore.Static.zip, Decl(underscoreTest1_underscore.ts, 530, 97), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) _.object(['moe', 'larry', 'curly'], [30, 40, 50]); ->_.object : Symbol(Underscore.Static.object, Decl(underscoreTest1_underscore.ts, 534, 41), Decl(underscoreTest1_underscore.ts, 536, 35)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->object : Symbol(Underscore.Static.object, Decl(underscoreTest1_underscore.ts, 534, 41), Decl(underscoreTest1_underscore.ts, 536, 35)) +>_.object : Symbol(Underscore.Static.object, Decl(underscoreTest1_underscore.ts, 535, 41), Decl(underscoreTest1_underscore.ts, 537, 35)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>object : Symbol(Underscore.Static.object, Decl(underscoreTest1_underscore.ts, 535, 41), Decl(underscoreTest1_underscore.ts, 537, 35)) _.object([['moe', 30], ['larry', 40], ['curly', 50]]); ->_.object : Symbol(Underscore.Static.object, Decl(underscoreTest1_underscore.ts, 534, 41), Decl(underscoreTest1_underscore.ts, 536, 35)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->object : Symbol(Underscore.Static.object, Decl(underscoreTest1_underscore.ts, 534, 41), Decl(underscoreTest1_underscore.ts, 536, 35)) +>_.object : Symbol(Underscore.Static.object, Decl(underscoreTest1_underscore.ts, 535, 41), Decl(underscoreTest1_underscore.ts, 537, 35)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>object : Symbol(Underscore.Static.object, Decl(underscoreTest1_underscore.ts, 535, 41), Decl(underscoreTest1_underscore.ts, 537, 35)) _.indexOf([1, 2, 3], 2); ->_.indexOf : Symbol(Underscore.Static.indexOf, Decl(underscoreTest1_underscore.ts, 537, 51)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->indexOf : Symbol(Underscore.Static.indexOf, Decl(underscoreTest1_underscore.ts, 537, 51)) +>_.indexOf : Symbol(Underscore.Static.indexOf, Decl(underscoreTest1_underscore.ts, 538, 51)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>indexOf : Symbol(Underscore.Static.indexOf, Decl(underscoreTest1_underscore.ts, 538, 51)) _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); ->_.lastIndexOf : Symbol(Underscore.Static.lastIndexOf, Decl(underscoreTest1_underscore.ts, 539, 68)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->lastIndexOf : Symbol(Underscore.Static.lastIndexOf, Decl(underscoreTest1_underscore.ts, 539, 68)) +>_.lastIndexOf : Symbol(Underscore.Static.lastIndexOf, Decl(underscoreTest1_underscore.ts, 540, 68)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>lastIndexOf : Symbol(Underscore.Static.lastIndexOf, Decl(underscoreTest1_underscore.ts, 540, 68)) _.sortedIndex([10, 20, 30, 40, 50], 35); ->_.sortedIndex : Symbol(Underscore.Static.sortedIndex, Decl(underscoreTest1_underscore.ts, 541, 72), Decl(underscoreTest1_underscore.ts, 543, 72)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->sortedIndex : Symbol(Underscore.Static.sortedIndex, Decl(underscoreTest1_underscore.ts, 541, 72), Decl(underscoreTest1_underscore.ts, 543, 72)) +>_.sortedIndex : Symbol(Underscore.Static.sortedIndex, Decl(underscoreTest1_underscore.ts, 542, 72), Decl(underscoreTest1_underscore.ts, 544, 72)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>sortedIndex : Symbol(Underscore.Static.sortedIndex, Decl(underscoreTest1_underscore.ts, 542, 72), Decl(underscoreTest1_underscore.ts, 544, 72)) _.range(10); ->_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 544, 94), Decl(underscoreTest1_underscore.ts, 546, 38)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 544, 94), Decl(underscoreTest1_underscore.ts, 546, 38)) +>_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) _.range(1, 11); ->_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 544, 94), Decl(underscoreTest1_underscore.ts, 546, 38)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 544, 94), Decl(underscoreTest1_underscore.ts, 546, 38)) +>_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) _.range(0, 30, 5); ->_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 544, 94), Decl(underscoreTest1_underscore.ts, 546, 38)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 544, 94), Decl(underscoreTest1_underscore.ts, 546, 38)) +>_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) _.range(0, 30, 5); ->_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 544, 94), Decl(underscoreTest1_underscore.ts, 546, 38)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 544, 94), Decl(underscoreTest1_underscore.ts, 546, 38)) +>_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) _.range(0); ->_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 544, 94), Decl(underscoreTest1_underscore.ts, 546, 38)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 544, 94), Decl(underscoreTest1_underscore.ts, 546, 38)) +>_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) /////////////////////////////////////////////////////////////////////////////////////// @@ -377,9 +377,9 @@ var func = function (greeting) { return greeting + ': ' + this.name }; // instead of the newly returned _bind => func type. var func2 = _.bind(func, { name: 'moe' }, 'hi'); >func2 : Symbol(func2, Decl(underscoreTest1_underscoreTests.ts, 93, 3)) ->_.bind : Symbol(Underscore.Static.bind, Decl(underscoreTest1_underscore.ts, 547, 68), Decl(underscoreTest1_underscore.ts, 549, 58)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->bind : Symbol(Underscore.Static.bind, Decl(underscoreTest1_underscore.ts, 547, 68), Decl(underscoreTest1_underscore.ts, 549, 58)) +>_.bind : Symbol(Underscore.Static.bind, Decl(underscoreTest1_underscore.ts, 548, 68), Decl(underscoreTest1_underscore.ts, 550, 58)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>bind : Symbol(Underscore.Static.bind, Decl(underscoreTest1_underscore.ts, 548, 68), Decl(underscoreTest1_underscore.ts, 550, 58)) >func : Symbol(func, Decl(underscoreTest1_underscoreTests.ts, 90, 3)) >name : Symbol(name, Decl(underscoreTest1_underscoreTests.ts, 93, 26)) @@ -402,9 +402,9 @@ var buttonView = { }; _.bindAll(buttonView); ->_.bindAll : Symbol(Underscore.Static.bindAll, Decl(underscoreTest1_underscore.ts, 550, 68)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->bindAll : Symbol(Underscore.Static.bindAll, Decl(underscoreTest1_underscore.ts, 550, 68)) +>_.bindAll : Symbol(Underscore.Static.bindAll, Decl(underscoreTest1_underscore.ts, 551, 68)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>bindAll : Symbol(Underscore.Static.bindAll, Decl(underscoreTest1_underscore.ts, 551, 68)) >buttonView : Symbol(buttonView, Decl(underscoreTest1_underscoreTests.ts, 96, 3)) $('#underscore_button').bind('click', buttonView.onClick); @@ -415,9 +415,9 @@ $('#underscore_button').bind('click', buttonView.onClick); var fibonacci = _.memoize(function (n) { >fibonacci : Symbol(fibonacci, Decl(underscoreTest1_underscoreTests.ts, 104, 3)) ->_.memoize : Symbol(Underscore.Static.memoize, Decl(underscoreTest1_underscore.ts, 554, 58)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->memoize : Symbol(Underscore.Static.memoize, Decl(underscoreTest1_underscore.ts, 554, 58)) +>_.memoize : Symbol(Underscore.Static.memoize, Decl(underscoreTest1_underscore.ts, 555, 58)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>memoize : Symbol(Underscore.Static.memoize, Decl(underscoreTest1_underscore.ts, 555, 58)) >n : Symbol(n, Decl(underscoreTest1_underscoreTests.ts, 104, 36)) return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2); @@ -432,23 +432,23 @@ var fibonacci = _.memoize(function (n) { var log = _.bind((message?: string, ...rest: string[]) => { }, Date); >log : Symbol(log, Decl(underscoreTest1_underscoreTests.ts, 108, 3)) ->_.bind : Symbol(Underscore.Static.bind, Decl(underscoreTest1_underscore.ts, 547, 68), Decl(underscoreTest1_underscore.ts, 549, 58)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->bind : Symbol(Underscore.Static.bind, Decl(underscoreTest1_underscore.ts, 547, 68), Decl(underscoreTest1_underscore.ts, 549, 58)) +>_.bind : Symbol(Underscore.Static.bind, Decl(underscoreTest1_underscore.ts, 548, 68), Decl(underscoreTest1_underscore.ts, 550, 58)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>bind : Symbol(Underscore.Static.bind, Decl(underscoreTest1_underscore.ts, 548, 68), Decl(underscoreTest1_underscore.ts, 550, 58)) >message : Symbol(message, Decl(underscoreTest1_underscoreTests.ts, 108, 18)) >rest : Symbol(rest, Decl(underscoreTest1_underscoreTests.ts, 108, 35)) >Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11)) _.delay(log, 1000, 'logged later'); ->_.delay : Symbol(Underscore.Static.delay, Decl(underscoreTest1_underscore.ts, 556, 73)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->delay : Symbol(Underscore.Static.delay, Decl(underscoreTest1_underscore.ts, 556, 73)) +>_.delay : Symbol(Underscore.Static.delay, Decl(underscoreTest1_underscore.ts, 557, 73)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>delay : Symbol(Underscore.Static.delay, Decl(underscoreTest1_underscore.ts, 557, 73)) >log : Symbol(log, Decl(underscoreTest1_underscoreTests.ts, 108, 3)) _.defer(function () { alert('deferred'); }); ->_.defer : Symbol(Underscore.Static.defer, Decl(underscoreTest1_underscore.ts, 558, 68)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->defer : Symbol(Underscore.Static.defer, Decl(underscoreTest1_underscore.ts, 558, 68)) +>_.defer : Symbol(Underscore.Static.defer, Decl(underscoreTest1_underscore.ts, 559, 68)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>defer : Symbol(Underscore.Static.defer, Decl(underscoreTest1_underscore.ts, 559, 68)) >alert : Symbol(alert, Decl(underscoreTest1_underscoreTests.ts, 2, 14)) var updatePosition = () => alert('updating position...'); @@ -457,9 +457,9 @@ var updatePosition = () => alert('updating position...'); var throttled = _.throttle(updatePosition, 100); >throttled : Symbol(throttled, Decl(underscoreTest1_underscoreTests.ts, 114, 3)) ->_.throttle : Symbol(Underscore.Static.throttle, Decl(underscoreTest1_underscore.ts, 560, 54)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->throttle : Symbol(Underscore.Static.throttle, Decl(underscoreTest1_underscore.ts, 560, 54)) +>_.throttle : Symbol(Underscore.Static.throttle, Decl(underscoreTest1_underscore.ts, 561, 54)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>throttle : Symbol(Underscore.Static.throttle, Decl(underscoreTest1_underscore.ts, 561, 54)) >updatePosition : Symbol(updatePosition, Decl(underscoreTest1_underscoreTests.ts, 113, 3)) $(null).scroll(throttled); @@ -472,9 +472,9 @@ var calculateLayout = () => alert('calculating layout...'); var lazyLayout = _.debounce(calculateLayout, 300); >lazyLayout : Symbol(lazyLayout, Decl(underscoreTest1_underscoreTests.ts, 118, 3)) ->_.debounce : Symbol(Underscore.Static.debounce, Decl(underscoreTest1_underscore.ts, 562, 63)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->debounce : Symbol(Underscore.Static.debounce, Decl(underscoreTest1_underscore.ts, 562, 63)) +>_.debounce : Symbol(Underscore.Static.debounce, Decl(underscoreTest1_underscore.ts, 563, 63)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>debounce : Symbol(Underscore.Static.debounce, Decl(underscoreTest1_underscore.ts, 563, 63)) >calculateLayout : Symbol(calculateLayout, Decl(underscoreTest1_underscoreTests.ts, 117, 3)) $(null).resize(lazyLayout); @@ -487,9 +487,9 @@ var createApplication = () => alert('creating application...'); var initialize = _.once(createApplication); >initialize : Symbol(initialize, Decl(underscoreTest1_underscoreTests.ts, 122, 3)) ->_.once : Symbol(Underscore.Static.once, Decl(underscoreTest1_underscore.ts, 564, 84)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->once : Symbol(Underscore.Static.once, Decl(underscoreTest1_underscore.ts, 564, 84)) +>_.once : Symbol(Underscore.Static.once, Decl(underscoreTest1_underscore.ts, 565, 84)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>once : Symbol(Underscore.Static.once, Decl(underscoreTest1_underscore.ts, 565, 84)) >createApplication : Symbol(createApplication, Decl(underscoreTest1_underscoreTests.ts, 121, 3)) initialize(); @@ -507,18 +507,18 @@ var render = () => alert("rendering..."); var renderNotes = _.after(notes.length, render); >renderNotes : Symbol(renderNotes, Decl(underscoreTest1_underscoreTests.ts, 128, 3)) ->_.after : Symbol(Underscore.Static.after, Decl(underscoreTest1_underscore.ts, 566, 45)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->after : Symbol(Underscore.Static.after, Decl(underscoreTest1_underscore.ts, 566, 45)) +>_.after : Symbol(Underscore.Static.after, Decl(underscoreTest1_underscore.ts, 567, 45)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>after : Symbol(Underscore.Static.after, Decl(underscoreTest1_underscore.ts, 567, 45)) >notes.length : Symbol(Array.length, Decl(lib.d.ts, 1007, 20)) >notes : Symbol(notes, Decl(underscoreTest1_underscoreTests.ts, 126, 3)) >length : Symbol(Array.length, Decl(lib.d.ts, 1007, 20)) >render : Symbol(render, Decl(underscoreTest1_underscoreTests.ts, 127, 3)) _.each(notes, (note) => note.asyncSave({ success: renderNotes })); ->_.each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 394, 43), Decl(underscoreTest1_underscore.ts, 396, 77)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 394, 43), Decl(underscoreTest1_underscore.ts, 396, 77)) +>_.each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) >notes : Symbol(notes, Decl(underscoreTest1_underscoreTests.ts, 126, 3)) >note : Symbol(note, Decl(underscoreTest1_underscoreTests.ts, 129, 15)) >note : Symbol(note, Decl(underscoreTest1_underscoreTests.ts, 129, 15)) @@ -532,9 +532,9 @@ var hello = function (name) { return "hello: " + name; }; hello = _.wrap(hello, (func, arg) => { return "before, " + func(arg) + ", after"; }); >hello : Symbol(hello, Decl(underscoreTest1_underscoreTests.ts, 131, 3)) ->_.wrap : Symbol(Underscore.Static.wrap, Decl(underscoreTest1_underscore.ts, 568, 61)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->wrap : Symbol(Underscore.Static.wrap, Decl(underscoreTest1_underscore.ts, 568, 61)) +>_.wrap : Symbol(Underscore.Static.wrap, Decl(underscoreTest1_underscore.ts, 569, 61)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>wrap : Symbol(Underscore.Static.wrap, Decl(underscoreTest1_underscore.ts, 569, 61)) >hello : Symbol(hello, Decl(underscoreTest1_underscoreTests.ts, 131, 3)) >func : Symbol(func, Decl(underscoreTest1_underscoreTests.ts, 132, 23)) >arg : Symbol(arg, Decl(underscoreTest1_underscoreTests.ts, 132, 28)) @@ -556,9 +556,9 @@ var exclaim = function (statement) { return statement + "!"; }; var welcome = _.compose(exclaim, greet); >welcome : Symbol(welcome, Decl(underscoreTest1_underscoreTests.ts, 137, 3)) ->_.compose : Symbol(Underscore.Static.compose, Decl(underscoreTest1_underscore.ts, 570, 88)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->compose : Symbol(Underscore.Static.compose, Decl(underscoreTest1_underscore.ts, 570, 88)) +>_.compose : Symbol(Underscore.Static.compose, Decl(underscoreTest1_underscore.ts, 571, 88)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>compose : Symbol(Underscore.Static.compose, Decl(underscoreTest1_underscore.ts, 571, 88)) >exclaim : Symbol(exclaim, Decl(underscoreTest1_underscoreTests.ts, 136, 3)) >greet : Symbol(greet, Decl(underscoreTest1_underscoreTests.ts, 135, 3)) @@ -568,62 +568,62 @@ welcome('moe'); /////////////////////////////////////////////////////////////////////////////////////// _.keys({ one: 1, two: 2, three: 3 }); ->_.keys : Symbol(Underscore.Static.keys, Decl(underscoreTest1_underscore.ts, 572, 48)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->keys : Symbol(Underscore.Static.keys, Decl(underscoreTest1_underscore.ts, 572, 48)) +>_.keys : Symbol(Underscore.Static.keys, Decl(underscoreTest1_underscore.ts, 573, 48)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>keys : Symbol(Underscore.Static.keys, Decl(underscoreTest1_underscore.ts, 573, 48)) >one : Symbol(one, Decl(underscoreTest1_underscoreTests.ts, 142, 8)) >two : Symbol(two, Decl(underscoreTest1_underscoreTests.ts, 142, 16)) >three : Symbol(three, Decl(underscoreTest1_underscoreTests.ts, 142, 24)) _.values({ one: 1, two: 2, three: 3 }); ->_.values : Symbol(Underscore.Static.values, Decl(underscoreTest1_underscore.ts, 574, 36)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->values : Symbol(Underscore.Static.values, Decl(underscoreTest1_underscore.ts, 574, 36)) +>_.values : Symbol(Underscore.Static.values, Decl(underscoreTest1_underscore.ts, 575, 36)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>values : Symbol(Underscore.Static.values, Decl(underscoreTest1_underscore.ts, 575, 36)) >one : Symbol(one, Decl(underscoreTest1_underscoreTests.ts, 143, 10)) >two : Symbol(two, Decl(underscoreTest1_underscoreTests.ts, 143, 18)) >three : Symbol(three, Decl(underscoreTest1_underscoreTests.ts, 143, 26)) _.pairs({ one: 1, two: 2, three: 3 }); ->_.pairs : Symbol(Underscore.Static.pairs, Decl(underscoreTest1_underscore.ts, 576, 35)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->pairs : Symbol(Underscore.Static.pairs, Decl(underscoreTest1_underscore.ts, 576, 35)) +>_.pairs : Symbol(Underscore.Static.pairs, Decl(underscoreTest1_underscore.ts, 577, 35)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>pairs : Symbol(Underscore.Static.pairs, Decl(underscoreTest1_underscore.ts, 577, 35)) >one : Symbol(one, Decl(underscoreTest1_underscoreTests.ts, 144, 9)) >two : Symbol(two, Decl(underscoreTest1_underscoreTests.ts, 144, 17)) >three : Symbol(three, Decl(underscoreTest1_underscoreTests.ts, 144, 25)) _.invert({ Moe: "Moses", Larry: "Louis", Curly: "Jerome" }); ->_.invert : Symbol(Underscore.Static.invert, Decl(underscoreTest1_underscore.ts, 578, 36)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->invert : Symbol(Underscore.Static.invert, Decl(underscoreTest1_underscore.ts, 578, 36)) +>_.invert : Symbol(Underscore.Static.invert, Decl(underscoreTest1_underscore.ts, 579, 36)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>invert : Symbol(Underscore.Static.invert, Decl(underscoreTest1_underscore.ts, 579, 36)) >Moe : Symbol(Moe, Decl(underscoreTest1_underscoreTests.ts, 145, 10)) >Larry : Symbol(Larry, Decl(underscoreTest1_underscoreTests.ts, 145, 24)) >Curly : Symbol(Curly, Decl(underscoreTest1_underscoreTests.ts, 145, 40)) _.functions(_); ->_.functions : Symbol(Underscore.Static.functions, Decl(underscoreTest1_underscore.ts, 580, 33)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->functions : Symbol(Underscore.Static.functions, Decl(underscoreTest1_underscore.ts, 580, 33)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) +>_.functions : Symbol(Underscore.Static.functions, Decl(underscoreTest1_underscore.ts, 581, 33)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>functions : Symbol(Underscore.Static.functions, Decl(underscoreTest1_underscore.ts, 581, 33)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) _.extend({ name: 'moe' }, { age: 50 }); ->_.extend : Symbol(Underscore.Static.extend, Decl(underscoreTest1_underscore.ts, 583, 39)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->extend : Symbol(Underscore.Static.extend, Decl(underscoreTest1_underscore.ts, 583, 39)) +>_.extend : Symbol(Underscore.Static.extend, Decl(underscoreTest1_underscore.ts, 584, 39)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>extend : Symbol(Underscore.Static.extend, Decl(underscoreTest1_underscore.ts, 584, 39)) >name : Symbol(name, Decl(underscoreTest1_underscoreTests.ts, 147, 10)) >age : Symbol(age, Decl(underscoreTest1_underscoreTests.ts, 147, 27)) _.pick({ name: 'moe', age: 50, userid: 'moe1' }, 'name', 'age'); ->_.pick : Symbol(Underscore.Static.pick, Decl(underscoreTest1_underscore.ts, 585, 56)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->pick : Symbol(Underscore.Static.pick, Decl(underscoreTest1_underscore.ts, 585, 56)) +>_.pick : Symbol(Underscore.Static.pick, Decl(underscoreTest1_underscore.ts, 586, 56)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>pick : Symbol(Underscore.Static.pick, Decl(underscoreTest1_underscore.ts, 586, 56)) >name : Symbol(name, Decl(underscoreTest1_underscoreTests.ts, 148, 8)) >age : Symbol(age, Decl(underscoreTest1_underscoreTests.ts, 148, 21)) >userid : Symbol(userid, Decl(underscoreTest1_underscoreTests.ts, 148, 30)) _.omit({ name: 'moe', age: 50, userid: 'moe1' }, 'userid'); ->_.omit : Symbol(Underscore.Static.omit, Decl(underscoreTest1_underscore.ts, 587, 49)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->omit : Symbol(Underscore.Static.omit, Decl(underscoreTest1_underscore.ts, 587, 49)) +>_.omit : Symbol(Underscore.Static.omit, Decl(underscoreTest1_underscore.ts, 588, 49)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>omit : Symbol(Underscore.Static.omit, Decl(underscoreTest1_underscore.ts, 588, 49)) >name : Symbol(name, Decl(underscoreTest1_underscoreTests.ts, 149, 8)) >age : Symbol(age, Decl(underscoreTest1_underscoreTests.ts, 149, 21)) >userid : Symbol(userid, Decl(underscoreTest1_underscoreTests.ts, 149, 30)) @@ -633,17 +633,17 @@ var iceCream = { flavor: "chocolate" }; >flavor : Symbol(flavor, Decl(underscoreTest1_underscoreTests.ts, 151, 16)) _.defaults(iceCream, { flavor: "vanilla", sprinkles: "lots" }); ->_.defaults : Symbol(Underscore.Static.defaults, Decl(underscoreTest1_underscore.ts, 589, 49)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->defaults : Symbol(Underscore.Static.defaults, Decl(underscoreTest1_underscore.ts, 589, 49)) +>_.defaults : Symbol(Underscore.Static.defaults, Decl(underscoreTest1_underscore.ts, 590, 49)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>defaults : Symbol(Underscore.Static.defaults, Decl(underscoreTest1_underscore.ts, 590, 49)) >iceCream : Symbol(iceCream, Decl(underscoreTest1_underscoreTests.ts, 151, 3)) >flavor : Symbol(flavor, Decl(underscoreTest1_underscoreTests.ts, 152, 22)) >sprinkles : Symbol(sprinkles, Decl(underscoreTest1_underscoreTests.ts, 152, 41)) _.clone({ name: 'moe' }); ->_.clone : Symbol(Underscore.Static.clone, Decl(underscoreTest1_underscore.ts, 591, 54)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->clone : Symbol(Underscore.Static.clone, Decl(underscoreTest1_underscore.ts, 591, 54)) +>_.clone : Symbol(Underscore.Static.clone, Decl(underscoreTest1_underscore.ts, 592, 54)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>clone : Symbol(Underscore.Static.clone, Decl(underscoreTest1_underscore.ts, 592, 54)) >name : Symbol(name, Decl(underscoreTest1_underscoreTests.ts, 154, 9)) _.chain([1, 2, 3, 200]) @@ -651,9 +651,9 @@ _.chain([1, 2, 3, 200]) >_.chain([1, 2, 3, 200]) .filter(function (num) { return num % 2 == 0; }) .tap(alert) .map : Symbol(Underscore.ChainedArray.map, Decl(underscoreTest1_underscore.ts, 240, 81)) >_.chain([1, 2, 3, 200]) .filter(function (num) { return num % 2 == 0; }) .tap : Symbol(Underscore.ChainedArray.tap, Decl(underscoreTest1_underscore.ts, 325, 33)) >_.chain([1, 2, 3, 200]) .filter : Symbol(Underscore.ChainedArray.filter, Decl(underscoreTest1_underscore.ts, 254, 80)) ->_.chain : Symbol(Underscore.Static.chain, Decl(underscoreTest1_underscore.ts, 390, 38), Decl(underscoreTest1_underscore.ts, 392, 45), Decl(underscoreTest1_underscore.ts, 393, 60)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->chain : Symbol(Underscore.Static.chain, Decl(underscoreTest1_underscore.ts, 390, 38), Decl(underscoreTest1_underscore.ts, 392, 45), Decl(underscoreTest1_underscore.ts, 393, 60)) +>_.chain : Symbol(Underscore.Static.chain, Decl(underscoreTest1_underscore.ts, 391, 38), Decl(underscoreTest1_underscore.ts, 393, 45), Decl(underscoreTest1_underscore.ts, 394, 60)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>chain : Symbol(Underscore.Static.chain, Decl(underscoreTest1_underscore.ts, 391, 38), Decl(underscoreTest1_underscore.ts, 393, 45), Decl(underscoreTest1_underscore.ts, 394, 60)) .filter(function (num) { return num % 2 == 0; }) >filter : Symbol(Underscore.ChainedArray.filter, Decl(underscoreTest1_underscore.ts, 254, 80)) @@ -674,9 +674,9 @@ _.chain([1, 2, 3, 200]) >value : Symbol(Underscore.ChainedObject.value, Decl(underscoreTest1_underscore.ts, 234, 46)) _.has({ a: 1, b: 2, c: 3 }, "b"); ->_.has : Symbol(Underscore.Static.has, Decl(underscoreTest1_underscore.ts, 595, 63)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->has : Symbol(Underscore.Static.has, Decl(underscoreTest1_underscore.ts, 595, 63)) +>_.has : Symbol(Underscore.Static.has, Decl(underscoreTest1_underscore.ts, 596, 63)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>has : Symbol(Underscore.Static.has, Decl(underscoreTest1_underscore.ts, 596, 63)) >a : Symbol(a, Decl(underscoreTest1_underscoreTests.ts, 162, 7)) >b : Symbol(b, Decl(underscoreTest1_underscoreTests.ts, 162, 13)) >c : Symbol(c, Decl(underscoreTest1_underscoreTests.ts, 162, 19)) @@ -696,103 +696,103 @@ moe == clone; >clone : Symbol(clone, Decl(underscoreTest1_underscoreTests.ts, 165, 3)) _.isEqual(moe, clone); ->_.isEqual : Symbol(Underscore.Static.isEqual, Decl(underscoreTest1_underscore.ts, 597, 47)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isEqual : Symbol(Underscore.Static.isEqual, Decl(underscoreTest1_underscore.ts, 597, 47)) +>_.isEqual : Symbol(Underscore.Static.isEqual, Decl(underscoreTest1_underscore.ts, 598, 47)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isEqual : Symbol(Underscore.Static.isEqual, Decl(underscoreTest1_underscore.ts, 598, 47)) >moe : Symbol(moe, Decl(underscoreTest1_underscoreTests.ts, 164, 3)) >clone : Symbol(clone, Decl(underscoreTest1_underscoreTests.ts, 165, 3)) _.isEmpty([1, 2, 3]); ->_.isEmpty : Symbol(Underscore.Static.isEmpty, Decl(underscoreTest1_underscore.ts, 599, 49)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isEmpty : Symbol(Underscore.Static.isEmpty, Decl(underscoreTest1_underscore.ts, 599, 49)) +>_.isEmpty : Symbol(Underscore.Static.isEmpty, Decl(underscoreTest1_underscore.ts, 600, 49)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isEmpty : Symbol(Underscore.Static.isEmpty, Decl(underscoreTest1_underscore.ts, 600, 49)) _.isEmpty({}); ->_.isEmpty : Symbol(Underscore.Static.isEmpty, Decl(underscoreTest1_underscore.ts, 599, 49)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isEmpty : Symbol(Underscore.Static.isEmpty, Decl(underscoreTest1_underscore.ts, 599, 49)) +>_.isEmpty : Symbol(Underscore.Static.isEmpty, Decl(underscoreTest1_underscore.ts, 600, 49)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isEmpty : Symbol(Underscore.Static.isEmpty, Decl(underscoreTest1_underscore.ts, 600, 49)) _.isElement($('body')[0]); ->_.isElement : Symbol(Underscore.Static.isElement, Decl(underscoreTest1_underscore.ts, 601, 38)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isElement : Symbol(Underscore.Static.isElement, Decl(underscoreTest1_underscore.ts, 601, 38)) +>_.isElement : Symbol(Underscore.Static.isElement, Decl(underscoreTest1_underscore.ts, 602, 38)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isElement : Symbol(Underscore.Static.isElement, Decl(underscoreTest1_underscore.ts, 602, 38)) >$ : Symbol($, Decl(underscoreTest1_underscoreTests.ts, 2, 11)) (function () { return _.isArray(arguments); })(); ->_.isArray : Symbol(Underscore.Static.isArray, Decl(underscoreTest1_underscore.ts, 602, 40)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isArray : Symbol(Underscore.Static.isArray, Decl(underscoreTest1_underscore.ts, 602, 40)) +>_.isArray : Symbol(Underscore.Static.isArray, Decl(underscoreTest1_underscore.ts, 603, 40)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isArray : Symbol(Underscore.Static.isArray, Decl(underscoreTest1_underscore.ts, 603, 40)) >arguments : Symbol(arguments) _.isArray([1, 2, 3]); ->_.isArray : Symbol(Underscore.Static.isArray, Decl(underscoreTest1_underscore.ts, 602, 40)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isArray : Symbol(Underscore.Static.isArray, Decl(underscoreTest1_underscore.ts, 602, 40)) +>_.isArray : Symbol(Underscore.Static.isArray, Decl(underscoreTest1_underscore.ts, 603, 40)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isArray : Symbol(Underscore.Static.isArray, Decl(underscoreTest1_underscore.ts, 603, 40)) _.isObject({}); ->_.isObject : Symbol(Underscore.Static.isObject, Decl(underscoreTest1_underscore.ts, 603, 38)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isObject : Symbol(Underscore.Static.isObject, Decl(underscoreTest1_underscore.ts, 603, 38)) +>_.isObject : Symbol(Underscore.Static.isObject, Decl(underscoreTest1_underscore.ts, 604, 38)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isObject : Symbol(Underscore.Static.isObject, Decl(underscoreTest1_underscore.ts, 604, 38)) _.isObject(1); ->_.isObject : Symbol(Underscore.Static.isObject, Decl(underscoreTest1_underscore.ts, 603, 38)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isObject : Symbol(Underscore.Static.isObject, Decl(underscoreTest1_underscore.ts, 603, 38)) +>_.isObject : Symbol(Underscore.Static.isObject, Decl(underscoreTest1_underscore.ts, 604, 38)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isObject : Symbol(Underscore.Static.isObject, Decl(underscoreTest1_underscore.ts, 604, 38)) // (() => { return _.isArguments(arguments); })(1, 2, 3); _.isArguments([1, 2, 3]); ->_.isArguments : Symbol(Underscore.Static.isArguments, Decl(underscoreTest1_underscore.ts, 604, 38)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isArguments : Symbol(Underscore.Static.isArguments, Decl(underscoreTest1_underscore.ts, 604, 38)) +>_.isArguments : Symbol(Underscore.Static.isArguments, Decl(underscoreTest1_underscore.ts, 605, 38)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isArguments : Symbol(Underscore.Static.isArguments, Decl(underscoreTest1_underscore.ts, 605, 38)) _.isFunction(alert); ->_.isFunction : Symbol(Underscore.Static.isFunction, Decl(underscoreTest1_underscore.ts, 605, 42)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isFunction : Symbol(Underscore.Static.isFunction, Decl(underscoreTest1_underscore.ts, 605, 42)) +>_.isFunction : Symbol(Underscore.Static.isFunction, Decl(underscoreTest1_underscore.ts, 606, 42)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isFunction : Symbol(Underscore.Static.isFunction, Decl(underscoreTest1_underscore.ts, 606, 42)) >alert : Symbol(alert, Decl(underscoreTest1_underscoreTests.ts, 2, 14)) _.isString("moe"); ->_.isString : Symbol(Underscore.Static.isString, Decl(underscoreTest1_underscore.ts, 606, 41)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isString : Symbol(Underscore.Static.isString, Decl(underscoreTest1_underscore.ts, 606, 41)) +>_.isString : Symbol(Underscore.Static.isString, Decl(underscoreTest1_underscore.ts, 607, 41)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isString : Symbol(Underscore.Static.isString, Decl(underscoreTest1_underscore.ts, 607, 41)) _.isNumber(8.4 * 5); ->_.isNumber : Symbol(Underscore.Static.isNumber, Decl(underscoreTest1_underscore.ts, 607, 39)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isNumber : Symbol(Underscore.Static.isNumber, Decl(underscoreTest1_underscore.ts, 607, 39)) +>_.isNumber : Symbol(Underscore.Static.isNumber, Decl(underscoreTest1_underscore.ts, 608, 39)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isNumber : Symbol(Underscore.Static.isNumber, Decl(underscoreTest1_underscore.ts, 608, 39)) _.isFinite(-101); ->_.isFinite : Symbol(Underscore.Static.isFinite, Decl(underscoreTest1_underscore.ts, 608, 39)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isFinite : Symbol(Underscore.Static.isFinite, Decl(underscoreTest1_underscore.ts, 608, 39)) +>_.isFinite : Symbol(Underscore.Static.isFinite, Decl(underscoreTest1_underscore.ts, 609, 39)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isFinite : Symbol(Underscore.Static.isFinite, Decl(underscoreTest1_underscore.ts, 609, 39)) _.isFinite(-Infinity); ->_.isFinite : Symbol(Underscore.Static.isFinite, Decl(underscoreTest1_underscore.ts, 608, 39)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isFinite : Symbol(Underscore.Static.isFinite, Decl(underscoreTest1_underscore.ts, 608, 39)) +>_.isFinite : Symbol(Underscore.Static.isFinite, Decl(underscoreTest1_underscore.ts, 609, 39)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isFinite : Symbol(Underscore.Static.isFinite, Decl(underscoreTest1_underscore.ts, 609, 39)) >Infinity : Symbol(Infinity, Decl(lib.d.ts, 22, 11)) _.isBoolean(null); ->_.isBoolean : Symbol(Underscore.Static.isBoolean, Decl(underscoreTest1_underscore.ts, 609, 39)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isBoolean : Symbol(Underscore.Static.isBoolean, Decl(underscoreTest1_underscore.ts, 609, 39)) +>_.isBoolean : Symbol(Underscore.Static.isBoolean, Decl(underscoreTest1_underscore.ts, 610, 39)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isBoolean : Symbol(Underscore.Static.isBoolean, Decl(underscoreTest1_underscore.ts, 610, 39)) _.isDate(new Date()); ->_.isDate : Symbol(Underscore.Static.isDate, Decl(underscoreTest1_underscore.ts, 610, 40)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isDate : Symbol(Underscore.Static.isDate, Decl(underscoreTest1_underscore.ts, 610, 40)) +>_.isDate : Symbol(Underscore.Static.isDate, Decl(underscoreTest1_underscore.ts, 611, 40)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isDate : Symbol(Underscore.Static.isDate, Decl(underscoreTest1_underscore.ts, 611, 40)) >Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11)) _.isRegExp(/moe/); ->_.isRegExp : Symbol(Underscore.Static.isRegExp, Decl(underscoreTest1_underscore.ts, 611, 37)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isRegExp : Symbol(Underscore.Static.isRegExp, Decl(underscoreTest1_underscore.ts, 611, 37)) +>_.isRegExp : Symbol(Underscore.Static.isRegExp, Decl(underscoreTest1_underscore.ts, 612, 37)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isRegExp : Symbol(Underscore.Static.isRegExp, Decl(underscoreTest1_underscore.ts, 612, 37)) _.isNaN(NaN); ->_.isNaN : Symbol(Underscore.Static.isNaN, Decl(underscoreTest1_underscore.ts, 612, 39)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isNaN : Symbol(Underscore.Static.isNaN, Decl(underscoreTest1_underscore.ts, 612, 39)) +>_.isNaN : Symbol(Underscore.Static.isNaN, Decl(underscoreTest1_underscore.ts, 613, 39)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isNaN : Symbol(Underscore.Static.isNaN, Decl(underscoreTest1_underscore.ts, 613, 39)) >NaN : Symbol(NaN, Decl(lib.d.ts, 21, 11)) isNaN(undefined); @@ -800,34 +800,34 @@ isNaN(undefined); >undefined : Symbol(undefined) _.isNaN(undefined); ->_.isNaN : Symbol(Underscore.Static.isNaN, Decl(underscoreTest1_underscore.ts, 612, 39)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isNaN : Symbol(Underscore.Static.isNaN, Decl(underscoreTest1_underscore.ts, 612, 39)) +>_.isNaN : Symbol(Underscore.Static.isNaN, Decl(underscoreTest1_underscore.ts, 613, 39)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isNaN : Symbol(Underscore.Static.isNaN, Decl(underscoreTest1_underscore.ts, 613, 39)) >undefined : Symbol(undefined) _.isNull(null); ->_.isNull : Symbol(Underscore.Static.isNull, Decl(underscoreTest1_underscore.ts, 613, 36)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isNull : Symbol(Underscore.Static.isNull, Decl(underscoreTest1_underscore.ts, 613, 36)) +>_.isNull : Symbol(Underscore.Static.isNull, Decl(underscoreTest1_underscore.ts, 614, 36)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isNull : Symbol(Underscore.Static.isNull, Decl(underscoreTest1_underscore.ts, 614, 36)) _.isNull(undefined); ->_.isNull : Symbol(Underscore.Static.isNull, Decl(underscoreTest1_underscore.ts, 613, 36)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isNull : Symbol(Underscore.Static.isNull, Decl(underscoreTest1_underscore.ts, 613, 36)) +>_.isNull : Symbol(Underscore.Static.isNull, Decl(underscoreTest1_underscore.ts, 614, 36)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isNull : Symbol(Underscore.Static.isNull, Decl(underscoreTest1_underscore.ts, 614, 36)) >undefined : Symbol(undefined) _.isUndefined((null).missingVariable); ->_.isUndefined : Symbol(Underscore.Static.isUndefined, Decl(underscoreTest1_underscore.ts, 614, 37)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->isUndefined : Symbol(Underscore.Static.isUndefined, Decl(underscoreTest1_underscore.ts, 614, 37)) +>_.isUndefined : Symbol(Underscore.Static.isUndefined, Decl(underscoreTest1_underscore.ts, 615, 37)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>isUndefined : Symbol(Underscore.Static.isUndefined, Decl(underscoreTest1_underscore.ts, 615, 37)) /////////////////////////////////////////////////////////////////////////////////////// var underscore = _.noConflict(); >underscore : Symbol(underscore, Decl(underscoreTest1_underscoreTests.ts, 211, 3)) ->_.noConflict : Symbol(Underscore.Static.noConflict, Decl(underscoreTest1_underscore.ts, 615, 41)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->noConflict : Symbol(Underscore.Static.noConflict, Decl(underscoreTest1_underscore.ts, 615, 41)) +>_.noConflict : Symbol(Underscore.Static.noConflict, Decl(underscoreTest1_underscore.ts, 616, 41)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>noConflict : Symbol(Underscore.Static.noConflict, Decl(underscoreTest1_underscore.ts, 616, 41)) var moe2 = { name: 'moe' }; >moe2 : Symbol(moe2, Decl(underscoreTest1_underscoreTests.ts, 213, 3)) @@ -835,31 +835,31 @@ var moe2 = { name: 'moe' }; moe2 === _.identity(moe); >moe2 : Symbol(moe2, Decl(underscoreTest1_underscoreTests.ts, 213, 3)) ->_.identity : Symbol(Underscore.Static.identity, Decl(underscoreTest1_underscore.ts, 617, 29)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->identity : Symbol(Underscore.Static.identity, Decl(underscoreTest1_underscore.ts, 617, 29)) +>_.identity : Symbol(Underscore.Static.identity, Decl(underscoreTest1_underscore.ts, 618, 29)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>identity : Symbol(Underscore.Static.identity, Decl(underscoreTest1_underscore.ts, 618, 29)) >moe : Symbol(moe, Decl(underscoreTest1_underscoreTests.ts, 164, 3)) var genie; >genie : Symbol(genie, Decl(underscoreTest1_underscoreTests.ts, 216, 3)) _.times(3, function (n) { genie.grantWishNumber(n); }); ->_.times : Symbol(Underscore.Static.times, Decl(underscoreTest1_underscore.ts, 619, 33)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->times : Symbol(Underscore.Static.times, Decl(underscoreTest1_underscore.ts, 619, 33)) +>_.times : Symbol(Underscore.Static.times, Decl(underscoreTest1_underscore.ts, 620, 33)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>times : Symbol(Underscore.Static.times, Decl(underscoreTest1_underscore.ts, 620, 33)) >n : Symbol(n, Decl(underscoreTest1_underscoreTests.ts, 218, 21)) >genie : Symbol(genie, Decl(underscoreTest1_underscoreTests.ts, 216, 3)) >n : Symbol(n, Decl(underscoreTest1_underscoreTests.ts, 218, 21)) _.random(0, 100); ->_.random : Symbol(Underscore.Static.random, Decl(underscoreTest1_underscore.ts, 621, 79), Decl(underscoreTest1_underscore.ts, 623, 36)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->random : Symbol(Underscore.Static.random, Decl(underscoreTest1_underscore.ts, 621, 79), Decl(underscoreTest1_underscore.ts, 623, 36)) +>_.random : Symbol(Underscore.Static.random, Decl(underscoreTest1_underscore.ts, 622, 79), Decl(underscoreTest1_underscore.ts, 624, 36)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>random : Symbol(Underscore.Static.random, Decl(underscoreTest1_underscore.ts, 622, 79), Decl(underscoreTest1_underscore.ts, 624, 36)) _.mixin({ ->_.mixin : Symbol(Underscore.Static.mixin, Decl(underscoreTest1_underscore.ts, 624, 49)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->mixin : Symbol(Underscore.Static.mixin, Decl(underscoreTest1_underscore.ts, 624, 49)) +>_.mixin : Symbol(Underscore.Static.mixin, Decl(underscoreTest1_underscore.ts, 625, 49)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>mixin : Symbol(Underscore.Static.mixin, Decl(underscoreTest1_underscore.ts, 625, 49)) capitalize: function (string) { >capitalize : Symbol(capitalize, Decl(underscoreTest1_underscoreTests.ts, 222, 9)) @@ -871,17 +871,17 @@ _.mixin({ } }); (_("fabio")).capitalize(); ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) _.uniqueId('contact_'); ->_.uniqueId : Symbol(Underscore.Static.uniqueId, Decl(underscoreTest1_underscore.ts, 626, 33), Decl(underscoreTest1_underscore.ts, 628, 27)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->uniqueId : Symbol(Underscore.Static.uniqueId, Decl(underscoreTest1_underscore.ts, 626, 33), Decl(underscoreTest1_underscore.ts, 628, 27)) +>_.uniqueId : Symbol(Underscore.Static.uniqueId, Decl(underscoreTest1_underscore.ts, 627, 33), Decl(underscoreTest1_underscore.ts, 629, 27)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>uniqueId : Symbol(Underscore.Static.uniqueId, Decl(underscoreTest1_underscore.ts, 627, 33), Decl(underscoreTest1_underscore.ts, 629, 27)) _.escape('Curly, Larry & Moe'); ->_.escape : Symbol(Underscore.Static.escape, Decl(underscoreTest1_underscore.ts, 629, 41)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->escape : Symbol(Underscore.Static.escape, Decl(underscoreTest1_underscore.ts, 629, 41)) +>_.escape : Symbol(Underscore.Static.escape, Decl(underscoreTest1_underscore.ts, 630, 41)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>escape : Symbol(Underscore.Static.escape, Decl(underscoreTest1_underscore.ts, 630, 41)) var object = { cheese: 'crumpets', stuff: function () { return 'nonsense'; } }; >object : Symbol(object, Decl(underscoreTest1_underscoreTests.ts, 233, 3)) @@ -889,22 +889,22 @@ var object = { cheese: 'crumpets', stuff: function () { return 'nonsense'; } }; >stuff : Symbol(stuff, Decl(underscoreTest1_underscoreTests.ts, 233, 34)) _.result(object, 'cheese'); ->_.result : Symbol(Underscore.Static.result, Decl(underscoreTest1_underscore.ts, 633, 36)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->result : Symbol(Underscore.Static.result, Decl(underscoreTest1_underscore.ts, 633, 36)) +>_.result : Symbol(Underscore.Static.result, Decl(underscoreTest1_underscore.ts, 634, 36)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>result : Symbol(Underscore.Static.result, Decl(underscoreTest1_underscore.ts, 634, 36)) >object : Symbol(object, Decl(underscoreTest1_underscoreTests.ts, 233, 3)) _.result(object, 'stuff'); ->_.result : Symbol(Underscore.Static.result, Decl(underscoreTest1_underscore.ts, 633, 36)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->result : Symbol(Underscore.Static.result, Decl(underscoreTest1_underscore.ts, 633, 36)) +>_.result : Symbol(Underscore.Static.result, Decl(underscoreTest1_underscore.ts, 634, 36)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>result : Symbol(Underscore.Static.result, Decl(underscoreTest1_underscore.ts, 634, 36)) >object : Symbol(object, Decl(underscoreTest1_underscoreTests.ts, 233, 3)) var compiled = _.template("hello: <%= name %>"); >compiled : Symbol(compiled, Decl(underscoreTest1_underscoreTests.ts, 238, 3)) ->_.template : Symbol(Underscore.Static.template, Decl(underscoreTest1_underscore.ts, 637, 43), Decl(underscoreTest1_underscore.ts, 639, 64)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->template : Symbol(Underscore.Static.template, Decl(underscoreTest1_underscore.ts, 637, 43), Decl(underscoreTest1_underscore.ts, 639, 64)) +>_.template : Symbol(Underscore.Static.template, Decl(underscoreTest1_underscore.ts, 638, 43), Decl(underscoreTest1_underscore.ts, 640, 64)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>template : Symbol(Underscore.Static.template, Decl(underscoreTest1_underscore.ts, 638, 43), Decl(underscoreTest1_underscore.ts, 640, 64)) compiled({ name: 'moe' }); >compiled : Symbol(compiled, Decl(underscoreTest1_underscoreTests.ts, 238, 3)) @@ -914,17 +914,17 @@ var list2 = "<% _.each(people, function(name) { %>
  • <%= name %>
  • <% }); % >list2 : Symbol(list2, Decl(underscoreTest1_underscoreTests.ts, 240, 3)) _.template(list2, { people: ['moe', 'curly', 'larry'] }); ->_.template : Symbol(Underscore.Static.template, Decl(underscoreTest1_underscore.ts, 637, 43), Decl(underscoreTest1_underscore.ts, 639, 64)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->template : Symbol(Underscore.Static.template, Decl(underscoreTest1_underscore.ts, 637, 43), Decl(underscoreTest1_underscore.ts, 639, 64)) +>_.template : Symbol(Underscore.Static.template, Decl(underscoreTest1_underscore.ts, 638, 43), Decl(underscoreTest1_underscore.ts, 640, 64)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>template : Symbol(Underscore.Static.template, Decl(underscoreTest1_underscore.ts, 638, 43), Decl(underscoreTest1_underscore.ts, 640, 64)) >list2 : Symbol(list2, Decl(underscoreTest1_underscoreTests.ts, 240, 3)) >people : Symbol(people, Decl(underscoreTest1_underscoreTests.ts, 241, 19)) var template = _.template("<%- value %>"); >template : Symbol(template, Decl(underscoreTest1_underscoreTests.ts, 242, 3)) ->_.template : Symbol(Underscore.Static.template, Decl(underscoreTest1_underscore.ts, 637, 43), Decl(underscoreTest1_underscore.ts, 639, 64)) ->_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 644, 11)) ->template : Symbol(Underscore.Static.template, Decl(underscoreTest1_underscore.ts, 637, 43), Decl(underscoreTest1_underscore.ts, 639, 64)) +>_.template : Symbol(Underscore.Static.template, Decl(underscoreTest1_underscore.ts, 638, 43), Decl(underscoreTest1_underscore.ts, 640, 64)) +>_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) +>template : Symbol(Underscore.Static.template, Decl(underscoreTest1_underscore.ts, 638, 43), Decl(underscoreTest1_underscore.ts, 640, 64)) template({ value: '