diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 9311aa7cc2698..59ff58420b42c 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -470,7 +470,9 @@ namespace ts { currentReachabilityState = Reachability.Reachable; hasExplicitReturn = false; - labelStack = labelIndexMap = implicitLabels = undefined; + labelStack = undefined; + labelIndexMap = undefined; + implicitLabels = undefined; } if (isInJavaScriptFile(node) && node.jsDocComment) { diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 899ee479578b2..16b33c8689834 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3184,6 +3184,44 @@ namespace ts { return unknownType; } + function getTypeOfBasePropertyDeclaration(declaration: PropertyDeclaration) { + if (declaration.parent.kind === SyntaxKind.ClassDeclaration) { + const parent = declaration.parent; + const propertyName = declaration.symbol.name; + const extendedPropertyType = getSinglePropertyTypeOfTypes(getBaseTypes(getTypeOfSymbol(getSymbolOfNode(parent))), propertyName); + if (extendedPropertyType) { + return extendedPropertyType; + } + const implementedTypeNodes = getClassImplementsHeritageClauseElements(parent); + if (implementedTypeNodes) { + return getSinglePropertyTypeOfTypes(map(implementedTypeNodes, getTypeFromTypeReference), propertyName); + } + } + + return undefined; + } + + function getSinglePropertyTypeOfTypes(types: Type[], propertyName: string) { + let result: Type; + for (const t of types) { + if (t !== unknownType) { + const property = getPropertyOfType(t, propertyName); + if (!property || property.valueDeclaration.flags & NodeFlags.Private) { + continue; + } + if (property.name === propertyName) { + const propertyType = getTypeOfSymbol(property); + if (result && result !== propertyType) { + // if there's more than one matching property, return undefined + return undefined; + } + result = propertyType; + } + } + } + return result; + } + function getTargetType(type: ObjectType): Type { return type.flags & TypeFlags.Reference ? (type).target : type; } @@ -5410,7 +5448,7 @@ namespace ts { // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node: Expression | MethodDeclaration | ObjectLiteralElement): boolean { - Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node)); + Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isMethod(node)); switch (node.kind) { case SyntaxKind.FunctionExpression: case SyntaxKind.ArrowFunction: @@ -7868,7 +7906,7 @@ namespace ts { error(reference, Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol)); } - function checkIdentifier(node: Identifier): Type { + function checkIdentifier(node: Identifier, contextualMapper?: TypeMapper): Type { const symbol = getResolvedSymbol(node); // As noted in ECMAScript 6 language spec, arrow functions never have an arguments objects. @@ -7919,11 +7957,18 @@ namespace ts { checkCollisionWithCapturedThisVariable(node, node); checkNestedBlockScopedBinding(node, symbol); - const type = getTypeOfSymbol(localOrExportSymbol); + let type = getTypeOfSymbol(localOrExportSymbol); if (strictNullChecks && !isAssignmentTarget(node) && !(type.flags & TypeFlags.Any) && !(getNullableKind(type) & TypeFlags.Undefined)) { checkVariableAssignedBefore(symbol, node); } - return getNarrowedTypeOfReference(type, node); + type = getNarrowedTypeOfReference(type, node); + if (symbol.name === "undefined" && !isInferentialContext(contextualMapper) && !isBindingPatternDeclaration(node.parent)) { + const contextualType = getContextualType(node); + if (contextualType && (!strictNullChecks || contextualType.flags & TypeFlags.Undefined)) { + return contextualType; + } + } + return type; } function isInsideFunction(node: Node, threshold: Node): boolean { @@ -8406,6 +8451,24 @@ namespace ts { } } + function isBindingPatternDeclaration(node: Node) { + if (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.VariableDeclaration || node.kind === SyntaxKind.BindingElement) { + const declaration = node; + return declaration.name.kind === SyntaxKind.ArrayBindingPattern || declaration.name.kind === SyntaxKind.ObjectBindingPattern; + } + } + + function checkNullKeyword(nullNode: Expression, contextualMapper?: TypeMapper) { + const contextualType = getContextualType(nullNode); + if (contextualType && + !isInferentialContext(contextualMapper) && + !isBindingPatternDeclaration(nullNode.parent) && + (!strictNullChecks || contextualType.flags & TypeFlags.Null)) { + return contextualType; + } + return nullType; + } + function getContextuallyTypedThisType(func: FunctionLikeDeclaration): Type { if ((isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitive(func) && @@ -8422,7 +8485,7 @@ namespace ts { // Return contextual type of parameter or undefined if no contextual type is available function getContextuallyTypedParameterType(parameter: ParameterDeclaration): Type { const func = parameter.parent; - if (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) { + if (isFunctionExpressionOrArrowFunction(func) || isMethod(func)) { if (isContextSensitive(func)) { const contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -8447,9 +8510,9 @@ namespace ts { } // In a variable, parameter or property declaration with a type annotation, - // the contextual type of an initializer expression is the type of the variable, parameter or property. - // Otherwise, in a parameter declaration of a contextually typed function expression, - // the contextual type of an initializer expression is the contextual type of the parameter. + // the contextual type of an initializer expression is the type of the variable, parameter or property. + // Otherwise, in a parameter declaration of a contextually typed function expression, + // the contextual type of an initializer expression is the contextual type of the parameter. // Otherwise, in a variable or parameter declaration with a binding pattern name, // the contextual type of an initializer expression is the type implied by the binding pattern. // Otherwise, in a binding pattern inside a variable or parameter declaration, @@ -8466,6 +8529,12 @@ namespace ts { return type; } } + if (declaration.kind === SyntaxKind.PropertyDeclaration) { + const type = getTypeOfBasePropertyDeclaration(declaration); + if (type) { + return type; + } + } if (isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ true); } @@ -8798,7 +8867,7 @@ namespace ts { function getContextualSignatureForFunctionLikeDeclaration(node: FunctionLikeDeclaration): Signature { // Only function expressions, arrow functions, and object literal methods are contextually typed. - return isFunctionExpressionOrArrowFunction(node) || isObjectLiteralMethod(node) + return isFunctionExpressionOrArrowFunction(node) || isMethod(node) ? getContextualSignature(node) : undefined; } @@ -8809,10 +8878,18 @@ namespace ts { // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node: FunctionExpression | MethodDeclaration): Signature { - Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node)); - const type = isObjectLiteralMethod(node) - ? getContextualTypeForObjectLiteralMethod(node) - : getApparentTypeOfContextualType(node); + Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isMethod(node)); + let type: Type; + if (isFunctionExpressionOrArrowFunction(node)) { + type = getApparentTypeOfContextualType(node); + } + else if (isObjectLiteralMethod(node)) { + type = getContextualTypeForObjectLiteralMethod(node); + } + else if (isMethod(node)) { + type = getTypeOfBasePropertyDeclaration(node); + } + if (!type) { return undefined; } @@ -8926,7 +9003,7 @@ namespace ts { function checkArrayLiteral(node: ArrayLiteralExpression, contextualMapper?: TypeMapper): Type { const elements = node.elements; let hasSpreadElement = false; - const elementTypes: Type[] = []; + let elementTypes: Type[] = []; const inDestructuringPattern = isAssignmentTarget(node); for (const e of elements) { if (inDestructuringPattern && e.kind === SyntaxKind.SpreadElementExpression) { @@ -8988,7 +9065,14 @@ namespace ts { } } } - return createArrayType(elementTypes.length ? getUnionType(elementTypes) : emptyArrayElementType); + if (!elementTypes.length) { + const contextualType = getContextualType(node); + if (isInferentialContext(contextualMapper) || !contextualType || !(contextualType).typeArguments) { + return createArrayType(emptyArrayElementType); + } + elementTypes = (contextualType).typeArguments; + } + return createArrayType(getUnionType(elementTypes)); } function isNumericName(name: DeclarationName): boolean { @@ -9056,10 +9140,10 @@ namespace ts { } } const unionType = propTypes.length ? getUnionType(propTypes) : undefinedType; - return createIndexInfo(unionType, /*isReadonly*/ false); + return createIndexInfo(unionType, /*isReadonly*/false); } - function checkObjectLiteral(node: ObjectLiteralExpression, contextualMapper?: TypeMapper): Type { + function checkObjectLiteral(node: ObjectLiteralExpression, contextualMapper: TypeMapper): Type { const inDestructuringPattern = isAssignmentTarget(node); // Grammar checking checkGrammarObjectLiteralExpression(node, inDestructuringPattern); @@ -9074,6 +9158,17 @@ namespace ts { let hasComputedStringProperty = false; let hasComputedNumberProperty = false; + // Use the contextual type only for empty object literals if the contextual type has only indexers and optional properties + if (!node.properties.length && + contextualType && + contextualType !== voidType && + !isInferentialContext(contextualMapper) && + !getSignaturesOfType(contextualType, SignatureKind.Call).length && + !getSignaturesOfType(contextualType, SignatureKind.Construct).length && + !forEach(getPropertiesOfType(contextualType), prop => !(prop.flags & SymbolFlags.Optional))) { + return contextualType; + } + for (const memberDecl of node.properties) { let member = memberDecl.symbol; if (memberDecl.kind === SyntaxKind.PropertyAssignment || @@ -12296,7 +12391,7 @@ namespace ts { return checkExpression((node).initializer, contextualMapper); } - function checkObjectLiteralMethod(node: MethodDeclaration, contextualMapper?: TypeMapper): Type { + function checkObjectLiteralMethod(node: MethodDeclaration, contextualMapper: TypeMapper): Type { // Grammar checking checkGrammarMethod(node); @@ -12371,13 +12466,13 @@ namespace ts { function checkExpressionWorker(node: Expression, contextualMapper: TypeMapper): Type { switch (node.kind) { case SyntaxKind.Identifier: - return checkIdentifier(node); + return checkIdentifier(node, contextualMapper); case SyntaxKind.ThisKeyword: return checkThisExpression(node); case SyntaxKind.SuperKeyword: return checkSuperExpression(node); case SyntaxKind.NullKeyword: - return nullType; + return checkNullKeyword(node, contextualMapper); case SyntaxKind.TrueKeyword: case SyntaxKind.FalseKeyword: return booleanType; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index b97ad70a74ae8..25a8e0272c359 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -827,6 +827,10 @@ namespace ts { return predicate && predicate.kind === TypePredicateKind.Identifier; } + export function isMethod(node: Node): node is MethodDeclaration { + return node && node.kind === SyntaxKind.MethodDeclaration; + } + export function isThisTypePredicate(predicate: TypePredicate): predicate is ThisTypePredicate { return predicate && predicate.kind === TypePredicateKind.This; } diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.types b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.types index ba174d9bbba55..a1e994920874a 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.types +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.types @@ -59,7 +59,7 @@ module A { >Point : Point return null; ->null : null +>null : Line } } } diff --git a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.types b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.types index 12a8cd974ad5b..3f97a99dec61c 100644 --- a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.types +++ b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.types @@ -28,5 +28,5 @@ module A { >Point : Point } = null; ->null : null +>null : { top: { left: Point; right: Point; }; bottom: { left: Point; right: Point; }; } } diff --git a/tests/baselines/reference/aliasUsageInGenericFunction.types b/tests/baselines/reference/aliasUsageInGenericFunction.types index 5fe7a3e49efcc..93cdc3c5fdcf6 100644 --- a/tests/baselines/reference/aliasUsageInGenericFunction.types +++ b/tests/baselines/reference/aliasUsageInGenericFunction.types @@ -41,7 +41,7 @@ var r2 = foo({ a: null }); >a : IHasVisualizationModel >null : IHasVisualizationModel >IHasVisualizationModel : IHasVisualizationModel ->null : null +>null : IHasVisualizationModel === tests/cases/compiler/aliasUsageInGenericFunction_backbone.ts === export class Model { diff --git a/tests/baselines/reference/aliasUsageInOrExpression.types b/tests/baselines/reference/aliasUsageInOrExpression.types index c43b7889cc555..143f0cd07b46c 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.types +++ b/tests/baselines/reference/aliasUsageInOrExpression.types @@ -46,7 +46,7 @@ var e: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null || { ><{ x: IHasVisualizationModel }>null : { x: IHasVisualizationModel; } >x : IHasVisualizationModel >IHasVisualizationModel : IHasVisualizationModel ->null : null +>null : { x: IHasVisualizationModel; } >{ x: moduleA } : { x: typeof moduleA; } >x : typeof moduleA >moduleA : typeof moduleA @@ -59,11 +59,11 @@ var f: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null ? { x ><{ x: IHasVisualizationModel }>null : { x: IHasVisualizationModel; } >x : IHasVisualizationModel >IHasVisualizationModel : IHasVisualizationModel ->null : null +>null : { x: IHasVisualizationModel; } >{ x: moduleA } : { x: typeof moduleA; } >x : typeof moduleA >moduleA : typeof moduleA ->null : null +>null : { x: IHasVisualizationModel; } === tests/cases/compiler/aliasUsageInOrExpression_backbone.ts === export class Model { diff --git a/tests/baselines/reference/aliasUsedAsNameValue.types b/tests/baselines/reference/aliasUsedAsNameValue.types index 86e1eeee9f5d4..b97628a699033 100644 --- a/tests/baselines/reference/aliasUsedAsNameValue.types +++ b/tests/baselines/reference/aliasUsedAsNameValue.types @@ -28,5 +28,5 @@ export var id: number; export function b(a: any): any { return null; } >b : (a: any) => any >a : any ->null : null +>null : any diff --git a/tests/baselines/reference/anyInferenceAnonymousFunctions.types b/tests/baselines/reference/anyInferenceAnonymousFunctions.types index 8dc7fdcb90f1d..e44e98059dda9 100644 --- a/tests/baselines/reference/anyInferenceAnonymousFunctions.types +++ b/tests/baselines/reference/anyInferenceAnonymousFunctions.types @@ -16,7 +16,7 @@ paired.reduce(function (a1, a2) { >a1.concat : any >a1 : any >concat : any ->{} : {} +>{} : any } , []); >[] : undefined[] @@ -35,7 +35,7 @@ paired.reduce((b1, b2) => { >b1.concat : any >b1 : any >concat : any ->{} : {} +>{} : any } , []); >[] : undefined[] @@ -52,7 +52,7 @@ paired.reduce((b3, b4) => b3.concat({}), []); >b3.concat : any >b3 : any >concat : any ->{} : {} +>{} : any >[] : undefined[] paired.map((c1) => c1.count); diff --git a/tests/baselines/reference/arrayAssignmentTest6.types b/tests/baselines/reference/arrayAssignmentTest6.types index 411144d44267b..7e492c97a25a2 100644 --- a/tests/baselines/reference/arrayAssignmentTest6.types +++ b/tests/baselines/reference/arrayAssignmentTest6.types @@ -46,7 +46,7 @@ module Test { >ILineTokens : ILineTokens return null; ->null : null +>null : ILineTokens } } } diff --git a/tests/baselines/reference/arrayBestCommonTypes.types b/tests/baselines/reference/arrayBestCommonTypes.types index fca66793f40ec..39508b41d2efa 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.types +++ b/tests/baselines/reference/arrayBestCommonTypes.types @@ -41,7 +41,7 @@ module EmptyTypes { >x : any >y : boolean >false : boolean ->null : null +>null : any public x() { >x : () => void @@ -274,10 +274,10 @@ module EmptyTypes { >x : string >y : base >base : base ->[{ x: undefined, y: new base() }, { x: '', y: new derived() }] : { x: string; y: derived; }[] ->{ x: undefined, y: new base() } : { x: undefined; y: base; } ->x : undefined ->undefined : undefined +>[{ x: undefined, y: new base() }, { x: '', y: new derived() }] : { x: string; y: base; }[] +>{ x: undefined, y: new base() } : { x: string; y: base; } +>x : string +>undefined : string >y : base >new base() : base >base : typeof base @@ -290,7 +290,7 @@ module EmptyTypes { var anyObj: any = null; >anyObj : any ->null : null +>null : any // Order matters here so test all the variants var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; @@ -353,7 +353,7 @@ module EmptyTypes { var ifaceObj: iface = null; >ifaceObj : iface >iface : iface ->null : null +>null : iface var baseObj = new base(); >baseObj : base @@ -444,7 +444,7 @@ module NonEmptyTypes { >x : any >y : boolean >false : boolean ->null : null +>null : any public x() { >x : () => void @@ -677,10 +677,10 @@ module NonEmptyTypes { >x : string >y : base >base : base ->[{ x: undefined, y: new base() }, { x: '', y: new derived() }] : ({ x: undefined; y: base; } | { x: string; y: derived; })[] ->{ x: undefined, y: new base() } : { x: undefined; y: base; } ->x : undefined ->undefined : undefined +>[{ x: undefined, y: new base() }, { x: '', y: new derived() }] : { x: string; y: base; }[] +>{ x: undefined, y: new base() } : { x: string; y: base; } +>x : string +>undefined : string >y : base >new base() : base >base : typeof base @@ -693,7 +693,7 @@ module NonEmptyTypes { var anyObj: any = null; >anyObj : any ->null : null +>null : any // Order matters here so test all the variants var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; @@ -756,7 +756,7 @@ module NonEmptyTypes { var ifaceObj: iface = null; >ifaceObj : iface >iface : iface ->null : null +>null : iface var baseObj = new base(); >baseObj : base diff --git a/tests/baselines/reference/arrayConcat2.types b/tests/baselines/reference/arrayConcat2.types index b7df374911601..335f724b0c894 100644 --- a/tests/baselines/reference/arrayConcat2.types +++ b/tests/baselines/reference/arrayConcat2.types @@ -1,7 +1,7 @@ === tests/cases/compiler/arrayConcat2.ts === var a: string[] = []; >a : string[] ->[] : undefined[] +>[] : string[] a.concat("hello", 'world'); >a.concat("hello", 'world') : string[] diff --git a/tests/baselines/reference/arrayLiteral.types b/tests/baselines/reference/arrayLiteral.types index a7b915de79dac..a699ba55feefe 100644 --- a/tests/baselines/reference/arrayLiteral.types +++ b/tests/baselines/reference/arrayLiteral.types @@ -29,7 +29,7 @@ var y = new Array(); var x2: number[] = []; >x2 : number[] ->[] : undefined[] +>[] : number[] var x2: number[] = new Array(1); >x2 : number[] diff --git a/tests/baselines/reference/arrayLiteralInNonVarArgParameter.types b/tests/baselines/reference/arrayLiteralInNonVarArgParameter.types index fcbaa22bc6a03..27305e62f7526 100644 --- a/tests/baselines/reference/arrayLiteralInNonVarArgParameter.types +++ b/tests/baselines/reference/arrayLiteralInNonVarArgParameter.types @@ -7,7 +7,7 @@ function panic(val: string[], ...opt: string[]) { } panic([], 'one', 'two'); >panic([], 'one', 'two') : void >panic : (val: string[], ...opt: string[]) => void ->[] : undefined[] +>[] : string[] >'one' : string >'two' : string diff --git a/tests/baselines/reference/arrayLiterals2ES5.types b/tests/baselines/reference/arrayLiterals2ES5.types index a9cf31611c26f..e2357b2b17e54 100644 --- a/tests/baselines/reference/arrayLiterals2ES5.types +++ b/tests/baselines/reference/arrayLiterals2ES5.types @@ -65,10 +65,10 @@ var a5 = [...a0, , ] var b0: [any, any, any] = [undefined, null, undefined]; >b0 : [any, any, any] ->[undefined, null, undefined] : [undefined, null, undefined] ->undefined : undefined ->null : null ->undefined : undefined +>[undefined, null, undefined] : [any, any, any] +>undefined : any +>null : any +>undefined : any var b1: [number[], string[]] = [[1, 2, 3], ["hello", "string"]]; >b1 : [number[], string[]] diff --git a/tests/baselines/reference/arrayLiterals2ES6.types b/tests/baselines/reference/arrayLiterals2ES6.types index b6bf4f1de1b39..787e7eca60f38 100644 --- a/tests/baselines/reference/arrayLiterals2ES6.types +++ b/tests/baselines/reference/arrayLiterals2ES6.types @@ -65,10 +65,10 @@ var a5 = [...a0, , ] var b0: [any, any, any] = [undefined, null, undefined]; >b0 : [any, any, any] ->[undefined, null, undefined] : [undefined, null, undefined] ->undefined : undefined ->null : null ->undefined : undefined +>[undefined, null, undefined] : [any, any, any] +>undefined : any +>null : any +>undefined : any var b1: [number[], string[]] = [[1, 2, 3], ["hello", "string"]]; >b1 : [number[], string[]] diff --git a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody1.types b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody1.types index 2446c97d4ceaf..3791dce8282c1 100644 --- a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody1.types +++ b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody1.types @@ -4,5 +4,5 @@ var v = a => {} >a => {} : (a: any) => any >a : any >{} : any ->{} : {} +>{} : any diff --git a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody2.types b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody2.types index df8e87e82ea0a..0997898622580 100644 --- a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody2.types +++ b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody2.types @@ -5,5 +5,5 @@ var v = a => {} >a : any >{} : any >{} : any ->{} : {} +>{} : any diff --git a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody3.types b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody3.types index 91e11ab910414..6d6d25183df5a 100644 --- a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody3.types +++ b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody3.types @@ -4,5 +4,5 @@ var v = a => {} >a => {} : (a: any) => any >a : any >{} : any ->{} : {} +>{} : any diff --git a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody4.types b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody4.types index 400a91b459d36..f88d2f5193c45 100644 --- a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody4.types +++ b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody4.types @@ -5,5 +5,5 @@ var v = a => {} >a : any >{} : any >{} : any ->{} : {} +>{} : any diff --git a/tests/baselines/reference/asOperator1.types b/tests/baselines/reference/asOperator1.types index cc8a49ddc55fa..e20638c475d44 100644 --- a/tests/baselines/reference/asOperator1.types +++ b/tests/baselines/reference/asOperator1.types @@ -6,14 +6,14 @@ var as = 43; var x = undefined as number; >x : number >undefined as number : number ->undefined : undefined +>undefined : number var y = (null as string).length; >y : number >(null as string).length : number >(null as string) : string >null as string : string ->null : null +>null : string >length : number var z = Date as any as string; diff --git a/tests/baselines/reference/assignmentCompatForEnums.types b/tests/baselines/reference/assignmentCompatForEnums.types index e8b48bd02bd3e..ecff765b21b61 100644 --- a/tests/baselines/reference/assignmentCompatForEnums.types +++ b/tests/baselines/reference/assignmentCompatForEnums.types @@ -12,7 +12,7 @@ var list = {}; function returnType(): TokenType { return null; } >returnType : () => TokenType >TokenType : TokenType ->null : null +>null : TokenType function foo() { >foo : () => void diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt index a18da8fd8f700..e5d6ec40779b1 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(14,13): error TS2322: Type '(x: T) => any' is not assignable to type '() => T'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(23,13): error TS2322: Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(14,13): error TS2322: Type '(x: T) => T' is not assignable to type '() => T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(23,13): error TS2322: Type '(x: T, y: T) => T' is not assignable to type '(x: T) => T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(65,9): error TS2322: Type '(x: T) => T' is not assignable to type '() => T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(66,9): error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '() => T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(107,13): error TS2322: Type '(x: T) => any' is not assignable to type '() => T'. @@ -22,7 +22,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme this.a = (x?: T) => null; // ok, same T of required params this.a = (x: T) => null; // error, too many required params ~~~~~~ -!!! error TS2322: Type '(x: T) => any' is not assignable to type '() => T'. +!!! error TS2322: Type '(x: T) => T' is not assignable to type '() => T'. this.a2 = () => null; // ok, same T of required params this.a2 = (x?: T) => null; // ok, same T of required params @@ -33,7 +33,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme this.a3 = (x: T) => null; // ok, same T of required params this.a3 = (x: T, y: T) => null; // error, too many required params ~~~~~~~ -!!! error TS2322: Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. +!!! error TS2322: Type '(x: T, y: T) => T' is not assignable to type '(x: T) => T'. this.a4 = () => null; // ok, fewer required params this.a4 = (x?: T, y?: T) => null; // ok, fewer required params diff --git a/tests/baselines/reference/assignmentCompatability6.types b/tests/baselines/reference/assignmentCompatability6.types index 1191ff8bc265c..1b609296e3b5c 100644 --- a/tests/baselines/reference/assignmentCompatability6.types +++ b/tests/baselines/reference/assignmentCompatability6.types @@ -30,7 +30,7 @@ module __test2__ { >T : T >obj3 : interfaceWithOptional >interfaceWithOptional : interfaceWithOptional ->{ } : {} +>{ } : interfaceWithOptional export var __val__obj3 = obj3; >__val__obj3 : interfaceWithOptional diff --git a/tests/baselines/reference/badOverloadError.types b/tests/baselines/reference/badOverloadError.types index 198582af2db9e..33b0b77f61f58 100644 --- a/tests/baselines/reference/badOverloadError.types +++ b/tests/baselines/reference/badOverloadError.types @@ -6,6 +6,6 @@ function method() { >dictionary : { [index: string]: string; } ><{ [index: string]: string; }>{} : { [index: string]: string; } >index : string ->{} : {} +>{} : { [index: string]: string; } } diff --git a/tests/baselines/reference/baseIndexSignatureResolution.types b/tests/baselines/reference/baseIndexSignatureResolution.types index 90d143155fb28..a28c89b9b6cf5 100644 --- a/tests/baselines/reference/baseIndexSignatureResolution.types +++ b/tests/baselines/reference/baseIndexSignatureResolution.types @@ -30,7 +30,7 @@ var x: FooOf = null; >x : FooOf >FooOf : FooOf >Derived : Derived ->null : null +>null : FooOf var y: Derived = x[0]; >y : Derived diff --git a/tests/baselines/reference/bestCommonTypeOfTuple.types b/tests/baselines/reference/bestCommonTypeOfTuple.types index 7d3330f486341..a8d319d855191 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple.types +++ b/tests/baselines/reference/bestCommonTypeOfTuple.types @@ -61,11 +61,11 @@ t2 = [E1.one, E2.two]; >two : E2 t3 = [5, undefined]; ->t3 = [5, undefined] : [number, undefined] +>t3 = [5, undefined] : [number, any] >t3 : [number, any] ->[5, undefined] : [number, undefined] +>[5, undefined] : [number, any] >5 : number ->undefined : undefined +>undefined : any t4 = [E1.one, E2.two, 20]; >t4 = [E1.one, E2.two, 20] : [E1, E2, number] diff --git a/tests/baselines/reference/bestCommonTypeReturnStatement.types b/tests/baselines/reference/bestCommonTypeReturnStatement.types index 31f72ab93b4da..7faedf8d8992e 100644 --- a/tests/baselines/reference/bestCommonTypeReturnStatement.types +++ b/tests/baselines/reference/bestCommonTypeReturnStatement.types @@ -31,10 +31,10 @@ function f() { function b(): IPromise { return null; } >b : () => IPromise >IPromise : IPromise ->null : null +>null : IPromise function d(): IPromise { return null; } >d : () => IPromise >IPromise : IPromise ->null : null +>null : IPromise diff --git a/tests/baselines/reference/binopAssignmentShouldHaveType.types b/tests/baselines/reference/binopAssignmentShouldHaveType.types index d09138bbb8851..79f4eb852795c 100644 --- a/tests/baselines/reference/binopAssignmentShouldHaveType.types +++ b/tests/baselines/reference/binopAssignmentShouldHaveType.types @@ -22,7 +22,7 @@ module Test { var name:string= null; >name : string ->null : null +>null : string if ((name= this.getName()).length > 0) { >(name= this.getName()).length > 0 : boolean diff --git a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.types b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.types index e3bcb35805fb2..e528d34293330 100644 --- a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.types +++ b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.types @@ -7,7 +7,7 @@ function f(x: T): T { return null; } >x : T >T : T >T : T ->null : null +>null : T var r = f(1); >r : number @@ -22,7 +22,7 @@ var f2 = (x: T): T => { return null; } >x : T >T : T >T : T ->null : null +>null : T var r2 = f2(1); >r2 : number @@ -54,7 +54,7 @@ class C { >T : T return null; ->null : null +>null : T } } var r4 = (new C()).f(1); @@ -100,7 +100,7 @@ class C2 { >T : T return null; ->null : null +>null : T } } var r6 = (new C2()).f(1); diff --git a/tests/baselines/reference/castExpressionParentheses.types b/tests/baselines/reference/castExpressionParentheses.types index cdfbf4f7db236..ef59377ee1b26 100644 --- a/tests/baselines/reference/castExpressionParentheses.types +++ b/tests/baselines/reference/castExpressionParentheses.types @@ -71,7 +71,7 @@ declare var a; (null); >(null) : any >null : any ->null : null +>null : any // names and dotted names (this); diff --git a/tests/baselines/reference/castTest.types b/tests/baselines/reference/castTest.types index 35698219fd43f..6d5b00661a7a1 100644 --- a/tests/baselines/reference/castTest.types +++ b/tests/baselines/reference/castTest.types @@ -33,13 +33,13 @@ var s = ""; var ar = null; >ar : any[] >null : any[] ->null : null +>null : any[] var f = <(res : number) => void>null; >f : (res: number) => void ><(res : number) => void>null : (res: number) => void >res : number ->null : null +>null : (res: number) => void declare class Point >Point : Point diff --git a/tests/baselines/reference/chainedAssignment2.errors.txt b/tests/baselines/reference/chainedAssignment2.errors.txt new file mode 100644 index 0000000000000..486393b0501c4 --- /dev/null +++ b/tests/baselines/reference/chainedAssignment2.errors.txt @@ -0,0 +1,26 @@ +tests/cases/compiler/chainedAssignment2.ts(7,1): error TS2322: Type 'RegExp' is not assignable to type 'string'. +tests/cases/compiler/chainedAssignment2.ts(7,5): error TS2322: Type 'RegExp' is not assignable to type 'number'. +tests/cases/compiler/chainedAssignment2.ts(7,9): error TS2322: Type 'RegExp' is not assignable to type 'boolean'. +tests/cases/compiler/chainedAssignment2.ts(7,13): error TS2322: Type 'RegExp' is not assignable to type 'Date'. + Property 'toDateString' is missing in type 'RegExp'. + + +==== tests/cases/compiler/chainedAssignment2.ts (4 errors) ==== + var a: string; + var b: number; + var c: boolean; + var d: Date; + var e: RegExp; + + a = b = c = d = e = null; + ~ +!!! error TS2322: Type 'RegExp' is not assignable to type 'string'. + ~ +!!! error TS2322: Type 'RegExp' is not assignable to type 'number'. + ~ +!!! error TS2322: Type 'RegExp' is not assignable to type 'boolean'. + ~ +!!! error TS2322: Type 'RegExp' is not assignable to type 'Date'. +!!! error TS2322: Property 'toDateString' is missing in type 'RegExp'. + + \ No newline at end of file diff --git a/tests/baselines/reference/chainedAssignment2.symbols b/tests/baselines/reference/chainedAssignment2.symbols deleted file mode 100644 index 0f37d41c3bea7..0000000000000 --- a/tests/baselines/reference/chainedAssignment2.symbols +++ /dev/null @@ -1,26 +0,0 @@ -=== tests/cases/compiler/chainedAssignment2.ts === -var a: string; ->a : Symbol(a, Decl(chainedAssignment2.ts, 0, 3)) - -var b: number; ->b : Symbol(b, Decl(chainedAssignment2.ts, 1, 3)) - -var c: boolean; ->c : Symbol(c, Decl(chainedAssignment2.ts, 2, 3)) - -var d: Date; ->d : Symbol(d, Decl(chainedAssignment2.ts, 3, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) - -var e: RegExp; ->e : Symbol(e, Decl(chainedAssignment2.ts, 4, 3)) ->RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) - -a = b = c = d = e = null; ->a : Symbol(a, Decl(chainedAssignment2.ts, 0, 3)) ->b : Symbol(b, Decl(chainedAssignment2.ts, 1, 3)) ->c : Symbol(c, Decl(chainedAssignment2.ts, 2, 3)) ->d : Symbol(d, Decl(chainedAssignment2.ts, 3, 3)) ->e : Symbol(e, Decl(chainedAssignment2.ts, 4, 3)) - - diff --git a/tests/baselines/reference/chainedAssignment2.types b/tests/baselines/reference/chainedAssignment2.types deleted file mode 100644 index c53c64143d9d4..0000000000000 --- a/tests/baselines/reference/chainedAssignment2.types +++ /dev/null @@ -1,32 +0,0 @@ -=== tests/cases/compiler/chainedAssignment2.ts === -var a: string; ->a : string - -var b: number; ->b : number - -var c: boolean; ->c : boolean - -var d: Date; ->d : Date ->Date : Date - -var e: RegExp; ->e : RegExp ->RegExp : RegExp - -a = b = c = d = e = null; ->a = b = c = d = e = null : null ->a : string ->b = c = d = e = null : null ->b : number ->c = d = e = null : null ->c : boolean ->d = e = null : null ->d : Date ->e = null : null ->e : RegExp ->null : null - - diff --git a/tests/baselines/reference/chainedAssignment3.errors.txt b/tests/baselines/reference/chainedAssignment3.errors.txt index 8a64a35cbc08a..ca003c47ea525 100644 --- a/tests/baselines/reference/chainedAssignment3.errors.txt +++ b/tests/baselines/reference/chainedAssignment3.errors.txt @@ -1,9 +1,10 @@ +tests/cases/compiler/chainedAssignment3.ts(15,1): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/chainedAssignment3.ts(18,1): error TS2322: Type 'A' is not assignable to type 'B'. Property 'value' is missing in type 'A'. tests/cases/compiler/chainedAssignment3.ts(19,5): error TS2322: Type 'A' is not assignable to type 'B'. -==== tests/cases/compiler/chainedAssignment3.ts (2 errors) ==== +==== tests/cases/compiler/chainedAssignment3.ts (3 errors) ==== class A { id: number; } @@ -19,6 +20,8 @@ tests/cases/compiler/chainedAssignment3.ts(19,5): error TS2322: Type 'A' is not b = a = new B(); a.id = b.value = null; + ~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. // error cases b = a = new A(); diff --git a/tests/baselines/reference/checkInfiniteExpansionTermination2.types b/tests/baselines/reference/checkInfiniteExpansionTermination2.types index fc81e1c9304a9..c2352a24c9024 100644 --- a/tests/baselines/reference/checkInfiniteExpansionTermination2.types +++ b/tests/baselines/reference/checkInfiniteExpansionTermination2.types @@ -34,7 +34,7 @@ function fn() { var values: ISubject[] = []; >values : ISubject[] >ISubject : ISubject ->[] : undefined[] +>[] : ISubject[] // Hang when using , but not combineLatest(values); diff --git a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.types b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.types index 94460dfdeaf45..ae0602277a138 100644 --- a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.types +++ b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.types @@ -10,7 +10,7 @@ class C { public y(a: number): number { return null; } >y : (a: number) => number >a : number ->null : null +>null : number public get z() { return 1; } >z : number diff --git a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.types b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.types index b359713f292ba..4696119aef038 100644 --- a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.types +++ b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.types @@ -10,7 +10,7 @@ class C { public y(a: number): number { return null; } >y : (a: number) => number >a : number ->null : null +>null : number public get z() { return 1; } >z : number diff --git a/tests/baselines/reference/collisionExportsRequireAndAmbientModule.types b/tests/baselines/reference/collisionExportsRequireAndAmbientModule.types index 1c4c56de99cf2..c0b5cdfa65be0 100644 --- a/tests/baselines/reference/collisionExportsRequireAndAmbientModule.types +++ b/tests/baselines/reference/collisionExportsRequireAndAmbientModule.types @@ -15,7 +15,7 @@ export function foo(): require.I { >I : require.I return null; ->null : null +>null : require.I } export declare module exports { >exports : typeof exports @@ -33,7 +33,7 @@ export function foo2(): exports.I { >I : exports.I return null; ->null : null +>null : exports.I } declare module m1 { >m1 : typeof m1 diff --git a/tests/baselines/reference/collisionExportsRequireAndUninstantiatedModule.types b/tests/baselines/reference/collisionExportsRequireAndUninstantiatedModule.types index 4b313bcd8498b..ecd6d09dd8f89 100644 --- a/tests/baselines/reference/collisionExportsRequireAndUninstantiatedModule.types +++ b/tests/baselines/reference/collisionExportsRequireAndUninstantiatedModule.types @@ -12,7 +12,7 @@ export function foo(): require.I { >I : require.I return null; ->null : null +>null : require.I } export module exports { // no error >exports : any @@ -27,5 +27,5 @@ export function foo2(): exports.I { >I : exports.I return null; ->null : null +>null : exports.I } diff --git a/tests/baselines/reference/commaOperatorWithSecondOperandBooleanType.types b/tests/baselines/reference/commaOperatorWithSecondOperandBooleanType.types index dba5285d88095..d7881bf6498e2 100644 --- a/tests/baselines/reference/commaOperatorWithSecondOperandBooleanType.types +++ b/tests/baselines/reference/commaOperatorWithSecondOperandBooleanType.types @@ -85,9 +85,9 @@ null, BOOLEAN; ANY = undefined, BOOLEAN; >ANY = undefined, BOOLEAN : boolean ->ANY = undefined : undefined +>ANY = undefined : any >ANY : any ->undefined : undefined +>undefined : any >BOOLEAN : boolean 1, true; @@ -133,9 +133,9 @@ var resultIsBoolean7 = (ANY = undefined, BOOLEAN); >resultIsBoolean7 : boolean >(ANY = undefined, BOOLEAN) : boolean >ANY = undefined, BOOLEAN : boolean ->ANY = undefined : undefined +>ANY = undefined : any >ANY : any ->undefined : undefined +>undefined : any >BOOLEAN : boolean var resultIsBoolean8 = (1, true); diff --git a/tests/baselines/reference/commaOperatorWithSecondOperandNumberType.types b/tests/baselines/reference/commaOperatorWithSecondOperandNumberType.types index 13aae51e0cb33..30c94c2ddfe89 100644 --- a/tests/baselines/reference/commaOperatorWithSecondOperandNumberType.types +++ b/tests/baselines/reference/commaOperatorWithSecondOperandNumberType.types @@ -85,9 +85,9 @@ null, NUMBER; ANY = undefined, NUMBER; >ANY = undefined, NUMBER : number ->ANY = undefined : undefined +>ANY = undefined : any >ANY : any ->undefined : undefined +>undefined : any >NUMBER : number true, 1; @@ -130,9 +130,9 @@ var resultIsNumber7 = (ANY = undefined, NUMBER); >resultIsNumber7 : number >(ANY = undefined, NUMBER) : number >ANY = undefined, NUMBER : number ->ANY = undefined : undefined +>ANY = undefined : any >ANY : any ->undefined : undefined +>undefined : any >NUMBER : number var resultIsNumber8 = (true, 1); diff --git a/tests/baselines/reference/commaOperatorWithSecondOperandObjectType.types b/tests/baselines/reference/commaOperatorWithSecondOperandObjectType.types index 9c948da969978..5c3f27faf6f85 100644 --- a/tests/baselines/reference/commaOperatorWithSecondOperandObjectType.types +++ b/tests/baselines/reference/commaOperatorWithSecondOperandObjectType.types @@ -92,9 +92,9 @@ null, OBJECT ANY = null, OBJECT >ANY = null, OBJECT : Object ->ANY = null : null +>ANY = null : any >ANY : any ->null : null +>null : any >OBJECT : Object true, {} @@ -134,9 +134,9 @@ var resultIsObject7 = (ANY = null, OBJECT); >resultIsObject7 : Object >(ANY = null, OBJECT) : Object >ANY = null, OBJECT : Object ->ANY = null : null +>ANY = null : any >ANY : any ->null : null +>null : any >OBJECT : Object var resultIsObject8 = (true, {}); diff --git a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.types b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.types index 7f202c38d3a39..01c4db102631f 100644 --- a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.types +++ b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.types @@ -23,7 +23,7 @@ class A1 { >a : string return null; ->null : null +>null : string } } class B1 { @@ -50,7 +50,7 @@ class B1 { >b : string return null; ->null : null +>null : string } } @@ -65,7 +65,7 @@ class Base { >b : string return null; ->null : null +>null : string } } class A2 extends Base { } diff --git a/tests/baselines/reference/complexClassRelationships.types b/tests/baselines/reference/complexClassRelationships.types index 525baf5168abd..4e2ddc02812b7 100644 --- a/tests/baselines/reference/complexClassRelationships.types +++ b/tests/baselines/reference/complexClassRelationships.types @@ -51,7 +51,7 @@ class Thing { public get Components(): ComponentCollection { return null } >Components : ComponentCollection >ComponentCollection : ComponentCollection ->null : null +>null : ComponentCollection } class ComponentCollection { diff --git a/tests/baselines/reference/compositeGenericFunction.types b/tests/baselines/reference/compositeGenericFunction.types index 1957c3bb62d67..bfdf18c6c0468 100644 --- a/tests/baselines/reference/compositeGenericFunction.types +++ b/tests/baselines/reference/compositeGenericFunction.types @@ -13,7 +13,7 @@ function h(func: (x: number) => R): R { return null; } >x : number >R : R >R : R ->null : null +>null : R var z: number = h(f); >z : number diff --git a/tests/baselines/reference/compoundAdditionAssignmentLHSCanBeAssigned.types b/tests/baselines/reference/compoundAdditionAssignmentLHSCanBeAssigned.types index e40422450b44f..2e1764addbc4c 100644 --- a/tests/baselines/reference/compoundAdditionAssignmentLHSCanBeAssigned.types +++ b/tests/baselines/reference/compoundAdditionAssignmentLHSCanBeAssigned.types @@ -48,17 +48,17 @@ x1 += E.a; x1 += {}; >x1 += {} : any >x1 : any ->{} : {} +>{} : any x1 += null; >x1 += null : any >x1 : any ->null : null +>null : any x1 += undefined; >x1 += undefined : any >x1 : any ->undefined : undefined +>undefined : any var x2: string; >x2 : string @@ -103,12 +103,12 @@ x2 += {}; x2 += null; >x2 += null : string >x2 : string ->null : null +>null : string x2 += undefined; >x2 += undefined : string >x2 : string ->undefined : undefined +>undefined : string var x3: number; >x3 : number @@ -133,12 +133,12 @@ x3 += E.a; x3 += null; >x3 += null : number >x3 : number ->null : null +>null : number x3 += undefined; >x3 += undefined : number >x3 : number ->undefined : undefined +>undefined : number var x4: E; >x4 : E @@ -164,12 +164,12 @@ x4 += E.a; x4 += null; >x4 += null : number >x4 : E ->null : null +>null : E x4 += undefined; >x4 += undefined : number >x4 : E ->undefined : undefined +>undefined : E var x5: boolean; >x5 : boolean diff --git a/tests/baselines/reference/compoundArithmeticAssignmentLHSCanBeAssigned.types b/tests/baselines/reference/compoundArithmeticAssignmentLHSCanBeAssigned.types index 3b346bac53b2f..dbddd21891818 100644 --- a/tests/baselines/reference/compoundArithmeticAssignmentLHSCanBeAssigned.types +++ b/tests/baselines/reference/compoundArithmeticAssignmentLHSCanBeAssigned.types @@ -36,12 +36,12 @@ x1 *= c; x1 *= null; >x1 *= null : number >x1 : any ->null : null +>null : any x1 *= undefined; >x1 *= undefined : number >x1 : any ->undefined : undefined +>undefined : any var x2: number; >x2 : number @@ -64,12 +64,12 @@ x2 *= c; x2 *= null; >x2 *= null : number >x2 : number ->null : null +>null : number x2 *= undefined; >x2 *= undefined : number >x2 : number ->undefined : undefined +>undefined : number var x3: E; >x3 : E @@ -93,10 +93,10 @@ x3 *= c; x3 *= null; >x3 *= null : number >x3 : E ->null : null +>null : E x3 *= undefined; >x3 *= undefined : number >x3 : E ->undefined : undefined +>undefined : E diff --git a/tests/baselines/reference/compoundExponentiationAssignmentLHSCanBeAssigned1.types b/tests/baselines/reference/compoundExponentiationAssignmentLHSCanBeAssigned1.types index 060a231da1b4f..9b0cc1ab1722d 100644 --- a/tests/baselines/reference/compoundExponentiationAssignmentLHSCanBeAssigned1.types +++ b/tests/baselines/reference/compoundExponentiationAssignmentLHSCanBeAssigned1.types @@ -36,12 +36,12 @@ x1 **= c; x1 **= null; >x1 **= null : number >x1 : any ->null : null +>null : any x1 **= undefined; >x1 **= undefined : number >x1 : any ->undefined : undefined +>undefined : any var x2: number; >x2 : number @@ -64,12 +64,12 @@ x2 **= c; x2 **= null; >x2 **= null : number >x2 : number ->null : null +>null : number x2 **= undefined; >x2 **= undefined : number >x2 : number ->undefined : undefined +>undefined : number var x3: E; >x3 : E @@ -93,10 +93,10 @@ x3 **= c; x3 **= null; >x3 **= null : number >x3 : E ->null : null +>null : E x3 **= undefined; >x3 **= undefined : number >x3 : E ->undefined : undefined +>undefined : E diff --git a/tests/baselines/reference/constantOverloadFunction.types b/tests/baselines/reference/constantOverloadFunction.types index d7deaaae46d79..76a86bad79ef2 100644 --- a/tests/baselines/reference/constantOverloadFunction.types +++ b/tests/baselines/reference/constantOverloadFunction.types @@ -44,6 +44,6 @@ function foo(tagName: any): Base { >Base : Base return null; ->null : null +>null : Base } diff --git a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.types b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.types index 121faab82d553..bfa2347d3f190 100644 --- a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.types +++ b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.types @@ -44,6 +44,6 @@ function foo(tagName: any): Base { >Base : Base return null; ->null : null +>null : Base } diff --git a/tests/baselines/reference/constraintSatisfactionWithAny.types b/tests/baselines/reference/constraintSatisfactionWithAny.types index f3363fe1a9006..68c8a8648033b 100644 --- a/tests/baselines/reference/constraintSatisfactionWithAny.types +++ b/tests/baselines/reference/constraintSatisfactionWithAny.types @@ -8,7 +8,7 @@ function foo(x: T): T { return null; } >x : T >T : T >T : T ->null : null +>null : T function foo2(x: T): T { return null; } >foo2 : (x: T) => T @@ -17,7 +17,7 @@ function foo2(x: T): T { return null; } >x : T >T : T >T : T ->null : null +>null : T //function foo3(x: T): T { return null; } function foo4(x: T) => void>(x: T): T { return null; } @@ -29,7 +29,7 @@ function foo4(x: T) => void>(x: T): T { return null; } >x : T >T : T >T : T ->null : null +>null : T var a; >a : any diff --git a/tests/baselines/reference/constructorImplementationWithDefaultValues.types b/tests/baselines/reference/constructorImplementationWithDefaultValues.types index fa99cc17fe03e..3e834c1816f72 100644 --- a/tests/baselines/reference/constructorImplementationWithDefaultValues.types +++ b/tests/baselines/reference/constructorImplementationWithDefaultValues.types @@ -25,7 +25,7 @@ class D { constructor(x:T = null) { >x : T >T : T ->null : null +>null : T var y = x; >y : T @@ -44,7 +44,7 @@ class E { constructor(x: T = null) { >x : T >T : T ->null : null +>null : T var y = x; >y : T diff --git a/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.types b/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.types index d0a6d49487b93..21ce6dcfb9ec9 100644 --- a/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.types +++ b/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.types @@ -10,7 +10,7 @@ function f() { >u : U >U : U >U : U ->null : null +>null : U return g; >g : (u: U) => U diff --git a/tests/baselines/reference/contextualTypeArrayReturnType.types b/tests/baselines/reference/contextualTypeArrayReturnType.types index 6c91fd7b8b964..8e15e0ff4ff60 100644 --- a/tests/baselines/reference/contextualTypeArrayReturnType.types +++ b/tests/baselines/reference/contextualTypeArrayReturnType.types @@ -26,19 +26,19 @@ interface Transform3D { var style: IBookStyle = { >style : IBookStyle >IBookStyle : IBookStyle ->{ initialLeftPageTransforms: (width: number) => { return [ {'ry': null } ]; }} : { initialLeftPageTransforms: (width: number) => { 'ry': any; }[]; } +>{ initialLeftPageTransforms: (width: number) => { return [ {'ry': null } ]; }} : { initialLeftPageTransforms: (width: number) => { 'ry': Transform3D; }[]; } initialLeftPageTransforms: (width: number) => { ->initialLeftPageTransforms : (width: number) => { 'ry': any; }[] ->(width: number) => { return [ {'ry': null } ]; } : (width: number) => { 'ry': any; }[] +>initialLeftPageTransforms : (width: number) => { 'ry': Transform3D; }[] +>(width: number) => { return [ {'ry': null } ]; } : (width: number) => { 'ry': Transform3D; }[] >width : number return [ ->[ {'ry': null } ] : { 'ry': null; }[] +>[ {'ry': null } ] : { 'ry': Transform3D; }[] {'ry': null } ->{'ry': null } : { 'ry': null; } ->null : null +>{'ry': null } : { 'ry': Transform3D; } +>null : Transform3D ]; } diff --git a/tests/baselines/reference/contextualTypingOfObjectLiterals.types b/tests/baselines/reference/contextualTypingOfObjectLiterals.types index a99fb2f39afe8..ebd778b662844 100644 --- a/tests/baselines/reference/contextualTypingOfObjectLiterals.types +++ b/tests/baselines/reference/contextualTypingOfObjectLiterals.types @@ -10,9 +10,9 @@ var obj2 = {x: ""}; >"" : string obj1 = {}; // Ok ->obj1 = {} : {} +>obj1 = {} : { [x: string]: string; } >obj1 : { [x: string]: string; } ->{} : {} +>{} : { [x: string]: string; } obj1 = obj2; // Error - indexer doesn't match >obj1 = obj2 : { x: string; } @@ -27,7 +27,7 @@ function f(x: { [s: string]: string }) { } f({}); // Ok >f({}) : void >f : (x: { [s: string]: string; }) => void ->{} : {} +>{} : { [s: string]: string; } f(obj1); // Ok >f(obj1) : void diff --git a/tests/baselines/reference/contextuallyTypedFunctionExpressionsAndReturnAnnotations.types b/tests/baselines/reference/contextuallyTypedFunctionExpressionsAndReturnAnnotations.types index 94b184f65da25..373d4dbf18434 100644 --- a/tests/baselines/reference/contextuallyTypedFunctionExpressionsAndReturnAnnotations.types +++ b/tests/baselines/reference/contextuallyTypedFunctionExpressionsAndReturnAnnotations.types @@ -22,7 +22,7 @@ foo((y): (y2: number) => void => { >0 : number return null; ->null : null +>null : (y2: number) => void }); diff --git a/tests/baselines/reference/declFileGenericType.types b/tests/baselines/reference/declFileGenericType.types index 310f812a7bb6b..f70cecf78ac0d 100644 --- a/tests/baselines/reference/declFileGenericType.types +++ b/tests/baselines/reference/declFileGenericType.types @@ -16,7 +16,7 @@ export module C { >T : T >A : A >B : B ->null : null +>null : A export function F2(x: T): C.A { return null; } >F2 : (x: T) => A @@ -27,7 +27,7 @@ export module C { >A : A >C : any >B : B ->null : null +>null : A export function F3(x: T): C.A[] { return null; } >F3 : (x: T) => A[] @@ -38,7 +38,7 @@ export module C { >A : A >C : any >B : B ->null : null +>null : A[] export function F4>(x: T): Array> { return null; } >F4 : >(x: T) => A[] @@ -52,13 +52,13 @@ export module C { >A : A >C : any >B : B ->null : null +>null : A[] export function F5(): T { return null; } >F5 : () => T >T : T >T : T ->null : null +>null : T export function F6>(x: T): T { return null; } >F6 : >(x: T) => T @@ -68,7 +68,7 @@ export module C { >x : T >T : T >T : T ->null : null +>null : T export class D{ >D : D diff --git a/tests/baselines/reference/declFileGenericType2.types b/tests/baselines/reference/declFileGenericType2.types index c2a43db19214a..4a2693ef94102 100644 --- a/tests/baselines/reference/declFileGenericType2.types +++ b/tests/baselines/reference/declFileGenericType2.types @@ -140,11 +140,11 @@ module templa.dom.mvc.composite { >super : typeof AbstractElementController this._controllers = []; ->this._controllers = [] : undefined[] +>this._controllers = [] : templa.mvc.IController[] >this._controllers : templa.mvc.IController[] >this : this >_controllers : templa.mvc.IController[] ->[] : undefined[] +>[] : templa.mvc.IController[] } } } diff --git a/tests/baselines/reference/declFileImportModuleWithExportAssignment.types b/tests/baselines/reference/declFileImportModuleWithExportAssignment.types index 123b7b56d4faf..c95ab98a91420 100644 --- a/tests/baselines/reference/declFileImportModuleWithExportAssignment.types +++ b/tests/baselines/reference/declFileImportModuleWithExportAssignment.types @@ -12,9 +12,9 @@ a.test1(null, null, null); >a.test1 : a1.connectModule >a : { (): a1.connectExport; test1: a1.connectModule; test2(): a1.connectModule; } >test1 : a1.connectModule ->null : null ->null : null ->null : null +>null : any +>null : any +>null : any === tests/cases/compiler/declFileImportModuleWithExportAssignment_0.ts === diff --git a/tests/baselines/reference/declFileTypeAnnotationBuiltInType.types b/tests/baselines/reference/declFileTypeAnnotationBuiltInType.types index a1b2d9edd4362..f9dda2c4cf63d 100644 --- a/tests/baselines/reference/declFileTypeAnnotationBuiltInType.types +++ b/tests/baselines/reference/declFileTypeAnnotationBuiltInType.types @@ -59,7 +59,7 @@ function foo9(): any { >foo9 : () => any return undefined; ->undefined : undefined +>undefined : any } function foo10() { >foo10 : () => any diff --git a/tests/baselines/reference/declFileTypeofFunction.types b/tests/baselines/reference/declFileTypeofFunction.types index b47b07035d13b..1a55231db016c 100644 --- a/tests/baselines/reference/declFileTypeofFunction.types +++ b/tests/baselines/reference/declFileTypeofFunction.types @@ -44,7 +44,7 @@ function foo(): typeof foo { >foo : () => typeof foo return null; ->null : null +>null : () => typeof foo } var foo1: typeof foo; >foo1 : () => typeof foo diff --git a/tests/baselines/reference/declInput.types b/tests/baselines/reference/declInput.types index e59e3811fdf81..e23c24329891d 100644 --- a/tests/baselines/reference/declInput.types +++ b/tests/baselines/reference/declInput.types @@ -17,7 +17,7 @@ class bar { >a : bar >null : bar >bar : bar ->null : null +>null : bar >b : undefined >undefined : undefined >c : undefined diff --git a/tests/baselines/reference/declInput3.types b/tests/baselines/reference/declInput3.types index 0dcbc6bd3cdad..808c485f9f332 100644 --- a/tests/baselines/reference/declInput3.types +++ b/tests/baselines/reference/declInput3.types @@ -17,7 +17,7 @@ class bar { >a : bar >null : bar >bar : bar ->null : null +>null : bar >b : undefined >undefined : undefined >c : undefined diff --git a/tests/baselines/reference/declInput4.types b/tests/baselines/reference/declInput4.types index dd6915c162d62..de2aeb4dabac8 100644 --- a/tests/baselines/reference/declInput4.types +++ b/tests/baselines/reference/declInput4.types @@ -34,12 +34,12 @@ module M { public m232(): E { return null;} >m232 : () => E >E : E ->null : null +>null : E public m242(): I1 { return null; } >m242 : () => I1 >I1 : I1 ->null : null +>null : I1 public m26(i:I1) {} >m26 : (i: I1) => void diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES5.types b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES5.types index cb6052d93fd41..069367c4ff36b 100644 --- a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES5.types +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES5.types @@ -10,7 +10,7 @@ var { a1 }: any = undefined; var { a2 }: any = {}; >a2 : any ->{} : {} +>{} : any // V is an object assignment pattern and, for each assignment property P in V, // S has an apparent property with the property name specified in diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES6.types b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES6.types index 2d77c20f65be8..6db7e19b4e362 100644 --- a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES6.types +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES6.types @@ -10,7 +10,7 @@ var { a1 }: any = undefined; var { a2 }: any = {}; >a2 : any ->{} : {} +>{} : any // V is an object assignment pattern and, for each assignment property P in V, // S has an apparent property with the property name specified in diff --git a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt index d68220c830871..a755780ae5b37 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt @@ -40,13 +40,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( Type 'string' is not assignable to type 'number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(46,13): error TS2463: A binding pattern parameter cannot be optional in an implementation signature. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(47,13): error TS2463: A binding pattern parameter cannot be optional in an implementation signature. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(55,7): error TS2420: Class 'C4' incorrectly implements interface 'F2'. - Types of property 'd4' are incompatible. - Type '({x, y, c}: { x: any; y: any; c: any; }) => void' is not assignable to type '({x, y, z}?: { x: any; y: any; z: any; }) => any'. - Types of parameters '__0' and '__0' are incompatible. - Type '{ x: any; y: any; z: any; }' is not assignable to type '{ x: any; y: any; c: any; }'. - Property 'c' is missing in type '{ x: any; y: any; z: any; }'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(56,8): error TS2463: A binding pattern parameter cannot be optional in an implementation signature. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(57,15): error TS2459: Type '{ x: any; y: any; z: any; }' has no property 'c' and no string index signature. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(65,18): error TS2300: Duplicate identifier 'number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(65,26): error TS2300: Duplicate identifier 'number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(65,34): error TS2300: Duplicate identifier 'number'. @@ -167,17 +162,12 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( } class C4 implements F2 { - ~~ -!!! error TS2420: Class 'C4' incorrectly implements interface 'F2'. -!!! error TS2420: Types of property 'd4' are incompatible. -!!! error TS2420: Type '({x, y, c}: { x: any; y: any; c: any; }) => void' is not assignable to type '({x, y, z}?: { x: any; y: any; z: any; }) => any'. -!!! error TS2420: Types of parameters '__0' and '__0' are incompatible. -!!! error TS2420: Type '{ x: any; y: any; z: any; }' is not assignable to type '{ x: any; y: any; c: any; }'. -!!! error TS2420: Property 'c' is missing in type '{ x: any; y: any; z: any; }'. d3([a, b, c]?) { } // Error, binding pattern can't be optional in implementation signature ~~~~~~~~~~ !!! error TS2463: A binding pattern parameter cannot be optional in an implementation signature. d4({x, y, c}) { } + ~ +!!! error TS2459: Type '{ x: any; y: any; z: any; }' has no property 'c' and no string index signature. e0([a, b, q]) { } } diff --git a/tests/baselines/reference/destructuringParameterProperties2.errors.txt b/tests/baselines/reference/destructuringParameterProperties2.errors.txt index bc7588a853d4a..bf964d3412b43 100644 --- a/tests/baselines/reference/destructuringParameterProperties2.errors.txt +++ b/tests/baselines/reference/destructuringParameterProperties2.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(4 tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(9,21): error TS2339: Property 'a' does not exist on type 'C1'. tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(13,21): error TS2339: Property 'b' does not exist on type 'C1'. tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(17,21): error TS2339: Property 'c' does not exist on type 'C1'. -tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(21,27): error TS2345: Argument of type '[number, undefined, string]' is not assignable to parameter of type '[number, string, boolean]'. +tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(21,27): error TS2345: Argument of type '[number, string, string]' is not assignable to parameter of type '[number, string, boolean]'. Types of property '2' are incompatible. Type 'string' is not assignable to type 'boolean'. @@ -47,7 +47,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(2 var x = new C1(undefined, [0, undefined, ""]); ~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '[number, undefined, string]' is not assignable to parameter of type '[number, string, boolean]'. +!!! error TS2345: Argument of type '[number, string, string]' is not assignable to parameter of type '[number, string, boolean]'. !!! error TS2345: Types of property '2' are incompatible. !!! error TS2345: Type 'string' is not assignable to type 'boolean'. var [x_a, x_b, x_c] = [x.getA(), x.getB(), x.getC()]; diff --git a/tests/baselines/reference/destructuringVariableDeclaration1ES5.types b/tests/baselines/reference/destructuringVariableDeclaration1ES5.types index f8188147a7908..db383fbc28a60 100644 --- a/tests/baselines/reference/destructuringVariableDeclaration1ES5.types +++ b/tests/baselines/reference/destructuringVariableDeclaration1ES5.types @@ -62,16 +62,16 @@ var [b2 = 3, b3 = true, b4 = temp] = [3, false, { t1: false, t2: "hello" }]; >"hello" : string var [b5 = 3, b6 = true, b7 = temp] = [undefined, undefined, undefined]; ->b5 : any +>b5 : number >3 : number ->b6 : any +>b6 : boolean >true : boolean ->b7 : any +>b7 : { t1: boolean; t2: string; } >temp : { t1: boolean; t2: string; } ->[undefined, undefined, undefined] : [undefined, undefined, undefined] ->undefined : undefined ->undefined : undefined ->undefined : undefined +>[undefined, undefined, undefined] : [number, boolean, { t1: boolean; t2: string; }] +>undefined : number +>undefined : boolean +>undefined : { t1: boolean; t2: string; } // The type T associated with a binding element is determined as follows: // If the binding element is a rest element, T is an array type with diff --git a/tests/baselines/reference/destructuringVariableDeclaration1ES6.types b/tests/baselines/reference/destructuringVariableDeclaration1ES6.types index 7b4fe5409dbaa..9dc4606a53e97 100644 --- a/tests/baselines/reference/destructuringVariableDeclaration1ES6.types +++ b/tests/baselines/reference/destructuringVariableDeclaration1ES6.types @@ -62,16 +62,16 @@ var [b2 = 3, b3 = true, b4 = temp] = [3, false, { t1: false, t2: "hello" }]; >"hello" : string var [b5 = 3, b6 = true, b7 = temp] = [undefined, undefined, undefined]; ->b5 : any +>b5 : number >3 : number ->b6 : any +>b6 : boolean >true : boolean ->b7 : any +>b7 : { t1: boolean; t2: string; } >temp : { t1: boolean; t2: string; } ->[undefined, undefined, undefined] : [undefined, undefined, undefined] ->undefined : undefined ->undefined : undefined ->undefined : undefined +>[undefined, undefined, undefined] : [number, boolean, { t1: boolean; t2: string; }] +>undefined : number +>undefined : boolean +>undefined : { t1: boolean; t2: string; } // The type T associated with a binding element is determined as follows: // If the binding element is a rest element, T is an array type with diff --git a/tests/baselines/reference/destructuringWithLiteralInitializers.types b/tests/baselines/reference/destructuringWithLiteralInitializers.types index 9b970679f7461..9e6bbbca78aa4 100644 --- a/tests/baselines/reference/destructuringWithLiteralInitializers.types +++ b/tests/baselines/reference/destructuringWithLiteralInitializers.types @@ -48,7 +48,7 @@ function f3({ x = 0, y = 0 }) { } f3({}); >f3({}) : void >f3 : ({x, y}: { x?: number; y?: number; }) => void ->{} : {} +>{} : { x?: number; y?: number; } f3({ x: 1 }); >f3({ x: 1 }) : void @@ -143,26 +143,26 @@ f6(); f6({}); >f6({}) : void >f6 : ({x, y}?: { x?: number; y?: number; }) => void ->{} : {} +>{} : { x?: number; y?: number; } f6({ x: 1 }); >f6({ x: 1 }) : void >f6 : ({x, y}?: { x?: number; y?: number; }) => void ->{ x: 1 } : { x: number; } +>{ x: 1 } : { x?: number; y?: number; } >x : number >1 : number f6({ y: 1 }); >f6({ y: 1 }) : void >f6 : ({x, y}?: { x?: number; y?: number; }) => void ->{ y: 1 } : { y: number; } +>{ y: 1 } : { y?: number; x?: number; } >y : number >1 : number f6({ x: 1, y: 1 }); >f6({ x: 1, y: 1 }) : void >f6 : ({x, y}?: { x?: number; y?: number; }) => void ->{ x: 1, y: 1 } : { x: number; y: number; } +>{ x: 1, y: 1 } : { x?: number; y?: number; } >x : number >1 : number >y : number @@ -187,34 +187,34 @@ f7(); f7({ a: {} }); >f7({ a: {} }) : void >f7 : ({a: {x, y}}?: { a: { x?: number; y?: number; }; }) => void ->{ a: {} } : { a: {}; } ->a : {} ->{} : {} +>{ a: {} } : { a: { x?: number; y?: number; }; } +>a : { x?: number; y?: number; } +>{} : { x?: number; y?: number; } f7({ a: { x: 1 } }); >f7({ a: { x: 1 } }) : void >f7 : ({a: {x, y}}?: { a: { x?: number; y?: number; }; }) => void ->{ a: { x: 1 } } : { a: { x: number; }; } ->a : { x: number; } ->{ x: 1 } : { x: number; } +>{ a: { x: 1 } } : { a: { x?: number; y?: number; }; } +>a : { x?: number; y?: number; } +>{ x: 1 } : { x?: number; y?: number; } >x : number >1 : number f7({ a: { y: 1 } }); >f7({ a: { y: 1 } }) : void >f7 : ({a: {x, y}}?: { a: { x?: number; y?: number; }; }) => void ->{ a: { y: 1 } } : { a: { y: number; }; } ->a : { y: number; } ->{ y: 1 } : { y: number; } +>{ a: { y: 1 } } : { a: { y?: number; x?: number; }; } +>a : { y?: number; x?: number; } +>{ y: 1 } : { y?: number; x?: number; } >y : number >1 : number f7({ a: { x: 1, y: 1 } }); >f7({ a: { x: 1, y: 1 } }) : void >f7 : ({a: {x, y}}?: { a: { x?: number; y?: number; }; }) => void ->{ a: { x: 1, y: 1 } } : { a: { x: number; y: number; }; } ->a : { x: number; y: number; } ->{ x: 1, y: 1 } : { x: number; y: number; } +>{ a: { x: 1, y: 1 } } : { a: { x?: number; y?: number; }; } +>a : { x?: number; y?: number; } +>{ x: 1, y: 1 } : { x?: number; y?: number; } >x : number >1 : number >y : number diff --git a/tests/baselines/reference/doNotWidenAtObjectLiteralPropertyAssignment.types b/tests/baselines/reference/doNotWidenAtObjectLiteralPropertyAssignment.types index f151b5841c0a0..e1ac3193f8f0f 100644 --- a/tests/baselines/reference/doNotWidenAtObjectLiteralPropertyAssignment.types +++ b/tests/baselines/reference/doNotWidenAtObjectLiteralPropertyAssignment.types @@ -21,12 +21,12 @@ interface IIntervalTreeNode { var test: IIntervalTreeNode[] = [{ interval: { begin: 0 }, children: null }]; // was error here because best common type is {} >test : IIntervalTreeNode[] >IIntervalTreeNode : IIntervalTreeNode ->[{ interval: { begin: 0 }, children: null }] : { interval: { begin: number; }; children: null; }[] ->{ interval: { begin: 0 }, children: null } : { interval: { begin: number; }; children: null; } +>[{ interval: { begin: 0 }, children: null }] : { interval: { begin: number; }; children: IIntervalTreeNode[]; }[] +>{ interval: { begin: 0 }, children: null } : { interval: { begin: number; }; children: IIntervalTreeNode[]; } >interval : { begin: number; } >{ begin: 0 } : { begin: number; } >begin : number >0 : number ->children : null ->null : null +>children : IIntervalTreeNode[] +>null : IIntervalTreeNode[] diff --git a/tests/baselines/reference/dottedSymbolResolution1.types b/tests/baselines/reference/dottedSymbolResolution1.types index cf5a5e3ba9d7a..4dee53c71166a 100644 --- a/tests/baselines/reference/dottedSymbolResolution1.types +++ b/tests/baselines/reference/dottedSymbolResolution1.types @@ -49,7 +49,7 @@ function each(collection: any, callback: (indexInArray: any, valueOfElement: any >valueOfElement : any return null; ->null : null +>null : any } function _setBarAndText(): void { diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types index 3640d468a592f..8c0170c91ed4d 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types @@ -87,7 +87,7 @@ const ns: number[][] = []; >ns : number[][] ->[] : undefined[] +>[] : number[][] for (var {} of ns) { >ns : number[][] diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types index 20b7d5ec2b628..51fe4cf8fffa7 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types @@ -87,7 +87,7 @@ const ns: number[][] = []; >ns : number[][] ->[] : undefined[] +>[] : number[][] for (var {} of ns) { >ns : number[][] diff --git a/tests/baselines/reference/es6ClassTest8.types b/tests/baselines/reference/es6ClassTest8.types index b12d65e595f55..c40d70b0e7f73 100644 --- a/tests/baselines/reference/es6ClassTest8.types +++ b/tests/baselines/reference/es6ClassTest8.types @@ -36,7 +36,7 @@ class Vector { >v : Vector >Vector : Vector >Vector : Vector ->null : null +>null : Vector static minus(v1:Vector, v2:Vector):Vector {return null;} >minus : (v1: Vector, v2: Vector) => Vector @@ -45,7 +45,7 @@ class Vector { >v2 : Vector >Vector : Vector >Vector : Vector ->null : null +>null : Vector static times(v1:Vector, v2:Vector):Vector {return null;} >times : (v1: Vector, v2: Vector) => Vector @@ -54,7 +54,7 @@ class Vector { >v2 : Vector >Vector : Vector >Vector : Vector ->null : null +>null : Vector static cross(v1:Vector, v2:Vector):Vector {return null;} >cross : (v1: Vector, v2: Vector) => Vector @@ -63,7 +63,7 @@ class Vector { >v2 : Vector >Vector : Vector >Vector : Vector ->null : null +>null : Vector constructor(public x: number, >x : number @@ -82,7 +82,7 @@ class Vector { >v2 : Vector >Vector : Vector >Vector : Vector ->null : null +>null : Vector } diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.types b/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.types index 0e7059f4eed3c..3a39119f3b751 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.types +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.types @@ -81,15 +81,15 @@ var anObject: Object = new Object(); var anAny: any = null; >anAny : any ->null : null +>null : any var aSecondAny: any = undefined; >aSecondAny : any ->undefined : undefined +>undefined : any var aVoid: void = undefined; >aVoid : void ->undefined : undefined +>undefined : void var anInterface: I = new C(); >anInterface : I diff --git a/tests/baselines/reference/fixingTypeParametersRepeatedly1.types b/tests/baselines/reference/fixingTypeParametersRepeatedly1.types index 273c66b342d6c..2f91ad8ffb248 100644 --- a/tests/baselines/reference/fixingTypeParametersRepeatedly1.types +++ b/tests/baselines/reference/fixingTypeParametersRepeatedly1.types @@ -20,7 +20,7 @@ f("", x => null, x => x.toLowerCase()); >"" : string >x => null : (x: string) => any >x : string ->null : null +>null : string >x => x.toLowerCase() : (x: string) => string >x : string >x.toLowerCase() : string @@ -53,7 +53,7 @@ g("", x => null, x => x.toLowerCase()); >"" : string >x => null : (x: string) => any >x : string ->null : null +>null : string >x => x.toLowerCase() : (x: string) => string >x : string >x.toLowerCase() : string diff --git a/tests/baselines/reference/forStatements.types b/tests/baselines/reference/forStatements.types index 95b198a7fec7a..0607cebcd3fe3 100644 --- a/tests/baselines/reference/forStatements.types +++ b/tests/baselines/reference/forStatements.types @@ -82,15 +82,15 @@ for(var anObject: Object = new Object();;){} for(var anAny: any = null;;){} >anAny : any ->null : null +>null : any for(var aSecondAny: any = undefined;;){} >aSecondAny : any ->undefined : undefined +>undefined : any for(var aVoid: void = undefined;;){} >aVoid : void ->undefined : undefined +>undefined : void for(var anInterface: I = new C();;){} >anInterface : I diff --git a/tests/baselines/reference/forStatementsMultipleValidDecl.types b/tests/baselines/reference/forStatementsMultipleValidDecl.types index acb26f173120b..625c9e0bd7621 100644 --- a/tests/baselines/reference/forStatementsMultipleValidDecl.types +++ b/tests/baselines/reference/forStatementsMultipleValidDecl.types @@ -12,7 +12,7 @@ for (var x = 2; ;) { } for (var x = undefined; ;) { } >x : number >undefined : number ->undefined : undefined +>undefined : number // new declaration space, making redeclaring x as a string valid function declSpace() { @@ -42,11 +42,11 @@ for (var p = { x: 1, y: 2 }; ;) { } for (var p: Point = { x: 0, y: undefined }; ;) { } >p : Point >Point : Point ->{ x: 0, y: undefined } : { x: number; y: undefined; } +>{ x: 0, y: undefined } : { x: number; y: number; } >x : number >0 : number ->y : undefined ->undefined : undefined +>y : number +>undefined : number for (var p = { x: 1, y: undefined }; ;) { } >p : Point @@ -55,7 +55,7 @@ for (var p = { x: 1, y: undefined }; ;) { } >1 : number >y : number >undefined : number ->undefined : undefined +>undefined : number for (var p: { x: number; y: number; } = { x: 1, y: 2 }; ;) { } >p : Point @@ -72,11 +72,11 @@ for (var p = <{ x: number; y: number; }>{ x: 0, y: undefined }; ;) { } ><{ x: number; y: number; }>{ x: 0, y: undefined } : { x: number; y: number; } >x : number >y : number ->{ x: 0, y: undefined } : { x: number; y: undefined; } +>{ x: 0, y: undefined } : { x: number; y: number; } >x : number >0 : number ->y : undefined ->undefined : undefined +>y : number +>undefined : number for (var p: typeof p; ;) { } >p : Point @@ -106,7 +106,7 @@ for (var fn = <(s: string) => number> null; ;) { } >fn : (s: string) => number ><(s: string) => number> null : (s: string) => number >s : string ->null : null +>null : (s: string) => number for (var fn: typeof fn; ;) { } >fn : (s: string) => number @@ -124,11 +124,11 @@ for (var a = ['a', 'b']; ;) { } for (var a = []; ;) { } >a : string[] >[] : string[] ->[] : undefined[] +>[] : string[] for (var a: string[] = []; ;) { } >a : string[] ->[] : undefined[] +>[] : string[] for (var a = new Array(); ;) { } >a : string[] diff --git a/tests/baselines/reference/functionOverloads43.types b/tests/baselines/reference/functionOverloads43.types index 7c0fa8eb8185b..3931532a6d25a 100644 --- a/tests/baselines/reference/functionOverloads43.types +++ b/tests/baselines/reference/functionOverloads43.types @@ -24,7 +24,7 @@ function foo([x]: { a:number | string }[]): string | number { } return undefined; ->undefined : undefined +>undefined : string | number } var x = foo([{a: "str"}]); diff --git a/tests/baselines/reference/functionOverloads44.types b/tests/baselines/reference/functionOverloads44.types index 56cad09b47287..7a63503facdf3 100644 --- a/tests/baselines/reference/functionOverloads44.types +++ b/tests/baselines/reference/functionOverloads44.types @@ -32,7 +32,7 @@ function foo1([x]: { a:number | string }[]): Dog { >Dog : Dog return undefined; ->undefined : undefined +>undefined : Dog } function foo2(bar: { a:number }[]): Cat; @@ -55,7 +55,7 @@ function foo2([x]: { a:number | string }[]): Cat { >Cat : Cat return undefined; ->undefined : undefined +>undefined : Cat } diff --git a/tests/baselines/reference/functionOverloads45.types b/tests/baselines/reference/functionOverloads45.types index 257a615e3349d..80ce01e309a1f 100644 --- a/tests/baselines/reference/functionOverloads45.types +++ b/tests/baselines/reference/functionOverloads45.types @@ -32,7 +32,7 @@ function foo1([x]: { a:number | string }[]): Animal { >Animal : Animal return undefined; ->undefined : undefined +>undefined : Animal } function foo2(bar: { a:number }[]): Cat; @@ -55,7 +55,7 @@ function foo2([x]: { a:number | string }[]): Cat | Dog { >Dog : Dog return undefined; ->undefined : undefined +>undefined : Cat | Dog } diff --git a/tests/baselines/reference/functionReturn.types b/tests/baselines/reference/functionReturn.types index f9c0b36fbc23a..e41bc19930d73 100644 --- a/tests/baselines/reference/functionReturn.types +++ b/tests/baselines/reference/functionReturn.types @@ -32,5 +32,5 @@ function f5(): string { >'' : string return undefined; ->undefined : undefined +>undefined : string } diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs2.types b/tests/baselines/reference/functionSubtypingOfVarArgs2.types index 3aa5b7a7a0025..5313cc8400a29 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs2.types +++ b/tests/baselines/reference/functionSubtypingOfVarArgs2.types @@ -5,7 +5,7 @@ class EventBase { private _listeners: { (...args: any[]): void; }[] = []; >_listeners : ((...args: any[]) => void)[] >args : any[] ->[] : undefined[] +>[] : ((...args: any[]) => void)[] add(listener: (...args: any[]) => void): void { >add : (listener: (...args: any[]) => void) => void diff --git a/tests/baselines/reference/functionTypeArgumentArrayAssignment.types b/tests/baselines/reference/functionTypeArgumentArrayAssignment.types index 588dfd506ef9e..73375ac5e21f0 100644 --- a/tests/baselines/reference/functionTypeArgumentArrayAssignment.types +++ b/tests/baselines/reference/functionTypeArgumentArrayAssignment.types @@ -21,7 +21,7 @@ module test { var ys: U[] = []; >ys : U[] >U : U ->[] : undefined[] +>[] : U[] } } diff --git a/tests/baselines/reference/generatedContextualTyping.types b/tests/baselines/reference/generatedContextualTyping.types index 2e9625cdb8bd1..692d179a99a60 100644 --- a/tests/baselines/reference/generatedContextualTyping.types +++ b/tests/baselines/reference/generatedContextualTyping.types @@ -123,7 +123,7 @@ var x11: (s: Base[]) => any = n => { var n: Base[]; return null; }; >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any var x12: Genric = { func: n => { return [d1, d2]; } }; >x12 : Genric @@ -239,7 +239,7 @@ class x23 { member: (s: Base[]) => any = n => { var n: Base[]; return null; } } >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any class x24 { member: Genric = { func: n => { return [d1, d2]; } } } >x24 : x24 @@ -356,7 +356,7 @@ class x35 { private member: (s: Base[]) => any = n => { var n: Base[]; return nu >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any class x36 { private member: Genric = { func: n => { return [d1, d2]; } } } >x36 : x36 @@ -473,7 +473,7 @@ class x47 { public member: (s: Base[]) => any = n => { var n: Base[]; return nul >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any class x48 { public member: Genric = { func: n => { return [d1, d2]; } } } >x48 : x48 @@ -590,7 +590,7 @@ class x59 { static member: (s: Base[]) => any = n => { var n: Base[]; return nul >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any class x60 { static member: Genric = { func: n => { return [d1, d2]; } } } >x60 : x60 @@ -707,7 +707,7 @@ class x71 { private static member: (s: Base[]) => any = n => { var n: Base[]; re >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any class x72 { private static member: Genric = { func: n => { return [d1, d2]; } } } >x72 : x72 @@ -824,7 +824,7 @@ class x83 { public static member: (s: Base[]) => any = n => { var n: Base[]; ret >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any class x84 { public static member: Genric = { func: n => { return [d1, d2]; } } } >x84 : x84 @@ -941,7 +941,7 @@ class x95 { constructor(parm: (s: Base[]) => any = n => { var n: Base[]; return >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any class x96 { constructor(parm: Genric = { func: n => { return [d1, d2]; } }) { } } >x96 : x96 @@ -1058,7 +1058,7 @@ class x107 { constructor(public parm: (s: Base[]) => any = n => { var n: Base[]; >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any class x108 { constructor(public parm: Genric = { func: n => { return [d1, d2]; } }) { } } >x108 : x108 @@ -1175,7 +1175,7 @@ class x119 { constructor(private parm: (s: Base[]) => any = n => { var n: Base[] >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any class x120 { constructor(private parm: Genric = { func: n => { return [d1, d2]; } }) { } } >x120 : x120 @@ -1292,7 +1292,7 @@ function x131(parm: (s: Base[]) => any = n => { var n: Base[]; return null; }) { >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any function x132(parm: Genric = { func: n => { return [d1, d2]; } }) { } >x132 : (parm?: Genric) => void @@ -1398,7 +1398,7 @@ function x143(): (s: Base[]) => any { return n => { var n: Base[]; return null; >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any function x144(): Genric { return { func: n => { return [d1, d2]; } }; } >x144 : () => Genric @@ -1543,12 +1543,12 @@ function x155(): (s: Base[]) => any { return n => { var n: Base[]; return null; >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any >n => { var n: Base[]; return null; } : (n: Base[]) => any >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any function x156(): Genric { return { func: n => { return [d1, d2]; } }; return { func: n => { return [d1, d2]; } }; } >x156 : () => Genric @@ -1671,7 +1671,7 @@ var x167: () => (s: Base[]) => any = () => { return n => { var n: Base[]; return >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any var x168: () => Genric = () => { return { func: n => { return [d1, d2]; } }; }; >x168 : () => Genric @@ -1788,7 +1788,7 @@ var x179: () => (s: Base[]) => any = function() { return n => { var n: Base[]; r >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any var x180: () => Genric = function() { return { func: n => { return [d1, d2]; } }; }; >x180 : () => Genric @@ -1905,7 +1905,7 @@ module x191 { var t: (s: Base[]) => any = n => { var n: Base[]; return null; }; >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any module x192 { var t: Genric = { func: n => { return [d1, d2]; } }; } >x192 : typeof x192 @@ -2022,7 +2022,7 @@ module x203 { export var t: (s: Base[]) => any = n => { var n: Base[]; return nu >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any module x204 { export var t: Genric = { func: n => { return [d1, d2]; } }; } >x204 : typeof x204 @@ -2131,7 +2131,7 @@ var x217 = (<() => Base[]>undefined) || function() { return [d1, d2] }; >(<() => Base[]>undefined) : () => Base[] ><() => Base[]>undefined : () => Base[] >Base : Base ->undefined : undefined +>undefined : () => Base[] >function() { return [d1, d2] } : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 @@ -2143,7 +2143,7 @@ var x218 = (<() => Base[]>undefined) || function named() { return [d1, d2] }; >(<() => Base[]>undefined) : () => Base[] ><() => Base[]>undefined : () => Base[] >Base : Base ->undefined : undefined +>undefined : () => Base[] >function named() { return [d1, d2] } : () => (Derived1 | Derived2)[] >named : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] @@ -2156,7 +2156,7 @@ var x219 = (<{ (): Base[]; }>undefined) || function() { return [d1, d2] }; >(<{ (): Base[]; }>undefined) : () => Base[] ><{ (): Base[]; }>undefined : () => Base[] >Base : Base ->undefined : undefined +>undefined : () => Base[] >function() { return [d1, d2] } : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 @@ -2168,7 +2168,7 @@ var x220 = (<{ (): Base[]; }>undefined) || function named() { return [d1, d2] }; >(<{ (): Base[]; }>undefined) : () => Base[] ><{ (): Base[]; }>undefined : () => Base[] >Base : Base ->undefined : undefined +>undefined : () => Base[] >function named() { return [d1, d2] } : () => (Derived1 | Derived2)[] >named : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] @@ -2181,7 +2181,7 @@ var x221 = (undefined) || [d1, d2]; >(undefined) : Base[] >undefined : Base[] >Base : Base ->undefined : undefined +>undefined : Base[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 @@ -2193,7 +2193,7 @@ var x222 = (>undefined) || [d1, d2]; >>undefined : Base[] >Array : T[] >Base : Base ->undefined : undefined +>undefined : Base[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 @@ -2205,7 +2205,7 @@ var x223 = (<{ [n: number]: Base; }>undefined) || [d1, d2]; ><{ [n: number]: Base; }>undefined : { [n: number]: Base; } >n : number >Base : Base ->undefined : undefined +>undefined : { [n: number]: Base; } >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 @@ -2217,7 +2217,7 @@ var x224 = (<{n: Base[]; } >undefined) || { n: [d1, d2] }; ><{n: Base[]; } >undefined : { n: Base[]; } >n : Base[] >Base : Base ->undefined : undefined +>undefined : { n: Base[]; } >{ n: [d1, d2] } : { n: (Derived1 | Derived2)[]; } >n : (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] @@ -2337,7 +2337,7 @@ var x235: (s: Base[]) => any; x235 = n => { var n: Base[]; return null; }; >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any var x236: Genric; x236 = { func: n => { return [d1, d2]; } }; >x236 : Genric @@ -2477,7 +2477,7 @@ var x247: { n: (s: Base[]) => any; } = { n: n => { var n: Base[]; return null; } >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any var x248: { n: Genric; } = { n: { func: n => { return [d1, d2]; } } }; >x248 : { n: Genric; } @@ -2575,91 +2575,91 @@ var x260: Genric[] = [{ func: n => { return [d1, d2]; } }]; var x261: () => Base[] = function() { return [d1, d2] } || undefined; >x261 : () => Base[] >Base : Base ->function() { return [d1, d2] } || undefined : () => (Derived1 | Derived2)[] +>function() { return [d1, d2] } || undefined : () => Base[] >function() { return [d1, d2] } : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : () => Base[] var x262: () => Base[] = function named() { return [d1, d2] } || undefined; >x262 : () => Base[] >Base : Base ->function named() { return [d1, d2] } || undefined : () => (Derived1 | Derived2)[] +>function named() { return [d1, d2] } || undefined : () => Base[] >function named() { return [d1, d2] } : () => (Derived1 | Derived2)[] >named : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : () => Base[] var x263: { (): Base[]; } = function() { return [d1, d2] } || undefined; >x263 : () => Base[] >Base : Base ->function() { return [d1, d2] } || undefined : () => (Derived1 | Derived2)[] +>function() { return [d1, d2] } || undefined : () => Base[] >function() { return [d1, d2] } : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : () => Base[] var x264: { (): Base[]; } = function named() { return [d1, d2] } || undefined; >x264 : () => Base[] >Base : Base ->function named() { return [d1, d2] } || undefined : () => (Derived1 | Derived2)[] +>function named() { return [d1, d2] } || undefined : () => Base[] >function named() { return [d1, d2] } : () => (Derived1 | Derived2)[] >named : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : () => Base[] var x265: Base[] = [d1, d2] || undefined; >x265 : Base[] >Base : Base ->[d1, d2] || undefined : (Derived1 | Derived2)[] +>[d1, d2] || undefined : Base[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : Base[] var x266: Array = [d1, d2] || undefined; >x266 : Base[] >Array : T[] >Base : Base ->[d1, d2] || undefined : (Derived1 | Derived2)[] +>[d1, d2] || undefined : Base[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : Base[] var x267: { [n: number]: Base; } = [d1, d2] || undefined; >x267 : { [n: number]: Base; } >n : number >Base : Base ->[d1, d2] || undefined : (Derived1 | Derived2)[] +>[d1, d2] || undefined : { [n: number]: Base; } >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : { [n: number]: Base; } var x268: {n: Base[]; } = { n: [d1, d2] } || undefined; >x268 : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } || undefined : { n: (Derived1 | Derived2)[]; } +>{ n: [d1, d2] } || undefined : { n: Base[]; } >{ n: [d1, d2] } : { n: (Derived1 | Derived2)[]; } >n : (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : { n: Base[]; } var x269: () => Base[] = undefined || function() { return [d1, d2] }; >x269 : () => Base[] >Base : Base ->undefined || function() { return [d1, d2] } : () => (Derived1 | Derived2)[] ->undefined : undefined +>undefined || function() { return [d1, d2] } : () => Base[] +>undefined : () => Base[] >function() { return [d1, d2] } : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 @@ -2668,8 +2668,8 @@ var x269: () => Base[] = undefined || function() { return [d1, d2] }; var x270: () => Base[] = undefined || function named() { return [d1, d2] }; >x270 : () => Base[] >Base : Base ->undefined || function named() { return [d1, d2] } : () => (Derived1 | Derived2)[] ->undefined : undefined +>undefined || function named() { return [d1, d2] } : () => Base[] +>undefined : () => Base[] >function named() { return [d1, d2] } : () => (Derived1 | Derived2)[] >named : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] @@ -2679,8 +2679,8 @@ var x270: () => Base[] = undefined || function named() { return [d1, d2] }; var x271: { (): Base[]; } = undefined || function() { return [d1, d2] }; >x271 : () => Base[] >Base : Base ->undefined || function() { return [d1, d2] } : () => (Derived1 | Derived2)[] ->undefined : undefined +>undefined || function() { return [d1, d2] } : () => Base[] +>undefined : () => Base[] >function() { return [d1, d2] } : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 @@ -2689,8 +2689,8 @@ var x271: { (): Base[]; } = undefined || function() { return [d1, d2] }; var x272: { (): Base[]; } = undefined || function named() { return [d1, d2] }; >x272 : () => Base[] >Base : Base ->undefined || function named() { return [d1, d2] } : () => (Derived1 | Derived2)[] ->undefined : undefined +>undefined || function named() { return [d1, d2] } : () => Base[] +>undefined : () => Base[] >function named() { return [d1, d2] } : () => (Derived1 | Derived2)[] >named : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] @@ -2700,8 +2700,8 @@ var x272: { (): Base[]; } = undefined || function named() { return [d1, d2] }; var x273: Base[] = undefined || [d1, d2]; >x273 : Base[] >Base : Base ->undefined || [d1, d2] : (Derived1 | Derived2)[] ->undefined : undefined +>undefined || [d1, d2] : Base[] +>undefined : Base[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 @@ -2710,8 +2710,8 @@ var x274: Array = undefined || [d1, d2]; >x274 : Base[] >Array : T[] >Base : Base ->undefined || [d1, d2] : (Derived1 | Derived2)[] ->undefined : undefined +>undefined || [d1, d2] : Base[] +>undefined : Base[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 @@ -2720,8 +2720,8 @@ var x275: { [n: number]: Base; } = undefined || [d1, d2]; >x275 : { [n: number]: Base; } >n : number >Base : Base ->undefined || [d1, d2] : (Derived1 | Derived2)[] ->undefined : undefined +>undefined || [d1, d2] : { [n: number]: Base; } +>undefined : { [n: number]: Base; } >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 @@ -2730,8 +2730,8 @@ var x276: {n: Base[]; } = undefined || { n: [d1, d2] }; >x276 : { n: Base[]; } >n : Base[] >Base : Base ->undefined || { n: [d1, d2] } : { n: (Derived1 | Derived2)[]; } ->undefined : undefined +>undefined || { n: [d1, d2] } : { n: Base[]; } +>undefined : { n: Base[]; } >{ n: [d1, d2] } : { n: (Derived1 | Derived2)[]; } >n : (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] @@ -2998,12 +2998,12 @@ var x295: (s: Base[]) => any = true ? n => { var n: Base[]; return null; } : n = >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any >n => { var n: Base[]; return null; } : (n: Base[]) => any >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any var x296: Genric = true ? { func: n => { return [d1, d2]; } } : { func: n => { return [d1, d2]; } }; >x296 : Genric @@ -3029,9 +3029,9 @@ var x296: Genric = true ? { func: n => { return [d1, d2]; } } : { func: n var x297: () => Base[] = true ? undefined : () => [d1, d2]; >x297 : () => Base[] >Base : Base ->true ? undefined : () => [d1, d2] : () => (Derived1 | Derived2)[] +>true ? undefined : () => [d1, d2] : () => Base[] >true : boolean ->undefined : undefined +>undefined : () => Base[] >() => [d1, d2] : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 @@ -3040,9 +3040,9 @@ var x297: () => Base[] = true ? undefined : () => [d1, d2]; var x298: () => Base[] = true ? undefined : function() { return [d1, d2] }; >x298 : () => Base[] >Base : Base ->true ? undefined : function() { return [d1, d2] } : () => (Derived1 | Derived2)[] +>true ? undefined : function() { return [d1, d2] } : () => Base[] >true : boolean ->undefined : undefined +>undefined : () => Base[] >function() { return [d1, d2] } : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 @@ -3051,9 +3051,9 @@ var x298: () => Base[] = true ? undefined : function() { return [d1, d2] }; var x299: () => Base[] = true ? undefined : function named() { return [d1, d2] }; >x299 : () => Base[] >Base : Base ->true ? undefined : function named() { return [d1, d2] } : () => (Derived1 | Derived2)[] +>true ? undefined : function named() { return [d1, d2] } : () => Base[] >true : boolean ->undefined : undefined +>undefined : () => Base[] >function named() { return [d1, d2] } : () => (Derived1 | Derived2)[] >named : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] @@ -3063,9 +3063,9 @@ var x299: () => Base[] = true ? undefined : function named() { return [d1, d2] } var x300: { (): Base[]; } = true ? undefined : () => [d1, d2]; >x300 : () => Base[] >Base : Base ->true ? undefined : () => [d1, d2] : () => (Derived1 | Derived2)[] +>true ? undefined : () => [d1, d2] : () => Base[] >true : boolean ->undefined : undefined +>undefined : () => Base[] >() => [d1, d2] : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 @@ -3074,9 +3074,9 @@ var x300: { (): Base[]; } = true ? undefined : () => [d1, d2]; var x301: { (): Base[]; } = true ? undefined : function() { return [d1, d2] }; >x301 : () => Base[] >Base : Base ->true ? undefined : function() { return [d1, d2] } : () => (Derived1 | Derived2)[] +>true ? undefined : function() { return [d1, d2] } : () => Base[] >true : boolean ->undefined : undefined +>undefined : () => Base[] >function() { return [d1, d2] } : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 @@ -3085,9 +3085,9 @@ var x301: { (): Base[]; } = true ? undefined : function() { return [d1, d2] }; var x302: { (): Base[]; } = true ? undefined : function named() { return [d1, d2] }; >x302 : () => Base[] >Base : Base ->true ? undefined : function named() { return [d1, d2] } : () => (Derived1 | Derived2)[] +>true ? undefined : function named() { return [d1, d2] } : () => Base[] >true : boolean ->undefined : undefined +>undefined : () => Base[] >function named() { return [d1, d2] } : () => (Derived1 | Derived2)[] >named : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] @@ -3097,9 +3097,9 @@ var x302: { (): Base[]; } = true ? undefined : function named() { return [d1, d2 var x303: Base[] = true ? undefined : [d1, d2]; >x303 : Base[] >Base : Base ->true ? undefined : [d1, d2] : (Derived1 | Derived2)[] +>true ? undefined : [d1, d2] : Base[] >true : boolean ->undefined : undefined +>undefined : Base[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 @@ -3108,9 +3108,9 @@ var x304: Array = true ? undefined : [d1, d2]; >x304 : Base[] >Array : T[] >Base : Base ->true ? undefined : [d1, d2] : (Derived1 | Derived2)[] +>true ? undefined : [d1, d2] : Base[] >true : boolean ->undefined : undefined +>undefined : Base[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 @@ -3119,9 +3119,9 @@ var x305: { [n: number]: Base; } = true ? undefined : [d1, d2]; >x305 : { [n: number]: Base; } >n : number >Base : Base ->true ? undefined : [d1, d2] : (Derived1 | Derived2)[] +>true ? undefined : [d1, d2] : { [n: number]: Base; } >true : boolean ->undefined : undefined +>undefined : { [n: number]: Base; } >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 @@ -3130,9 +3130,9 @@ var x306: {n: Base[]; } = true ? undefined : { n: [d1, d2] }; >x306 : { n: Base[]; } >n : Base[] >Base : Base ->true ? undefined : { n: [d1, d2] } : { n: (Derived1 | Derived2)[]; } +>true ? undefined : { n: [d1, d2] } : { n: Base[]; } >true : boolean ->undefined : undefined +>undefined : { n: Base[]; } >{ n: [d1, d2] } : { n: (Derived1 | Derived2)[]; } >n : (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] @@ -3143,22 +3143,22 @@ var x307: (s: Base[]) => any = true ? undefined : n => { var n: Base[]; return n >x307 : (s: Base[]) => any >s : Base[] >Base : Base ->true ? undefined : n => { var n: Base[]; return null; } : (n: Base[]) => any +>true ? undefined : n => { var n: Base[]; return null; } : (s: Base[]) => any >true : boolean ->undefined : undefined +>undefined : (s: Base[]) => any >n => { var n: Base[]; return null; } : (n: Base[]) => any >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any var x308: Genric = true ? undefined : { func: n => { return [d1, d2]; } }; >x308 : Genric >Genric : Genric >Base : Base ->true ? undefined : { func: n => { return [d1, d2]; } } : { func: (n: Base[]) => (Derived1 | Derived2)[]; } +>true ? undefined : { func: n => { return [d1, d2]; } } : Genric >true : boolean ->undefined : undefined +>undefined : Genric >{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => (Derived1 | Derived2)[]; } >func : (n: Base[]) => (Derived1 | Derived2)[] >n => { return [d1, d2]; } : (n: Base[]) => (Derived1 | Derived2)[] @@ -3170,115 +3170,115 @@ var x308: Genric = true ? undefined : { func: n => { return [d1, d2]; } }; var x309: () => Base[] = true ? () => [d1, d2] : undefined; >x309 : () => Base[] >Base : Base ->true ? () => [d1, d2] : undefined : () => (Derived1 | Derived2)[] +>true ? () => [d1, d2] : undefined : () => Base[] >true : boolean >() => [d1, d2] : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : () => Base[] var x310: () => Base[] = true ? function() { return [d1, d2] } : undefined; >x310 : () => Base[] >Base : Base ->true ? function() { return [d1, d2] } : undefined : () => (Derived1 | Derived2)[] +>true ? function() { return [d1, d2] } : undefined : () => Base[] >true : boolean >function() { return [d1, d2] } : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : () => Base[] var x311: () => Base[] = true ? function named() { return [d1, d2] } : undefined; >x311 : () => Base[] >Base : Base ->true ? function named() { return [d1, d2] } : undefined : () => (Derived1 | Derived2)[] +>true ? function named() { return [d1, d2] } : undefined : () => Base[] >true : boolean >function named() { return [d1, d2] } : () => (Derived1 | Derived2)[] >named : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : () => Base[] var x312: { (): Base[]; } = true ? () => [d1, d2] : undefined; >x312 : () => Base[] >Base : Base ->true ? () => [d1, d2] : undefined : () => (Derived1 | Derived2)[] +>true ? () => [d1, d2] : undefined : () => Base[] >true : boolean >() => [d1, d2] : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : () => Base[] var x313: { (): Base[]; } = true ? function() { return [d1, d2] } : undefined; >x313 : () => Base[] >Base : Base ->true ? function() { return [d1, d2] } : undefined : () => (Derived1 | Derived2)[] +>true ? function() { return [d1, d2] } : undefined : () => Base[] >true : boolean >function() { return [d1, d2] } : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : () => Base[] var x314: { (): Base[]; } = true ? function named() { return [d1, d2] } : undefined; >x314 : () => Base[] >Base : Base ->true ? function named() { return [d1, d2] } : undefined : () => (Derived1 | Derived2)[] +>true ? function named() { return [d1, d2] } : undefined : () => Base[] >true : boolean >function named() { return [d1, d2] } : () => (Derived1 | Derived2)[] >named : () => (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : () => Base[] var x315: Base[] = true ? [d1, d2] : undefined; >x315 : Base[] >Base : Base ->true ? [d1, d2] : undefined : (Derived1 | Derived2)[] +>true ? [d1, d2] : undefined : Base[] >true : boolean >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : Base[] var x316: Array = true ? [d1, d2] : undefined; >x316 : Base[] >Array : T[] >Base : Base ->true ? [d1, d2] : undefined : (Derived1 | Derived2)[] +>true ? [d1, d2] : undefined : Base[] >true : boolean >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : Base[] var x317: { [n: number]: Base; } = true ? [d1, d2] : undefined; >x317 : { [n: number]: Base; } >n : number >Base : Base ->true ? [d1, d2] : undefined : (Derived1 | Derived2)[] +>true ? [d1, d2] : undefined : { [n: number]: Base; } >true : boolean >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : { [n: number]: Base; } var x318: {n: Base[]; } = true ? { n: [d1, d2] } : undefined; >x318 : { n: Base[]; } >n : Base[] >Base : Base ->true ? { n: [d1, d2] } : undefined : { n: (Derived1 | Derived2)[]; } +>true ? { n: [d1, d2] } : undefined : { n: Base[]; } >true : boolean >{ n: [d1, d2] } : { n: (Derived1 | Derived2)[]; } >n : (Derived1 | Derived2)[] >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : { n: Base[]; } var x319: (s: Base[]) => any = true ? n => { var n: Base[]; return null; } : undefined; >x319 : (s: Base[]) => any @@ -3290,14 +3290,14 @@ var x319: (s: Base[]) => any = true ? n => { var n: Base[]; return null; } : und >n : Base[] >n : Base[] >Base : Base ->null : null ->undefined : undefined +>null : any +>undefined : (s: Base[]) => any var x320: Genric = true ? { func: n => { return [d1, d2]; } } : undefined; >x320 : Genric >Genric : Genric >Base : Base ->true ? { func: n => { return [d1, d2]; } } : undefined : { func: (n: Base[]) => (Derived1 | Derived2)[]; } +>true ? { func: n => { return [d1, d2]; } } : undefined : Genric >true : boolean >{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => (Derived1 | Derived2)[]; } >func : (n: Base[]) => (Derived1 | Derived2)[] @@ -3306,7 +3306,7 @@ var x320: Genric = true ? { func: n => { return [d1, d2]; } } : undefined; >[d1, d2] : (Derived1 | Derived2)[] >d1 : Derived1 >d2 : Derived2 ->undefined : undefined +>undefined : Genric function x321(n: () => Base[]) { }; x321(() => [d1, d2]); >x321 : (n: () => Base[]) => void @@ -3432,7 +3432,7 @@ function x331(n: (s: Base[]) => any) { }; x331(n => { var n: Base[]; return null >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any function x332(n: Genric) { }; x332({ func: n => { return [d1, d2]; } }); >x332 : (n: Genric) => void @@ -3595,7 +3595,7 @@ var x343 = (n: (s: Base[]) => any) => n; x343(n => { var n: Base[]; return null; >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any var x344 = (n: Genric) => n; x344({ func: n => { return [d1, d2]; } }); >x344 : (n: Genric) => Genric @@ -3749,7 +3749,7 @@ var x355 = function(n: (s: Base[]) => any) { }; x355(n => { var n: Base[]; retur >n : Base[] >n : Base[] >Base : Base ->null : null +>null : any var x356 = function(n: Genric) { }; x356({ func: n => { return [d1, d2]; } }); >x356 : (n: Genric) => void diff --git a/tests/baselines/reference/generatorTypeCheck45.types b/tests/baselines/reference/generatorTypeCheck45.types index 7ea442420d697..761e617a88790 100644 --- a/tests/baselines/reference/generatorTypeCheck45.types +++ b/tests/baselines/reference/generatorTypeCheck45.types @@ -29,5 +29,5 @@ foo("", function* () { yield x => x.length }, p => undefined); // T is fixed, sh >length : number >p => undefined : (p: number) => any >p : number ->undefined : undefined +>undefined : string diff --git a/tests/baselines/reference/generatorTypeCheck46.types b/tests/baselines/reference/generatorTypeCheck46.types index daf0d67b6ecb6..30583e94d7b7e 100644 --- a/tests/baselines/reference/generatorTypeCheck46.types +++ b/tests/baselines/reference/generatorTypeCheck46.types @@ -43,5 +43,5 @@ foo("", function* () { }, p => undefined); // T is fixed, should be string >p => undefined : (p: number) => any >p : number ->undefined : undefined +>undefined : string diff --git a/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types b/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types index 5c7500fb5ed94..e65485c61f765 100644 --- a/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types +++ b/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types @@ -52,7 +52,7 @@ _.all([true, 1, null, 'yes'], _.identity); >[true, 1, null, 'yes'] : (boolean | number | string)[] >true : boolean >1 : number ->null : null +>null : boolean | number | string >'yes' : string >_.identity : (value: T) => T >_ : Underscore.Static diff --git a/tests/baselines/reference/genericArray0.types b/tests/baselines/reference/genericArray0.types index bf0155bb9ba66..80a9d5199bde3 100644 --- a/tests/baselines/reference/genericArray0.types +++ b/tests/baselines/reference/genericArray0.types @@ -16,6 +16,6 @@ function map() { var ys: U[] = []; >ys : U[] >U : U ->[] : undefined[] +>[] : U[] } diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty2.types b/tests/baselines/reference/genericBaseClassLiteralProperty2.types index 3e3208249256e..443d662bd2a56 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty2.types +++ b/tests/baselines/reference/genericBaseClassLiteralProperty2.types @@ -14,11 +14,11 @@ class BaseCollection2 { constructor() { this._itemsByKey = {}; ->this._itemsByKey = {} : {} +>this._itemsByKey = {} : { [key: string]: TItem; } >this._itemsByKey : { [key: string]: TItem; } >this : this >_itemsByKey : { [key: string]: TItem; } ->{} : {} +>{} : { [key: string]: TItem; } } } diff --git a/tests/baselines/reference/genericCallWithArrayLiteralArgs.types b/tests/baselines/reference/genericCallWithArrayLiteralArgs.types index c8e8b41b5fdda..6dc373f06c30b 100644 --- a/tests/baselines/reference/genericCallWithArrayLiteralArgs.types +++ b/tests/baselines/reference/genericCallWithArrayLiteralArgs.types @@ -37,13 +37,13 @@ var r2 = foo([]); // any[] >r2 : any[] >foo([]) : any[] >foo : (t: T) => T ->[] : undefined[] +>[] : any[] var r3 = foo([]); // number[] >r3 : number[] >foo([]) : number[] >foo : (t: T) => T ->[] : undefined[] +>[] : number[] var r4 = foo([1, '']); // {}[] >r4 : (number | string)[] diff --git a/tests/baselines/reference/genericCallWithNonGenericArgs1.types b/tests/baselines/reference/genericCallWithNonGenericArgs1.types index 75d867281325d..6f18299f93fc0 100644 --- a/tests/baselines/reference/genericCallWithNonGenericArgs1.types +++ b/tests/baselines/reference/genericCallWithNonGenericArgs1.types @@ -7,5 +7,5 @@ function f(x: any) { } f(null) >f(null) : void >f : (x: any) => void ->null : null +>null : any diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.types b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.types index 8ffa07252bc9c..d6d137d4ebfce 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.types +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.types @@ -107,7 +107,7 @@ function f3(x: T, y: (a: T) => T) { return y(null); >y(null) : T >y : (a: T) => T ->null : null +>null : T } var r4 = f3(new Base(), x => x); >r4 : Base @@ -133,14 +133,14 @@ var r6 = f3(null, null); // any >r6 : any >f3(null, null) : any >f3 : (x: T, y: (a: T) => T) => T ->null : null ->null : null +>null : any +>null : (a: any) => any var r7 = f3(null, x => x); // any >r7 : any >f3(null, x => x) : any >f3 : (x: T, y: (a: T) => T) => T ->null : null +>null : any >x => x : (x: any) => any >x : any >x : any diff --git a/tests/baselines/reference/genericClassWithStaticFactory.types b/tests/baselines/reference/genericClassWithStaticFactory.types index 2daad9003ebda..e840752df48c4 100644 --- a/tests/baselines/reference/genericClassWithStaticFactory.types +++ b/tests/baselines/reference/genericClassWithStaticFactory.types @@ -164,7 +164,7 @@ module Editor { } else { return null; ->null : null +>null : T } } @@ -292,7 +292,7 @@ module Editor { >isHead : boolean return null; ->null : null +>null : List } else { return this.listFactory.RemoveEntry(this.next); @@ -502,7 +502,7 @@ module Editor { >List : typeof List >T : T >true : boolean ->null : null +>null : T entry.prev = entry; >entry.prev = entry : List @@ -573,7 +573,7 @@ module Editor { >null : null return null; ->null : null +>null : List } else if (entry.isHead) { >entry.isHead : boolean @@ -582,7 +582,7 @@ module Editor { // Can't remove the head of a list! return null; ->null : null +>null : List } else { entry.next.prev = entry.prev; diff --git a/tests/baselines/reference/genericConstraintDeclaration.types b/tests/baselines/reference/genericConstraintDeclaration.types index aaa7d1de77a8b..cf58b373da969 100644 --- a/tests/baselines/reference/genericConstraintDeclaration.types +++ b/tests/baselines/reference/genericConstraintDeclaration.types @@ -8,7 +8,7 @@ class List{ >T : T >List : List >T : T ->null : null +>null : List } diff --git a/tests/baselines/reference/genericFunctions3.types b/tests/baselines/reference/genericFunctions3.types index 2215e30adcf4b..da145c1202602 100644 --- a/tests/baselines/reference/genericFunctions3.types +++ b/tests/baselines/reference/genericFunctions3.types @@ -25,6 +25,6 @@ function from(arg: any): Query { >T : T return undefined; ->undefined : undefined +>undefined : Query } diff --git a/tests/baselines/reference/genericFunctionsWithOptionalParameters1.types b/tests/baselines/reference/genericFunctionsWithOptionalParameters1.types index 3d5257812aeb7..af480da8fedab 100644 --- a/tests/baselines/reference/genericFunctionsWithOptionalParameters1.types +++ b/tests/baselines/reference/genericFunctionsWithOptionalParameters1.types @@ -35,22 +35,22 @@ utils.fold(null); // no error >utils.fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T >utils : Utils >fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T ->null : null +>null : {}[] utils.fold(null, null); // no error >utils.fold(null, null) : {} >utils.fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T >utils : Utils >fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T ->null : null ->null : null +>null : {}[] +>null : (s: {}, t: {}) => {} utils.fold(null, null, null); // no error >utils.fold(null, null, null) : {} >utils.fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T >utils : Utils >fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T ->null : null ->null : null ->null : null +>null : {}[] +>null : (s: any, t: {}) => {} +>null : any diff --git a/tests/baselines/reference/genericImplements.types b/tests/baselines/reference/genericImplements.types index e96e46c81cbbc..c0f49cc4c77a5 100644 --- a/tests/baselines/reference/genericImplements.types +++ b/tests/baselines/reference/genericImplements.types @@ -28,7 +28,7 @@ class X implements I { >T : T >B : B >T : T ->undefined : undefined +>undefined : T } // { f: () => { b; } } @@ -42,7 +42,7 @@ class Y implements I { >T : T >A : A >T : T ->undefined : undefined +>undefined : T } // { f: () => { a; } } @@ -55,6 +55,6 @@ class Z implements I { >f : () => T >T : T >T : T ->undefined : undefined +>undefined : T } // { f: () => T } diff --git a/tests/baselines/reference/genericOfACloduleType1.types b/tests/baselines/reference/genericOfACloduleType1.types index 5c19b5f956909..8bc062be4b53f 100644 --- a/tests/baselines/reference/genericOfACloduleType1.types +++ b/tests/baselines/reference/genericOfACloduleType1.types @@ -35,7 +35,7 @@ module M { >g1.bar : (x: C) => C >g1 : G >bar : (x: C) => C ->null : null +>null : C >foo : () => void } var g2 = new G() // was: error Type reference cannot refer to container 'M.C'. diff --git a/tests/baselines/reference/genericOfACloduleType2.types b/tests/baselines/reference/genericOfACloduleType2.types index 2e857b26edadf..601fe46891a91 100644 --- a/tests/baselines/reference/genericOfACloduleType2.types +++ b/tests/baselines/reference/genericOfACloduleType2.types @@ -35,7 +35,7 @@ module M { >g1.bar : (x: C) => C >g1 : G >bar : (x: C) => C ->null : null +>null : C >foo : () => void } diff --git a/tests/baselines/reference/genericParameterAssignability1.types b/tests/baselines/reference/genericParameterAssignability1.types index 50917e5db45cf..a7e294163099c 100644 --- a/tests/baselines/reference/genericParameterAssignability1.types +++ b/tests/baselines/reference/genericParameterAssignability1.types @@ -5,7 +5,7 @@ function f(x: T): T { return null; } >x : T >T : T >T : T ->null : null +>null : T var r = (x: T) => x; >r : (x: T) => T diff --git a/tests/baselines/reference/genericPrototypeProperty.types b/tests/baselines/reference/genericPrototypeProperty.types index 447f5e748906f..f3e3a750a94e2 100644 --- a/tests/baselines/reference/genericPrototypeProperty.types +++ b/tests/baselines/reference/genericPrototypeProperty.types @@ -12,7 +12,7 @@ class C { >x : T >T : T >T : T ->null : null +>null : T } var r = C.prototype; @@ -34,5 +34,5 @@ var r3 = r.foo(null); >r.foo : (x: any) => any >r : C >foo : (x: any) => any ->null : null +>null : any diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.types b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.types index 2f62a20c41521..7ed204dcdb1db 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.types +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.types @@ -54,7 +54,7 @@ module TypeScript2 { >C : C return undefined; ->undefined : undefined +>undefined : PullTypeSymbol } } export class PullTypeSymbol extends PullSymbol { diff --git a/tests/baselines/reference/genericReversingTypeParameters.types b/tests/baselines/reference/genericReversingTypeParameters.types index 524a2ebba0350..0262d3f3de448 100644 --- a/tests/baselines/reference/genericReversingTypeParameters.types +++ b/tests/baselines/reference/genericReversingTypeParameters.types @@ -15,14 +15,14 @@ class BiMap { >key : K >K : K >V : V ->null : null +>null : V public inverse(): BiMap { return null; } >inverse : () => BiMap >BiMap : BiMap >V : V >K : K ->null : null +>null : BiMap } var b = new BiMap(); diff --git a/tests/baselines/reference/genericReversingTypeParameters2.types b/tests/baselines/reference/genericReversingTypeParameters2.types index 28c1f40ce9f12..0a396f21fcfe3 100644 --- a/tests/baselines/reference/genericReversingTypeParameters2.types +++ b/tests/baselines/reference/genericReversingTypeParameters2.types @@ -15,14 +15,14 @@ class BiMap { >key : K >K : K >V : V ->null : null +>null : V public inverse(): BiMap { return null; } >inverse : () => BiMap >BiMap : BiMap >V : V >K : K ->null : null +>null : BiMap } var b = new BiMap(); diff --git a/tests/baselines/reference/genericSpecializations1.types b/tests/baselines/reference/genericSpecializations1.types index 87f32d86d52f4..b9768bde09522 100644 --- a/tests/baselines/reference/genericSpecializations1.types +++ b/tests/baselines/reference/genericSpecializations1.types @@ -18,7 +18,7 @@ class IntFooBad implements IFoo { foo(x: string): string { return null; } >foo : (x: string) => string >x : string ->null : null +>null : string } class StringFoo2 implements IFoo { @@ -28,7 +28,7 @@ class StringFoo2 implements IFoo { foo(x: string): string { return null; } >foo : (x: string) => string >x : string ->null : null +>null : string } class StringFoo3 implements IFoo { @@ -41,5 +41,5 @@ class StringFoo3 implements IFoo { >x : T >T : T >T : T ->null : null +>null : T } diff --git a/tests/baselines/reference/genericTypeArgumentInference1.types b/tests/baselines/reference/genericTypeArgumentInference1.types index 405c328bc4573..0965c38dda5c1 100644 --- a/tests/baselines/reference/genericTypeArgumentInference1.types +++ b/tests/baselines/reference/genericTypeArgumentInference1.types @@ -50,7 +50,7 @@ var r = _.all([true, 1, null, 'yes'], _.identity); >[true, 1, null, 'yes'] : (boolean | number | string)[] >true : boolean >1 : number ->null : null +>null : boolean | number | string >'yes' : string >_.identity : (value: T) => T >_ : Underscore.Static @@ -74,7 +74,7 @@ var r3 = _.all([], _.identity); >_.all : (list: T[], iterator?: Underscore.Iterator, context?: any) => T >_ : Underscore.Static >all : (list: T[], iterator?: Underscore.Iterator, context?: any) => T ->[] : undefined[] +>[] : any[] >_.identity : (value: T) => T >_ : Underscore.Static >identity : (value: T) => T diff --git a/tests/baselines/reference/genericTypeAssertions2.errors.txt b/tests/baselines/reference/genericTypeAssertions2.errors.txt index 756690f178378..c5f750b6fb0b4 100644 --- a/tests/baselines/reference/genericTypeAssertions2.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions2.errors.txt @@ -5,8 +5,8 @@ tests/cases/compiler/genericTypeAssertions2.ts(10,5): error TS2322: Type 'B' is not assignable to type 'B'. Property 'bar' is missing in type 'A'. -tests/cases/compiler/genericTypeAssertions2.ts(13,21): error TS2352: Type 'undefined[]' cannot be converted to type 'A'. - Property 'foo' is missing in type 'undefined[]'. +tests/cases/compiler/genericTypeAssertions2.ts(13,21): error TS2352: Type 'number[]' cannot be converted to type 'A'. + Property 'foo' is missing in type 'number[]'. ==== tests/cases/compiler/genericTypeAssertions2.ts (3 errors) ==== @@ -33,5 +33,5 @@ tests/cases/compiler/genericTypeAssertions2.ts(13,21): error TS2352: Type 'undef var r4: A = >new A(); var r5: A = >[]; // error ~~~~~~~~~~~~~ -!!! error TS2352: Type 'undefined[]' cannot be converted to type 'A'. -!!! error TS2352: Property 'foo' is missing in type 'undefined[]'. \ No newline at end of file +!!! error TS2352: Type 'number[]' cannot be converted to type 'A'. +!!! error TS2352: Property 'foo' is missing in type 'number[]'. \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeParameterEquivalence2.types b/tests/baselines/reference/genericTypeParameterEquivalence2.types index 9fdb03b0fbe49..9f8160084d56b 100644 --- a/tests/baselines/reference/genericTypeParameterEquivalence2.types +++ b/tests/baselines/reference/genericTypeParameterEquivalence2.types @@ -30,7 +30,7 @@ function compose(f: (b: B) => C, g: (a:A) => B): (a:A) => C { >g.apply : { (this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; } >g : (a: A) => B >apply : { (this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; } ->null : null +>null : any >a : A }; diff --git a/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types b/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types index a316773e5c87f..7fb8520c4b245 100644 --- a/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types +++ b/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types @@ -8,7 +8,7 @@ class LazyArray { ><{ [objectId: string]: T; }>{} : { [objectId: string]: T; } >objectId : string >T : T ->{} : {} +>{} : { [objectId: string]: T; } array() { >array : () => { [objectId: string]: T; } diff --git a/tests/baselines/reference/getterSetterNonAccessor.types b/tests/baselines/reference/getterSetterNonAccessor.types index 48d9f9c85e0cb..8cdc8a985f283 100644 --- a/tests/baselines/reference/getterSetterNonAccessor.types +++ b/tests/baselines/reference/getterSetterNonAccessor.types @@ -12,7 +12,7 @@ Object.defineProperty({}, "0", ({ >Object.defineProperty : (o: any, p: string, attributes: PropertyDescriptor) => any >Object : ObjectConstructor >defineProperty : (o: any, p: string, attributes: PropertyDescriptor) => any ->{} : {} +>{} : any >"0" : string >({ get: getFunc, set: setFunc, configurable: true }) : PropertyDescriptor >PropertyDescriptor : PropertyDescriptor diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.types b/tests/baselines/reference/heterogeneousArrayLiterals.types index c760e5a566f3e..902f5328b787d 100644 --- a/tests/baselines/reference/heterogeneousArrayLiterals.types +++ b/tests/baselines/reference/heterogeneousArrayLiterals.types @@ -250,13 +250,13 @@ module WithContextualType { var b: Derived[] = [null]; >b : Derived[] >Derived : Derived ->[null] : null[] ->null : null +>[null] : Derived[] +>null : Derived var c: Derived[] = []; >c : Derived[] >Derived : Derived ->[] : undefined[] +>[] : Derived[] var d: { (): Base }[] = [() => derived, () => derived2]; >d : (() => Base)[] diff --git a/tests/baselines/reference/ifDoWhileStatements.types b/tests/baselines/reference/ifDoWhileStatements.types index 660eaa4fb634b..ad57284004458 100644 --- a/tests/baselines/reference/ifDoWhileStatements.types +++ b/tests/baselines/reference/ifDoWhileStatements.types @@ -407,7 +407,7 @@ function fn(x?: string): I { return null; } >fn : (x?: string) => I >x : string >I : I ->null : null +>null : I if (fn()) { } >fn() : I diff --git a/tests/baselines/reference/implementedPresentPropertyContextualTyping.errors.txt b/tests/baselines/reference/implementedPresentPropertyContextualTyping.errors.txt new file mode 100644 index 0000000000000..9426d0549b89e --- /dev/null +++ b/tests/baselines/reference/implementedPresentPropertyContextualTyping.errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/expressions/contextualTyping/implementedPresentPropertyContextualTyping.ts(4,7): error TS2420: Class 'C' incorrectly implements interface 'X'. + Types of property 'n' are incompatible. + Type 'undefined' is not assignable to type 'number'. +tests/cases/conformance/expressions/contextualTyping/implementedPresentPropertyContextualTyping.ts(7,7): error TS2420: Class 'C2' incorrectly implements interface 'X'. + Types of property 'n' are incompatible. + Type 'null' is not assignable to type 'number'. + + +==== tests/cases/conformance/expressions/contextualTyping/implementedPresentPropertyContextualTyping.ts (2 errors) ==== + interface X { + n: number + } + class C implements X { // error, n: undefined isn't assignable to n: number + ~ +!!! error TS2420: Class 'C' incorrectly implements interface 'X'. +!!! error TS2420: Types of property 'n' are incompatible. +!!! error TS2420: Type 'undefined' is not assignable to type 'number'. + n = undefined; + } + class C2 implements X { + ~~ +!!! error TS2420: Class 'C2' incorrectly implements interface 'X'. +!!! error TS2420: Types of property 'n' are incompatible. +!!! error TS2420: Type 'null' is not assignable to type 'number'. + n = null; + } + \ No newline at end of file diff --git a/tests/baselines/reference/implementedPresentPropertyContextualTyping.js b/tests/baselines/reference/implementedPresentPropertyContextualTyping.js new file mode 100644 index 0000000000000..2ae2867397b4e --- /dev/null +++ b/tests/baselines/reference/implementedPresentPropertyContextualTyping.js @@ -0,0 +1,25 @@ +//// [implementedPresentPropertyContextualTyping.ts] +interface X { + n: number +} +class C implements X { // error, n: undefined isn't assignable to n: number + n = undefined; +} +class C2 implements X { + n = null; +} + + +//// [implementedPresentPropertyContextualTyping.js] +var C = (function () { + function C() { + this.n = undefined; + } + return C; +}()); +var C2 = (function () { + function C2() { + this.n = null; + } + return C2; +}()); diff --git a/tests/baselines/reference/implementedPropertyContextualTyping1.errors.txt b/tests/baselines/reference/implementedPropertyContextualTyping1.errors.txt new file mode 100644 index 0000000000000..e0ef746c6f299 --- /dev/null +++ b/tests/baselines/reference/implementedPropertyContextualTyping1.errors.txt @@ -0,0 +1,110 @@ +tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(25,9): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(28,9): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(32,9): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(35,9): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(59,7): error TS2420: Class 'Multiple' incorrectly implements interface 'A'. + Types of property 'r' are incompatible. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(59,7): error TS2420: Class 'Multiple' incorrectly implements interface 'B'. + Types of property 'r' are incompatible. + Type 'number' is not assignable to type 'boolean'. +tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(60,5): error TS7008: Member 'p' implicitly has an 'any' type. +tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(61,7): error TS7006: Parameter 'n' implicitly has an 'any' type. +tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts(70,12): error TS2339: Property 'length' does not exist on type 'number'. + + +==== tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts (9 errors) ==== + interface Event { + time: number; + } + interface Base { + superHandle: (e: Event) => number; + } + interface Listener extends Base { + handle: (e: Event) => void; + } + interface Ringer { + ring: (times: number) => void; + } + interface StringLiteral { + literal(): "A"; + literals: "A" | "B"; + } + + abstract class Watcher { + abstract watch(e: Event): number; + } + + class Alarm extends Watcher implements Listener, Ringer, StringLiteral { + str: string; + handle = e => { + this.str = e.time; // error + ~~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + } + superHandle = e => { + this.str = e.time; // error + ~~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + return e.time; + } + ring(times) { + this.str = times; // error + ~~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + } + watch(e) { + this.str = e.time; // error + ~~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + return e.time; + } + literal() { + return "A"; // ok: "A" is assignable to "A" + } + literals = "A"; // ok: "A" is assignable to "A" | "B" + } + + interface A { + p: string; + q(n: string): void; + r: string; + s: string; + } + interface B { + p: number; + q(n: number): void; + r: boolean; + s: string; + } + class C { + r: number; + } + class Multiple extends C implements A, B { + ~~~~~~~~ +!!! error TS2420: Class 'Multiple' incorrectly implements interface 'A'. +!!! error TS2420: Types of property 'r' are incompatible. +!!! error TS2420: Type 'number' is not assignable to type 'string'. + ~~~~~~~~ +!!! error TS2420: Class 'Multiple' incorrectly implements interface 'B'. +!!! error TS2420: Types of property 'r' are incompatible. +!!! error TS2420: Type 'number' is not assignable to type 'boolean'. + p = undefined; // error, Multiple.p is implicitly any because A.p and B.p exist + ~~~~~~~~~~~~~~ +!!! error TS7008: Member 'p' implicitly has an 'any' type. + q(n) { // error, n is implicitly any because A.q and B.q exist + ~ +!!! error TS7006: Parameter 'n' implicitly has an 'any' type. + n.length; + n.toFixed; + } + r = null; // OK, C.r wins over A.r and B.r + s = null; // OK, A.s and B.s match + } + let multiple = new Multiple(); + multiple.r.toFixed; // OK, C.r wins so Multiple.r: number + multiple.r.length; // error, Multiple.r: number + ~~~~~~ +!!! error TS2339: Property 'length' does not exist on type 'number'. + multiple.s.length; // OK, A.s and B.s match. + \ No newline at end of file diff --git a/tests/baselines/reference/implementedPropertyContextualTyping1.js b/tests/baselines/reference/implementedPropertyContextualTyping1.js new file mode 100644 index 0000000000000..41d6c7f106804 --- /dev/null +++ b/tests/baselines/reference/implementedPropertyContextualTyping1.js @@ -0,0 +1,134 @@ +//// [implementedPropertyContextualTyping1.ts] +interface Event { + time: number; +} +interface Base { + superHandle: (e: Event) => number; +} +interface Listener extends Base { + handle: (e: Event) => void; +} +interface Ringer { + ring: (times: number) => void; +} +interface StringLiteral { + literal(): "A"; + literals: "A" | "B"; +} + +abstract class Watcher { + abstract watch(e: Event): number; +} + +class Alarm extends Watcher implements Listener, Ringer, StringLiteral { + str: string; + handle = e => { + this.str = e.time; // error + } + superHandle = e => { + this.str = e.time; // error + return e.time; + } + ring(times) { + this.str = times; // error + } + watch(e) { + this.str = e.time; // error + return e.time; + } + literal() { + return "A"; // ok: "A" is assignable to "A" + } + literals = "A"; // ok: "A" is assignable to "A" | "B" +} + +interface A { + p: string; + q(n: string): void; + r: string; + s: string; +} +interface B { + p: number; + q(n: number): void; + r: boolean; + s: string; +} +class C { + r: number; +} +class Multiple extends C implements A, B { + p = undefined; // error, Multiple.p is implicitly any because A.p and B.p exist + q(n) { // error, n is implicitly any because A.q and B.q exist + n.length; + n.toFixed; + } + r = null; // OK, C.r wins over A.r and B.r + s = null; // OK, A.s and B.s match +} +let multiple = new Multiple(); +multiple.r.toFixed; // OK, C.r wins so Multiple.r: number +multiple.r.length; // error, Multiple.r: number +multiple.s.length; // OK, A.s and B.s match. + + +//// [implementedPropertyContextualTyping1.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Watcher = (function () { + function Watcher() { + } + return Watcher; +}()); +var Alarm = (function (_super) { + __extends(Alarm, _super); + function Alarm() { + var _this = this; + _super.apply(this, arguments); + this.handle = function (e) { + _this.str = e.time; // error + }; + this.superHandle = function (e) { + _this.str = e.time; // error + return e.time; + }; + this.literals = "A"; // ok: "A" is assignable to "A" | "B" + } + Alarm.prototype.ring = function (times) { + this.str = times; // error + }; + Alarm.prototype.watch = function (e) { + this.str = e.time; // error + return e.time; + }; + Alarm.prototype.literal = function () { + return "A"; // ok: "A" is assignable to "A" + }; + return Alarm; +}(Watcher)); +var C = (function () { + function C() { + } + return C; +}()); +var Multiple = (function (_super) { + __extends(Multiple, _super); + function Multiple() { + _super.apply(this, arguments); + this.p = undefined; // error, Multiple.p is implicitly any because A.p and B.p exist + this.r = null; // OK, C.r wins over A.r and B.r + this.s = null; // OK, A.s and B.s match + } + Multiple.prototype.q = function (n) { + n.length; + n.toFixed; + }; + return Multiple; +}(C)); +var multiple = new Multiple(); +multiple.r.toFixed; // OK, C.r wins so Multiple.r: number +multiple.r.length; // error, Multiple.r: number +multiple.s.length; // OK, A.s and B.s match. diff --git a/tests/baselines/reference/implementedPropertyContextualTyping2.errors.txt b/tests/baselines/reference/implementedPropertyContextualTyping2.errors.txt new file mode 100644 index 0000000000000..c2fc0d35bef75 --- /dev/null +++ b/tests/baselines/reference/implementedPropertyContextualTyping2.errors.txt @@ -0,0 +1,39 @@ +tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping2.ts(20,1): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping2.ts(21,1): error TS2322: Type 'boolean' is not assignable to type 'string'. +tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping2.ts(22,1): error TS2322: Type 'number' is not assignable to type '[number, number]'. +tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping2.ts(23,24): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + + +==== tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping2.ts (4 errors) ==== + interface Long { + length: number; + } + interface Lol { + canhaz: string; + } + interface Ceiling { + location: { [coordinates: string]: [number, number] }; + } + interface Invisible { + invisibles: string[]; + } + class Cat implements Long, Lol, Ceiling, Invisible { + length = undefined; + canhaz = null; + location = {}; + invisibles = []; + } + const lolCat = new Cat(); + lolCat.length = "wat"; + ~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + lolCat.canhaz = false; + ~~~~~~~~~~~~~ +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. + lolCat.location['ceiling'] = -1; + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type '[number, number]'. + lolCat.invisibles.push(0); + ~ +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + \ No newline at end of file diff --git a/tests/baselines/reference/implementedPropertyContextualTyping2.js b/tests/baselines/reference/implementedPropertyContextualTyping2.js new file mode 100644 index 0000000000000..a78f081b83d56 --- /dev/null +++ b/tests/baselines/reference/implementedPropertyContextualTyping2.js @@ -0,0 +1,41 @@ +//// [implementedPropertyContextualTyping2.ts] +interface Long { + length: number; +} +interface Lol { + canhaz: string; +} +interface Ceiling { + location: { [coordinates: string]: [number, number] }; +} +interface Invisible { + invisibles: string[]; +} +class Cat implements Long, Lol, Ceiling, Invisible { + length = undefined; + canhaz = null; + location = {}; + invisibles = []; +} +const lolCat = new Cat(); +lolCat.length = "wat"; +lolCat.canhaz = false; +lolCat.location['ceiling'] = -1; +lolCat.invisibles.push(0); + + +//// [implementedPropertyContextualTyping2.js] +var Cat = (function () { + function Cat() { + this.length = undefined; + this.canhaz = null; + this.location = {}; + this.invisibles = []; + } + return Cat; +}()); +var lolCat = new Cat(); +lolCat.length = "wat"; +lolCat.canhaz = false; +lolCat.location['ceiling'] = -1; +lolCat.invisibles.push(0); diff --git a/tests/baselines/reference/implicitAnyAnyReturningFunction.types b/tests/baselines/reference/implicitAnyAnyReturningFunction.types index 66f9cf49cb03e..df3f098477c90 100644 --- a/tests/baselines/reference/implicitAnyAnyReturningFunction.types +++ b/tests/baselines/reference/implicitAnyAnyReturningFunction.types @@ -12,7 +12,7 @@ function B() { var someLocal: any = {}; >someLocal : any ->{} : {} +>{} : any return someLocal; >someLocal : any @@ -34,7 +34,7 @@ class C { var someLocal: any = {}; >someLocal : any ->{} : {} +>{} : any return someLocal; >someLocal : any diff --git a/tests/baselines/reference/implicitAnyGenerics.types b/tests/baselines/reference/implicitAnyGenerics.types index e335c958fe984..e4ce81ff7e336 100644 --- a/tests/baselines/reference/implicitAnyGenerics.types +++ b/tests/baselines/reference/implicitAnyGenerics.types @@ -43,7 +43,7 @@ var d = new D(null); >d : D >new D(null) : D >D : typeof D ->null : null +>null : any var d2 = new D(1); >d2 : D @@ -69,13 +69,13 @@ var d5: D = new D(null); >D : D >new D(null) : D >D : typeof D ->null : null +>null : any function foo(): T { return null; }; >foo : () => T >T : T >T : T ->null : null +>null : T foo() >foo() : {} diff --git a/tests/baselines/reference/importDecl.types b/tests/baselines/reference/importDecl.types index 7bf4da781219a..1f34967c676e8 100644 --- a/tests/baselines/reference/importDecl.types +++ b/tests/baselines/reference/importDecl.types @@ -171,7 +171,7 @@ export var x: d; export function foo(): d { return null; } >foo : () => d >d : d ->null : null +>null : d === tests/cases/compiler/importDecl_require1.ts === export class d { @@ -187,7 +187,7 @@ var x: d; export function foo(): d { return null; } >foo : () => d >d : d ->null : null +>null : d === tests/cases/compiler/importDecl_require2.ts === export class d { @@ -203,7 +203,7 @@ export var x: d; export function foo(): d { return null; } >foo : () => d >d : d ->null : null +>null : d === tests/cases/compiler/importDecl_require3.ts === export class d { @@ -219,7 +219,7 @@ export var x: d; export function foo(): d { return null; } >foo : () => d >d : d ->null : null +>null : d === tests/cases/compiler/importDecl_require4.ts === import m4 = require("./importDecl_require"); @@ -229,5 +229,5 @@ export function foo2(): m4.d { return null; } >foo2 : () => m4.d >m4 : any >d : m4.d ->null : null +>null : m4.d diff --git a/tests/baselines/reference/indexSignaturesInferentialTyping.types b/tests/baselines/reference/indexSignaturesInferentialTyping.types index 8545a7d4ca967..db12bb7c8edd0 100644 --- a/tests/baselines/reference/indexSignaturesInferentialTyping.types +++ b/tests/baselines/reference/indexSignaturesInferentialTyping.types @@ -6,7 +6,7 @@ function foo(items: { [index: number]: T }): T { return undefined; } >index : number >T : T >T : T ->undefined : undefined +>undefined : T function bar(items: { [index: string]: T }): T { return undefined; } >bar : (items: { [index: string]: T; }) => T @@ -15,7 +15,7 @@ function bar(items: { [index: string]: T }): T { return undefined; } >index : string >T : T >T : T ->undefined : undefined +>undefined : T var x1 = foo({ 0: 0, 1: 1 }); // type should be number >x1 : number diff --git a/tests/baselines/reference/indexer3.types b/tests/baselines/reference/indexer3.types index 28bcd9cab0c93..325441826e0ab 100644 --- a/tests/baselines/reference/indexer3.types +++ b/tests/baselines/reference/indexer3.types @@ -3,7 +3,7 @@ var dateMap: { [x: string]: Date; } = {} >dateMap : { [x: string]: Date; } >x : string >Date : Date ->{} : {} +>{} : { [x: string]: Date; } var r: Date = dateMap["hello"] // result type includes indexer using BCT >r : Date diff --git a/tests/baselines/reference/indexerReturningTypeParameter1.types b/tests/baselines/reference/indexerReturningTypeParameter1.types index 83028bef93f6c..a7e1837ed514b 100644 --- a/tests/baselines/reference/indexerReturningTypeParameter1.types +++ b/tests/baselines/reference/indexerReturningTypeParameter1.types @@ -29,7 +29,7 @@ class c { >T : T return null; ->null : null +>null : { [key: string]: T[]; } } } var a2: c; diff --git a/tests/baselines/reference/inferenceLimit.types b/tests/baselines/reference/inferenceLimit.types index 58f9b1e4ae08c..20dbcd7d597d1 100644 --- a/tests/baselines/reference/inferenceLimit.types +++ b/tests/baselines/reference/inferenceLimit.types @@ -30,7 +30,7 @@ export class BrokenClass { >Array : T[] >MyModule : any >MyModel : MyModule.MyModel ->[] : undefined[] +>[] : MyModule.MyModel[] let populateItems = (order) => { >populateItems : (order: any) => Promise<{}> diff --git a/tests/baselines/reference/inferentialTypingObjectLiteralMethod1.types b/tests/baselines/reference/inferentialTypingObjectLiteralMethod1.types index da2fa24060f7f..2dc991ee29603 100644 --- a/tests/baselines/reference/inferentialTypingObjectLiteralMethod1.types +++ b/tests/baselines/reference/inferentialTypingObjectLiteralMethod1.types @@ -39,5 +39,5 @@ foo("", { method(p1) { return p1.length } }, { method(p2) { return undefined } } >{ method(p2) { return undefined } } : { method(p2: number): any; } >method : (p2: number) => any >p2 : number ->undefined : undefined +>undefined : string diff --git a/tests/baselines/reference/inferentialTypingObjectLiteralMethod2.types b/tests/baselines/reference/inferentialTypingObjectLiteralMethod2.types index f70305739b896..b6de11a06d3c8 100644 --- a/tests/baselines/reference/inferentialTypingObjectLiteralMethod2.types +++ b/tests/baselines/reference/inferentialTypingObjectLiteralMethod2.types @@ -39,5 +39,5 @@ foo("", { method(p1) { return p1.length } }, { method(p2) { return undefined } } >{ method(p2) { return undefined } } : { method(p2: number): any; } >method : (p2: number) => any >p2 : number ->undefined : undefined +>undefined : string diff --git a/tests/baselines/reference/inferentialTypingUsingApparentType1.types b/tests/baselines/reference/inferentialTypingUsingApparentType1.types index b56f3670ddcc9..548967966a5fe 100644 --- a/tests/baselines/reference/inferentialTypingUsingApparentType1.types +++ b/tests/baselines/reference/inferentialTypingUsingApparentType1.types @@ -8,7 +8,7 @@ function foo number>(x: T): T { >T : T return undefined; ->undefined : undefined +>undefined : T } foo(x => x.length); diff --git a/tests/baselines/reference/inferentialTypingUsingApparentType2.types b/tests/baselines/reference/inferentialTypingUsingApparentType2.types index 5841e021c3ac5..f5345294c2216 100644 --- a/tests/baselines/reference/inferentialTypingUsingApparentType2.types +++ b/tests/baselines/reference/inferentialTypingUsingApparentType2.types @@ -9,7 +9,7 @@ function foo(x: T): T { >T : T return undefined; ->undefined : undefined +>undefined : T } foo({ m(x) { return x.length } }); diff --git a/tests/baselines/reference/inferentiallyTypingAnEmptyArray.types b/tests/baselines/reference/inferentiallyTypingAnEmptyArray.types index 451280ee16f41..c8f51c985e6e4 100644 --- a/tests/baselines/reference/inferentiallyTypingAnEmptyArray.types +++ b/tests/baselines/reference/inferentiallyTypingAnEmptyArray.types @@ -25,6 +25,6 @@ foo([]).bar; >foo([]).bar : any >foo([]) : any >foo : (arr: T[]) => T ->[] : undefined[] +>[] : any[] >bar : any diff --git a/tests/baselines/reference/infinitelyExpandingTypes5.types b/tests/baselines/reference/infinitelyExpandingTypes5.types index f145ff9539f3b..23b8beded906e 100644 --- a/tests/baselines/reference/infinitelyExpandingTypes5.types +++ b/tests/baselines/reference/infinitelyExpandingTypes5.types @@ -44,6 +44,6 @@ function from(arg: any): any { >arg : any return undefined; ->undefined : undefined +>undefined : any } diff --git a/tests/baselines/reference/inheritedGenericCallSignature.types b/tests/baselines/reference/inheritedGenericCallSignature.types index 4382320862b12..03d8d4787e600 100644 --- a/tests/baselines/reference/inheritedGenericCallSignature.types +++ b/tests/baselines/reference/inheritedGenericCallSignature.types @@ -42,7 +42,7 @@ var y = x(undefined); >y : Date[] >x(undefined) : Date[] >x : I2 ->undefined : undefined +>undefined : Date[] y.length; // should not error >y.length : number diff --git a/tests/baselines/reference/innerAliases2.types b/tests/baselines/reference/innerAliases2.types index 127497e38693c..a4addd2409f2c 100644 --- a/tests/baselines/reference/innerAliases2.types +++ b/tests/baselines/reference/innerAliases2.types @@ -22,7 +22,7 @@ module consumer { >g : provider.UsefulClass >provider : any >UsefulClass : provider.UsefulClass ->null : null +>null : provider.UsefulClass function use():provider.UsefulClass { >use : () => provider.UsefulClass diff --git a/tests/baselines/reference/instantiatedReturnTypeContravariance.types b/tests/baselines/reference/instantiatedReturnTypeContravariance.types index 1de1b8b7151e7..417872d48a4ec 100644 --- a/tests/baselines/reference/instantiatedReturnTypeContravariance.types +++ b/tests/baselines/reference/instantiatedReturnTypeContravariance.types @@ -20,7 +20,7 @@ foo(): B { >B : B return null; ->null : null +>null : B } @@ -35,7 +35,7 @@ foo(): B { >B : B return null; ->null : null +>null : B } diff --git a/tests/baselines/reference/interMixingModulesInterfaces0.types b/tests/baselines/reference/interMixingModulesInterfaces0.types index bc78303ba74f5..48e974727d550 100644 --- a/tests/baselines/reference/interMixingModulesInterfaces0.types +++ b/tests/baselines/reference/interMixingModulesInterfaces0.types @@ -10,7 +10,7 @@ module A { >B : B return null; ->null : null +>null : B } } diff --git a/tests/baselines/reference/interMixingModulesInterfaces1.types b/tests/baselines/reference/interMixingModulesInterfaces1.types index 37401e3a788c7..e80f6005e249d 100644 --- a/tests/baselines/reference/interMixingModulesInterfaces1.types +++ b/tests/baselines/reference/interMixingModulesInterfaces1.types @@ -20,7 +20,7 @@ module A { >B : B return null; ->null : null +>null : B } } } diff --git a/tests/baselines/reference/interMixingModulesInterfaces2.types b/tests/baselines/reference/interMixingModulesInterfaces2.types index 6780a34dc7e98..e05132191ce21 100644 --- a/tests/baselines/reference/interMixingModulesInterfaces2.types +++ b/tests/baselines/reference/interMixingModulesInterfaces2.types @@ -20,7 +20,7 @@ module A { >B : B return null; ->null : null +>null : B } } } @@ -29,5 +29,5 @@ var x: A.B = null; >x : A.B >A : any >B : A.B ->null : null +>null : A.B diff --git a/tests/baselines/reference/interMixingModulesInterfaces3.types b/tests/baselines/reference/interMixingModulesInterfaces3.types index 416ac21522712..b41a536f77937 100644 --- a/tests/baselines/reference/interMixingModulesInterfaces3.types +++ b/tests/baselines/reference/interMixingModulesInterfaces3.types @@ -10,7 +10,7 @@ module A { >B : B return null; ->null : null +>null : B } } @@ -29,5 +29,5 @@ var x: A.B = null; >x : A.B >A : any >B : A.B ->null : null +>null : A.B diff --git a/tests/baselines/reference/interMixingModulesInterfaces4.types b/tests/baselines/reference/interMixingModulesInterfaces4.types index 456f7fc220244..14f3ef8e98768 100644 --- a/tests/baselines/reference/interMixingModulesInterfaces4.types +++ b/tests/baselines/reference/interMixingModulesInterfaces4.types @@ -9,7 +9,7 @@ module A { >createB : () => number return null; ->null : null +>null : number } } diff --git a/tests/baselines/reference/interMixingModulesInterfaces5.types b/tests/baselines/reference/interMixingModulesInterfaces5.types index 977ecc3966829..09fce98586739 100644 --- a/tests/baselines/reference/interMixingModulesInterfaces5.types +++ b/tests/baselines/reference/interMixingModulesInterfaces5.types @@ -19,7 +19,7 @@ module A { >createB : () => number return null; ->null : null +>null : number } } } diff --git a/tests/baselines/reference/interfaceContextualType.types b/tests/baselines/reference/interfaceContextualType.types index 0e835a2f1f955..d39fac6def356 100644 --- a/tests/baselines/reference/interfaceContextualType.types +++ b/tests/baselines/reference/interfaceContextualType.types @@ -27,11 +27,11 @@ class Bug { >ok : () => void this.values = {}; ->this.values = {} : {} +>this.values = {} : IMap >this.values : IMap >this : this >values : IMap ->{} : {} +>{} : IMap this.values['comments'] = { italic: true }; >this.values['comments'] = { italic: true } : { italic: boolean; } diff --git a/tests/baselines/reference/interfaceWithPropertyOfEveryType.types b/tests/baselines/reference/interfaceWithPropertyOfEveryType.types index 7428ee73aa126..c1d702a4acce6 100644 --- a/tests/baselines/reference/interfaceWithPropertyOfEveryType.types +++ b/tests/baselines/reference/interfaceWithPropertyOfEveryType.types @@ -80,7 +80,7 @@ interface Foo { var a: Foo = { >a : Foo >Foo : Foo ->{ a: 1, b: '', c: true, d: {}, e: null , f: [1], g: {}, h: (x: number) => 1, i: (x: T) => x, j: null, k: new C(), l: f1, m: M, n: {}, o: E.A} : { a: number; b: string; c: boolean; d: {}; e: null; f: number[]; g: {}; h: (x: number) => number; i: (x: T) => T; j: Foo; k: C; l: () => void; m: typeof M; n: {}; o: E; } +>{ a: 1, b: '', c: true, d: {}, e: null , f: [1], g: {}, h: (x: number) => 1, i: (x: T) => x, j: null, k: new C(), l: f1, m: M, n: {}, o: E.A} : { a: number; b: string; c: boolean; d: any; e: void; f: number[]; g: {}; h: (x: number) => number; i: (x: T) => T; j: Foo; k: C; l: () => void; m: typeof M; n: {}; o: E; } a: 1, >a : number @@ -95,12 +95,12 @@ var a: Foo = { >true : boolean d: {}, ->d : {} ->{} : {} +>d : any +>{} : any e: null , ->e : null ->null : null +>e : void +>null : void f: [1], >f : number[] @@ -129,7 +129,7 @@ var a: Foo = { >j : Foo >null : Foo >Foo : Foo ->null : null +>null : Foo k: new C(), >k : C diff --git a/tests/baselines/reference/invalidUndefinedValues.types b/tests/baselines/reference/invalidUndefinedValues.types index b88c202161874..0b2bf3cef0211 100644 --- a/tests/baselines/reference/invalidUndefinedValues.types +++ b/tests/baselines/reference/invalidUndefinedValues.types @@ -27,9 +27,9 @@ x = a; >a : void x = null; ->x = null : null +>x = null : any >x : any ->null : null +>null : any class C { foo: string } >C : C diff --git a/tests/baselines/reference/ipromise4.types b/tests/baselines/reference/ipromise4.types index b12c47c7ed5b6..400b888ff581f 100644 --- a/tests/baselines/reference/ipromise4.types +++ b/tests/baselines/reference/ipromise4.types @@ -97,7 +97,7 @@ var p: Windows.Foundation.IPromise = null; >Windows : any >Foundation : any >IPromise : Windows.Foundation.IPromise ->null : null +>null : Windows.Foundation.IPromise p.then(function (x) { } ); // should not error >p.then(function (x) { } ) : Windows.Foundation.IPromise diff --git a/tests/baselines/reference/isDeclarationVisibleNodeKinds.types b/tests/baselines/reference/isDeclarationVisibleNodeKinds.types index b3fe8d684b72a..ef322e698865f 100644 --- a/tests/baselines/reference/isDeclarationVisibleNodeKinds.types +++ b/tests/baselines/reference/isDeclarationVisibleNodeKinds.types @@ -13,7 +13,7 @@ module schema { >T : T return undefined; ->undefined : undefined +>undefined : (data: T) => T } } @@ -30,7 +30,7 @@ module schema { >T : T return undefined; ->undefined : undefined +>undefined : new (data: T) => T } } @@ -47,7 +47,7 @@ module schema { >T : T return undefined; ->undefined : undefined +>undefined : number | (new (data: T) => T) } } @@ -64,7 +64,7 @@ module schema { >T : T return undefined; ->undefined : undefined +>undefined : (new (data: T) => T)[] } } @@ -82,7 +82,7 @@ module schema { >T : T return undefined; ->undefined : undefined +>undefined : new (data: T) => T } } @@ -99,7 +99,7 @@ module schema { >T : T return undefined; ->undefined : undefined +>undefined : [new (data: T) => T, number] } } @@ -116,7 +116,7 @@ module schema { >T : T return undefined; ->undefined : undefined +>undefined : (new (data: T) => T)[] } } @@ -134,7 +134,7 @@ module schema { >T : T return undefined; ->undefined : undefined +>undefined : ((data: T) => T)[] } } @@ -153,7 +153,7 @@ module schema { >T : T return undefined; ->undefined : undefined +>undefined : (data: T) => T } set createValidator10(v: (data: T) => T) { diff --git a/tests/baselines/reference/keywordField.types b/tests/baselines/reference/keywordField.types index 8bc977edd747f..565cb8d02a521 100644 --- a/tests/baselines/reference/keywordField.types +++ b/tests/baselines/reference/keywordField.types @@ -1,7 +1,7 @@ === tests/cases/compiler/keywordField.ts === var obj:any = {}; >obj : any ->{} : {} +>{} : any obj.if = 1; >obj.if = 1 : number diff --git a/tests/baselines/reference/letIdentifierInElementAccess01.types b/tests/baselines/reference/letIdentifierInElementAccess01.types index 187fd7e221cbf..994cec5623488 100644 --- a/tests/baselines/reference/letIdentifierInElementAccess01.types +++ b/tests/baselines/reference/letIdentifierInElementAccess01.types @@ -1,7 +1,7 @@ === tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts === var let: any = {}; >let : any ->{} : {} +>{} : any (let[0] = 100); >(let[0] = 100) : number diff --git a/tests/baselines/reference/library_DatePrototypeProperties.types b/tests/baselines/reference/library_DatePrototypeProperties.types index c048b9833d659..91873cd497922 100644 --- a/tests/baselines/reference/library_DatePrototypeProperties.types +++ b/tests/baselines/reference/library_DatePrototypeProperties.types @@ -366,5 +366,5 @@ Date.prototype.toJSON(null); >Date : DateConstructor >prototype : Date >toJSON : (key?: any) => string ->null : null +>null : any diff --git a/tests/baselines/reference/listFailure.types b/tests/baselines/reference/listFailure.types index 03725efeca44d..0e662773495e2 100644 --- a/tests/baselines/reference/listFailure.types +++ b/tests/baselines/reference/listFailure.types @@ -60,7 +60,7 @@ module Editor { >U : U return null; ->null : null +>null : List } export function ListMakeEntry(data: U): List { @@ -72,7 +72,7 @@ module Editor { >U : U return null; ->null : null +>null : List } class List { diff --git a/tests/baselines/reference/logicalOrOperatorWithEveryType.types b/tests/baselines/reference/logicalOrOperatorWithEveryType.types index 4540e35aaf459..c4d345fc52cdf 100644 --- a/tests/baselines/reference/logicalOrOperatorWithEveryType.types +++ b/tests/baselines/reference/logicalOrOperatorWithEveryType.types @@ -520,49 +520,49 @@ var rj1 = a1 || null; // any || null is any >rj1 : any >a1 || null : any >a1 : any ->null : null +>null : any var rj2 = a2 || null; // boolean || null is boolean >rj2 : boolean >a2 || null : boolean >a2 : boolean ->null : null +>null : boolean var rj3 = a3 || null; // number || null is number >rj3 : number >a3 || null : number >a3 : number ->null : null +>null : number var rj4 = a4 || null; // string || null is string >rj4 : string >a4 || null : string >a4 : string ->null : null +>null : string var rj5 = a5 || null; // void || null is void >rj5 : void >a5 || null : void >a5 : void ->null : null +>null : void var rj6 = a6 || null; // enum || null is E >rj6 : E >a6 || null : E >a6 : E ->null : null +>null : E var rj7 = a7 || null; // object || null is object >rj7 : { a: string; } >a7 || null : { a: string; } >a7 : { a: string; } ->null : null +>null : { a: string; } var rj8 = a8 || null; // array || null is array >rj8 : string[] >a8 || null : string[] >a8 : string[] ->null : null +>null : string[] var rj9 = null || null; // null || null is any >rj9 : any @@ -572,63 +572,63 @@ var rj9 = null || null; // null || null is any var rj10 = undefined || null; // undefined || null is any >rj10 : any ->undefined || null : null +>undefined || null : undefined >undefined : undefined ->null : null +>null : undefined var rf1 = a1 || undefined; // any || undefined is any >rf1 : any >a1 || undefined : any >a1 : any ->undefined : undefined +>undefined : any var rf2 = a2 || undefined; // boolean || undefined is boolean >rf2 : boolean >a2 || undefined : boolean >a2 : boolean ->undefined : undefined +>undefined : boolean var rf3 = a3 || undefined; // number || undefined is number >rf3 : number >a3 || undefined : number >a3 : number ->undefined : undefined +>undefined : number var rf4 = a4 || undefined; // string || undefined is string >rf4 : string >a4 || undefined : string >a4 : string ->undefined : undefined +>undefined : string var rf5 = a5 || undefined; // void || undefined is void >rf5 : void >a5 || undefined : void >a5 : void ->undefined : undefined +>undefined : void var rf6 = a6 || undefined; // enum || undefined is E >rf6 : E >a6 || undefined : E >a6 : E ->undefined : undefined +>undefined : E var rf7 = a7 || undefined; // object || undefined is object >rf7 : { a: string; } >a7 || undefined : { a: string; } >a7 : { a: string; } ->undefined : undefined +>undefined : { a: string; } var rf8 = a8 || undefined; // array || undefined is array >rf8 : string[] >a8 || undefined : string[] >a8 : string[] ->undefined : undefined +>undefined : string[] var rf9 = null || undefined; // null || undefined is any >rf9 : any >null || undefined : null >null : null ->undefined : undefined +>undefined : null var rf10 = undefined || undefined; // undefined || undefined is any >rf10 : any diff --git a/tests/baselines/reference/memberAccessMustUseModuleInstances.types b/tests/baselines/reference/memberAccessMustUseModuleInstances.types index b1848660dac78..04733fe8d6529 100644 --- a/tests/baselines/reference/memberAccessMustUseModuleInstances.types +++ b/tests/baselines/reference/memberAccessMustUseModuleInstances.types @@ -22,7 +22,7 @@ export class Promise { >Promise : Promise return null; ->null : null +>null : Promise } } diff --git a/tests/baselines/reference/memberVariableDeclarations1.types b/tests/baselines/reference/memberVariableDeclarations1.types index b7ec0fbaba02e..04c93d38b4670 100644 --- a/tests/baselines/reference/memberVariableDeclarations1.types +++ b/tests/baselines/reference/memberVariableDeclarations1.types @@ -17,12 +17,12 @@ class Employee { public manager: Employee = null; >manager : Employee >Employee : Employee ->null : null +>null : Employee public reports: Employee[] = []; >reports : Employee[] >Employee : Employee ->[] : undefined[] +>[] : Employee[] } class Employee2 { @@ -54,18 +54,18 @@ class Employee2 { >false : boolean this.manager = null; ->this.manager = null : null +>this.manager = null : Employee >this.manager : Employee >this : this >manager : Employee ->null : null +>null : Employee this.reports = []; ->this.reports = [] : undefined[] +>this.reports = [] : Employee[] >this.reports : Employee[] >this : this >reports : Employee[] ->[] : undefined[] +>[] : Employee[] } } diff --git a/tests/baselines/reference/mismatchedGenericArguments1.types b/tests/baselines/reference/mismatchedGenericArguments1.types index c681445ab162d..5462a069ec2ca 100644 --- a/tests/baselines/reference/mismatchedGenericArguments1.types +++ b/tests/baselines/reference/mismatchedGenericArguments1.types @@ -21,7 +21,7 @@ class C implements IFoo { >x : string return null; ->null : null +>null : number } } @@ -37,7 +37,7 @@ class C2 implements IFoo { >x : string return null; ->null : null +>null : number } } diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types index 16051c14b7c7d..67ea8f46026d9 100644 --- a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types @@ -173,7 +173,7 @@ var p = new Proxy(t, {}); >new Proxy(t, {}) : {} >Proxy : ProxyConstructor >t : {} ->{} : {} +>{} : ProxyHandler<{}> // Using ES6 reflect Reflect.isExtensible({}); @@ -181,7 +181,7 @@ Reflect.isExtensible({}); >Reflect.isExtensible : (target: any) => boolean >Reflect : typeof Reflect >isExtensible : (target: any) => boolean ->{} : {} +>{} : any // Using Es6 regexp var reg = new RegExp("/s"); diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types index a7d8e77e28c13..9cc9a0f7e815e 100644 --- a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types @@ -173,7 +173,7 @@ var p = new Proxy(t, {}); >new Proxy(t, {}) : {} >Proxy : ProxyConstructor >t : {} ->{} : {} +>{} : ProxyHandler<{}> // Using ES6 reflect Reflect.isExtensible({}); @@ -181,7 +181,7 @@ Reflect.isExtensible({}); >Reflect.isExtensible : (target: any) => boolean >Reflect : typeof Reflect >isExtensible : (target: any) => boolean ->{} : {} +>{} : any // Using Es6 regexp var reg = new RegExp("/s"); diff --git a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types index 8272465da5e7b..2f440148651c0 100644 --- a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types +++ b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types @@ -173,7 +173,7 @@ var p = new Proxy(t, {}); >new Proxy(t, {}) : {} >Proxy : ProxyConstructor >t : {} ->{} : {} +>{} : ProxyHandler<{}> // Using ES6 reflect Reflect.isExtensible({}); @@ -181,7 +181,7 @@ Reflect.isExtensible({}); >Reflect.isExtensible : (target: any) => boolean >Reflect : typeof Reflect >isExtensible : (target: any) => boolean ->{} : {} +>{} : any // Using Es6 regexp var reg = new RegExp("/s"); diff --git a/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.types b/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.types index 7af40d3684cdb..a254b8b2ee634 100644 --- a/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.types +++ b/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.types @@ -96,7 +96,7 @@ var p = new Proxy(t, {}); >new Proxy(t, {}) : {} >Proxy : ProxyConstructor >t : {} ->{} : {} +>{} : ProxyHandler<{}> // Using ES6 reflect Reflect.isExtensible({}); @@ -104,7 +104,7 @@ Reflect.isExtensible({}); >Reflect.isExtensible : (target: any) => boolean >Reflect : typeof Reflect >isExtensible : (target: any) => boolean ->{} : {} +>{} : any // Using Es6 regexp var reg = new RegExp("/s"); diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.types b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.types index 820c2f6dc8a93..1b8129c6e48f1 100644 --- a/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.types +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.types @@ -14,14 +14,14 @@ var p = new Proxy(t, {}); >new Proxy(t, {}) : {} >Proxy : ProxyConstructor >t : {} ->{} : {} +>{} : ProxyHandler<{}> Reflect.ownKeys({}); >Reflect.ownKeys({}) : (string | number | symbol)[] >Reflect.ownKeys : (target: any) => (string | number | symbol)[] >Reflect : typeof Reflect >ownKeys : (target: any) => (string | number | symbol)[] ->{} : {} +>{} : any function* idGen() { >idGen : () => IterableIterator diff --git a/tests/baselines/reference/moduleAndInterfaceSharingName.types b/tests/baselines/reference/moduleAndInterfaceSharingName.types index e5b537f856ec4..b29ad91dacd26 100644 --- a/tests/baselines/reference/moduleAndInterfaceSharingName.types +++ b/tests/baselines/reference/moduleAndInterfaceSharingName.types @@ -16,7 +16,7 @@ var z: X.Y.Z = null; >X : any >Y : any >Z : X.Y.Z ->null : null +>null : X.Y.Z var z2: X.Y; >z2 : X.Y diff --git a/tests/baselines/reference/moduleAndInterfaceSharingName3.types b/tests/baselines/reference/moduleAndInterfaceSharingName3.types index 690256bcf0899..b7b9b849b94e0 100644 --- a/tests/baselines/reference/moduleAndInterfaceSharingName3.types +++ b/tests/baselines/reference/moduleAndInterfaceSharingName3.types @@ -17,7 +17,7 @@ var z: X.Y.Z = null; >X : any >Y : any >Z : X.Y.Z ->null : null +>null : X.Y.Z var z2: X.Y; >z2 : X.Y diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports1.types b/tests/baselines/reference/moduleAugmentationImportsAndExports1.types index 886a04b54ef6b..722c803a6d3b3 100644 --- a/tests/baselines/reference/moduleAugmentationImportsAndExports1.types +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports1.types @@ -19,14 +19,14 @@ import {B} from "./f2"; >B : typeof B A.prototype.foo = function () { return undefined; } ->A.prototype.foo = function () { return undefined; } : () => any +>A.prototype.foo = function () { return undefined; } : () => B >A.prototype.foo : () => B >A.prototype : A >A : typeof A >prototype : A >foo : () => B ->function () { return undefined; } : () => any ->undefined : undefined +>function () { return undefined; } : () => B +>undefined : B declare module "./f1" { interface A { diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports4.types b/tests/baselines/reference/moduleAugmentationImportsAndExports4.types index 454dc5d27ecd5..e17e879163f87 100644 --- a/tests/baselines/reference/moduleAugmentationImportsAndExports4.types +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports4.types @@ -19,14 +19,14 @@ import {B} from "./f2"; >B : typeof B A.prototype.foo = function () { return undefined; } ->A.prototype.foo = function () { return undefined; } : () => any +>A.prototype.foo = function () { return undefined; } : () => B >A.prototype.foo : () => B >A.prototype : A >A : typeof A >prototype : A >foo : () => B ->function () { return undefined; } : () => any ->undefined : undefined +>function () { return undefined; } : () => B +>undefined : B namespace N { >N : any diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports6.types b/tests/baselines/reference/moduleAugmentationImportsAndExports6.types index 0c201599b52a0..ae8454e3bb719 100644 --- a/tests/baselines/reference/moduleAugmentationImportsAndExports6.types +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports6.types @@ -19,14 +19,14 @@ import {B} from "./f2"; >B : typeof B A.prototype.foo = function () { return undefined; } ->A.prototype.foo = function () { return undefined; } : () => any +>A.prototype.foo = function () { return undefined; } : () => B >A.prototype.foo : () => B >A.prototype : A >A : typeof A >prototype : A >foo : () => B ->function () { return undefined; } : () => any ->undefined : undefined +>function () { return undefined; } : () => B +>undefined : B export namespace N { >N : any diff --git a/tests/baselines/reference/moduleAugmentationsImports1.types b/tests/baselines/reference/moduleAugmentationsImports1.types index bf0bfee0a7a6d..5198806a80e22 100644 --- a/tests/baselines/reference/moduleAugmentationsImports1.types +++ b/tests/baselines/reference/moduleAugmentationsImports1.types @@ -28,24 +28,24 @@ import {Cls} from "C"; >Cls : typeof Cls A.prototype.getB = function () { return undefined; } ->A.prototype.getB = function () { return undefined; } : () => any +>A.prototype.getB = function () { return undefined; } : () => B >A.prototype.getB : () => B >A.prototype : A >A : typeof A >prototype : A >getB : () => B ->function () { return undefined; } : () => any ->undefined : undefined +>function () { return undefined; } : () => B +>undefined : B A.prototype.getCls = function () { return undefined; } ->A.prototype.getCls = function () { return undefined; } : () => any +>A.prototype.getCls = function () { return undefined; } : () => Cls >A.prototype.getCls : () => Cls >A.prototype : A >A : typeof A >prototype : A >getCls : () => Cls ->function () { return undefined; } : () => any ->undefined : undefined +>function () { return undefined; } : () => Cls +>undefined : Cls declare module "./a" { interface A { diff --git a/tests/baselines/reference/moduleAugmentationsImports2.types b/tests/baselines/reference/moduleAugmentationsImports2.types index 56b40625600aa..e09f3d1c4d2c7 100644 --- a/tests/baselines/reference/moduleAugmentationsImports2.types +++ b/tests/baselines/reference/moduleAugmentationsImports2.types @@ -25,14 +25,14 @@ import {B} from "./b"; >B : typeof B A.prototype.getB = function () { return undefined; } ->A.prototype.getB = function () { return undefined; } : () => any +>A.prototype.getB = function () { return undefined; } : () => B >A.prototype.getB : () => B >A.prototype : A >A : typeof A >prototype : A >getB : () => B ->function () { return undefined; } : () => any ->undefined : undefined +>function () { return undefined; } : () => B +>undefined : B declare module "./a" { interface A { @@ -52,14 +52,14 @@ import {Cls} from "C"; >Cls : typeof Cls A.prototype.getCls = function () { return undefined; } ->A.prototype.getCls = function () { return undefined; } : () => any +>A.prototype.getCls = function () { return undefined; } : () => Cls >A.prototype.getCls : () => Cls >A.prototype : A >A : typeof A >prototype : A >getCls : () => Cls ->function () { return undefined; } : () => any ->undefined : undefined +>function () { return undefined; } : () => Cls +>undefined : Cls declare module "./a" { interface A { diff --git a/tests/baselines/reference/moduleAugmentationsImports3.types b/tests/baselines/reference/moduleAugmentationsImports3.types index 04d17296c5694..2a174338ee616 100644 --- a/tests/baselines/reference/moduleAugmentationsImports3.types +++ b/tests/baselines/reference/moduleAugmentationsImports3.types @@ -79,14 +79,14 @@ import {Cls} from "C"; >Cls : typeof Cls A.prototype.getCls = function () { return undefined; } ->A.prototype.getCls = function () { return undefined; } : () => any +>A.prototype.getCls = function () { return undefined; } : () => Cls >A.prototype.getCls : () => Cls >A.prototype : A >A : typeof A >prototype : A >getCls : () => Cls ->function () { return undefined; } : () => any ->undefined : undefined +>function () { return undefined; } : () => Cls +>undefined : Cls declare module "./a" { interface A { diff --git a/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.types b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.types index c308f535a7a86..c38106dbaacf6 100644 --- a/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.types +++ b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.types @@ -11,7 +11,7 @@ module TypeScript.Parser { >SyntaxNode : SyntaxNode return null; ->null : null +>null : SyntaxNode } } } @@ -73,12 +73,12 @@ module TypeScript { >this.findTokenInternal : (x: any, y: any, z: any) => any >this : this >findTokenInternal : (x: any, y: any, z: any) => any ->null : null +>null : any >position : number >0 : number return null; ->null : null +>null : PositionedToken } findTokenInternal(x, y, z) { >findTokenInternal : (x: any, y: any, z: any) => any diff --git a/tests/baselines/reference/moduleReopenedTypeOtherBlock.types b/tests/baselines/reference/moduleReopenedTypeOtherBlock.types index c48c43ffd9ab7..78b84a1a93c81 100644 --- a/tests/baselines/reference/moduleReopenedTypeOtherBlock.types +++ b/tests/baselines/reference/moduleReopenedTypeOtherBlock.types @@ -16,6 +16,6 @@ module M { >C2 : C2 >f : () => I >I : I ->null : null +>null : I } diff --git a/tests/baselines/reference/moduleReopenedTypeSameBlock.types b/tests/baselines/reference/moduleReopenedTypeSameBlock.types index 7dec66f6c7b13..97b2bfe82aefa 100644 --- a/tests/baselines/reference/moduleReopenedTypeSameBlock.types +++ b/tests/baselines/reference/moduleReopenedTypeSameBlock.types @@ -14,6 +14,6 @@ module M { >C2 : C2 >f : () => I >I : I ->null : null +>null : I } diff --git a/tests/baselines/reference/moduleSymbolMerging.types b/tests/baselines/reference/moduleSymbolMerging.types index 0f5dfae5c3d3c..d10081016be30 100644 --- a/tests/baselines/reference/moduleSymbolMerging.types +++ b/tests/baselines/reference/moduleSymbolMerging.types @@ -10,7 +10,7 @@ module B { >f : () => A.I >A : any >I : A.I ->null : null +>null : A.I } diff --git a/tests/baselines/reference/moduleVisibilityTest1.types b/tests/baselines/reference/moduleVisibilityTest1.types index b54f897d01434..dd03aa5244b06 100644 --- a/tests/baselines/reference/moduleVisibilityTest1.types +++ b/tests/baselines/reference/moduleVisibilityTest1.types @@ -150,7 +150,7 @@ var cprime : M.I = null; >null : M.I >M : any >I : M.I ->null : null +>null : M.I var c = new M.C(); >c : M.C diff --git a/tests/baselines/reference/moduleWithStatementsOfEveryKind.types b/tests/baselines/reference/moduleWithStatementsOfEveryKind.types index c6f4be850be65..ed59d27471b23 100644 --- a/tests/baselines/reference/moduleWithStatementsOfEveryKind.types +++ b/tests/baselines/reference/moduleWithStatementsOfEveryKind.types @@ -57,7 +57,7 @@ module A { var array: I[] = null; >array : I[] >I : I ->null : null +>null : I[] var fn = (s: string) => { >fn : (s: string) => string @@ -145,7 +145,7 @@ module Y { export var array: I[] = null; >array : I[] >I : I ->null : null +>null : I[] export var fn = (s: string) => { >fn : (s: string) => string diff --git a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.types b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.types index ac722f8a063af..9311d29003c67 100644 --- a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.types +++ b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.types @@ -7,7 +7,7 @@ class foo >bar : () => foo2 >foo2 : foo2 >T : T ->null : null +>null : foo2 } class foo2 extends foo { diff --git a/tests/baselines/reference/narrowTypeByInstanceof.types b/tests/baselines/reference/narrowTypeByInstanceof.types index 8bc13d12ca11c..1fc9fe57c2afa 100644 --- a/tests/baselines/reference/narrowTypeByInstanceof.types +++ b/tests/baselines/reference/narrowTypeByInstanceof.types @@ -6,7 +6,7 @@ >range : () => any return undefined; ->undefined : undefined +>undefined : any } } @@ -17,7 +17,7 @@ >resource : () => any return undefined; ->undefined : undefined +>undefined : any } } diff --git a/tests/baselines/reference/newOperatorConformance.types b/tests/baselines/reference/newOperatorConformance.types index 912c0a5c81ad8..d0e523f47a752 100644 --- a/tests/baselines/reference/newOperatorConformance.types +++ b/tests/baselines/reference/newOperatorConformance.types @@ -80,7 +80,7 @@ var d = new anyCtor1(undefined); >d : any >new anyCtor1(undefined) : any >anyCtor1 : new (n: any) => any ->undefined : undefined +>undefined : any // Construct expression of type where apparent type has a construct signature with 0 arguments function newFn1(s: T) { diff --git a/tests/baselines/reference/noConstraintInReturnType1.types b/tests/baselines/reference/noConstraintInReturnType1.types index a4c754371eb33..bdad16c7c27e0 100644 --- a/tests/baselines/reference/noConstraintInReturnType1.types +++ b/tests/baselines/reference/noConstraintInReturnType1.types @@ -8,6 +8,6 @@ class List { >T : T >List : List >T : T ->null : null +>null : List } diff --git a/tests/baselines/reference/noImplicitAnyFunctionExpressionAssignment.types b/tests/baselines/reference/noImplicitAnyFunctionExpressionAssignment.types index 9d8e216b6565d..610144a1a7f74 100644 --- a/tests/baselines/reference/noImplicitAnyFunctionExpressionAssignment.types +++ b/tests/baselines/reference/noImplicitAnyFunctionExpressionAssignment.types @@ -3,26 +3,26 @@ var x: (a: any) => void = function (x: T) { >x : (a: any) => void >a : any ->function (x: T) { return null;} : (x: T) => any +>function (x: T) { return null;} : (x: T) => void >T : T >x : T >T : T return null; ->null : null +>null : void }; var x2: (a: any) => void = function f(x: T) { >x2 : (a: any) => void >a : any ->function f(x: T) { return null;} : (x: T) => any ->f : (x: T) => any +>function f(x: T) { return null;} : (x: T) => void +>f : (x: T) => void >T : T >x : T >T : T return null; ->null : null +>null : void }; diff --git a/tests/baselines/reference/null.types b/tests/baselines/reference/null.types index 6fd8b423f1381..e2ec78a449e04 100644 --- a/tests/baselines/reference/null.types +++ b/tests/baselines/reference/null.types @@ -50,9 +50,9 @@ interface I { var w:I={x:null,y:3}; >w : I >I : I ->{x:null,y:3} : { x: null; y: number; } ->x : null ->null : null +>{x:null,y:3} : { x: any; y: number; } +>x : any +>null : any >y : number >3 : number diff --git a/tests/baselines/reference/nullAssignableToEveryType.types b/tests/baselines/reference/nullAssignableToEveryType.types index 5120a48b896fe..0665787435c85 100644 --- a/tests/baselines/reference/nullAssignableToEveryType.types +++ b/tests/baselines/reference/nullAssignableToEveryType.types @@ -29,75 +29,75 @@ var ae: E; var b: number = null; >b : number ->null : null +>null : number var c: string = null; >c : string ->null : null +>null : string var d: boolean = null; >d : boolean ->null : null +>null : boolean var e: Date = null; >e : Date >Date : Date ->null : null +>null : Date var f: any = null; >f : any ->null : null +>null : any var g: void = null; >g : void ->null : null +>null : void var h: Object = null; >h : Object >Object : Object ->null : null +>null : Object var i: {} = null; >i : {} ->null : null +>null : {} var j: () => {} = null; >j : () => {} ->null : null +>null : () => {} var k: Function = null; >k : Function >Function : Function ->null : null +>null : Function var l: (x: number) => string = null; >l : (x: number) => string >x : number ->null : null +>null : (x: number) => string ac = null; ->ac = null : null +>ac = null : C >ac : C ->null : null +>null : C ai = null; ->ai = null : null +>ai = null : I >ai : I ->null : null +>null : I ae = null; ->ae = null : null +>ae = null : E >ae : E ->null : null +>null : E var m: number[] = null; >m : number[] ->null : null +>null : number[] var n: { foo: string } = null; >n : { foo: string; } >foo : string ->null : null +>null : { foo: string; } var o: (x: T) => T = null; >o : (x: T) => T @@ -105,17 +105,17 @@ var o: (x: T) => T = null; >x : T >T : T >T : T ->null : null +>null : (x: T) => T var p: Number = null; >p : Number >Number : Number ->null : null +>null : Number var q: String = null; >q : String >String : String ->null : null +>null : String function foo(x: T, y: U, z: V) { >foo : (x: T, y: U, z: V) => void @@ -131,19 +131,19 @@ function foo(x: T, y: U, z: V) { >V : V x = null; ->x = null : null +>x = null : T >x : T ->null : null +>null : T y = null; ->y = null : null +>y = null : U >y : U ->null : null +>null : U z = null; ->z = null : null +>z = null : V >z : V ->null : null +>null : V } //function foo(x: T, y: U, z: V) { diff --git a/tests/baselines/reference/objectIndexer.types b/tests/baselines/reference/objectIndexer.types index b11c475a3863d..6e9ae7b4b09dc 100644 --- a/tests/baselines/reference/objectIndexer.types +++ b/tests/baselines/reference/objectIndexer.types @@ -23,11 +23,11 @@ class Emitter { constructor () { this.listeners = {}; ->this.listeners = {} : {} +>this.listeners = {} : IMap >this.listeners : IMap >this : this >listeners : IMap ->{} : {} +>{} : IMap } } diff --git a/tests/baselines/reference/objectLiteralContextualTyping.types b/tests/baselines/reference/objectLiteralContextualTyping.types index 8100b7a54463f..7df4786e7c4e0 100644 --- a/tests/baselines/reference/objectLiteralContextualTyping.types +++ b/tests/baselines/reference/objectLiteralContextualTyping.types @@ -83,7 +83,7 @@ var b = bar({}); >b : {} >bar({}) : {} >bar : (param: { x?: T; }) => T ->{} : {} +>{} : { x?: {}; } var b: {}; >b : {} diff --git a/tests/baselines/reference/objectLiteralIndexerNoImplicitAny.types b/tests/baselines/reference/objectLiteralIndexerNoImplicitAny.types index b0ddd9f60d0e9..59797797ada7b 100644 --- a/tests/baselines/reference/objectLiteralIndexerNoImplicitAny.types +++ b/tests/baselines/reference/objectLiteralIndexerNoImplicitAny.types @@ -9,9 +9,9 @@ interface I { var x: I = { >x : I >I : I ->{ p: null} : { p: null; } +>{ p: null} : { p: any; } p: null ->p : null ->null : null +>p : any +>null : any } diff --git a/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.types b/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.types index 490f3101751a4..393dbfd320660 100644 --- a/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.types +++ b/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.types @@ -399,7 +399,7 @@ var b = { "0.1": null, >null : void ->null : null +>null : void ".1": new Object(), >new Object() : Object diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignatures.types b/tests/baselines/reference/objectTypesIdentityWithCallSignatures.types index 545e2376bb34b..956f35acff48c 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignatures.types +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignatures.types @@ -7,7 +7,7 @@ class A { foo(x: string): string { return null; } >foo : (x: string) => string >x : string ->null : null +>null : string } class B { @@ -16,7 +16,7 @@ class B { foo(x: string): string { return null; } >foo : (x: string) => string >x : string ->null : null +>null : string } class C { @@ -28,7 +28,7 @@ class C { >x : T >T : T >T : T ->null : null +>null : T } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.types b/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.types index 378c5c4fa0cc8..e0841f179f722 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.types +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.types @@ -7,7 +7,7 @@ class A { foo(x: string): string { return null; } >foo : (x: string) => string >x : string ->null : null +>null : string } class B { @@ -16,7 +16,7 @@ class B { foo(x: number): string { return null; } >foo : (x: number) => string >x : number ->null : null +>null : string } class C { @@ -28,7 +28,7 @@ class C { >x : T >T : T >T : T ->null : null +>null : T } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.types b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.types index 62426cb033338..ac287d68db0c5 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.types +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.types @@ -7,7 +7,7 @@ class A { foo(x: string): string { return null; } >foo : (x: string) => string >x : string ->null : null +>null : string } class B { @@ -17,7 +17,7 @@ class B { >foo : (x: string, y: string) => string >x : string >y : string ->null : null +>null : string } class C { @@ -31,7 +31,7 @@ class C { >y : T >T : T >T : T ->null : null +>null : T } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.types b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.types index edaad51b32ea7..919cf44a8a4a1 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.types +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.types @@ -15,7 +15,7 @@ class A { foo(x: any): any { return null; } >foo : { (x: number): number; (x: string): string; } >x : any ->null : null +>null : any } class B { @@ -32,7 +32,7 @@ class B { foo(x: any): any { return null; } >foo : { (x: number): number; (x: string): string; } >x : any ->null : null +>null : any } class C { @@ -56,7 +56,7 @@ class C { foo(x: any): any { return null; } >foo : { (x: number): number; (x: string): string; (x: T): T; } >x : any ->null : null +>null : any } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.types b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.types index 2e5e7231721ea..4b3fb881138d2 100644 --- a/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.types +++ b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.types @@ -6,7 +6,7 @@ class B { constructor(x: number) { return null; } >x : number ->null : null +>null : B } class C { @@ -16,7 +16,7 @@ class C { constructor(x: T) { return null; } >x : T >T : T ->null : null +>null : C } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.types b/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.types index b7f5995395912..afb4e7651e188 100644 --- a/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.types +++ b/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.types @@ -7,7 +7,7 @@ class B { constructor(x: string, y: string) { return null; } >x : string >y : string ->null : null +>null : B } class C { @@ -19,7 +19,7 @@ class C { >T : T >y : T >T : T ->null : null +>null : C } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.types index d871c3c4cb579..5ab655684abeb 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.types @@ -10,7 +10,7 @@ class A { >x : T >T : T >T : T ->null : null +>null : T } class B { @@ -22,7 +22,7 @@ class B { >x : T >T : T >T : T ->null : null +>null : T } class C { @@ -34,7 +34,7 @@ class C { >x : T >T : T >T : T ->null : null +>null : T } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.types index c7ca543aead0a..03d0541ae3db7 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.types @@ -13,7 +13,7 @@ class A { >y : U >U : U >T : T ->null : null +>null : T } class B { @@ -28,7 +28,7 @@ class B { >y : U >U : U >T : T ->null : null +>null : T } class C { @@ -43,7 +43,7 @@ class C { >y : U >U : U >T : T ->null : null +>null : T } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.types index 90ed7fd094537..91e01a9562945 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.types @@ -12,7 +12,7 @@ class A { >Date : Date >x : T >T : T ->null : null +>null : string } class B> { @@ -24,7 +24,7 @@ class B> { >foo : (x: T) => string >x : T >T : T ->null : null +>null : string } class C { @@ -36,7 +36,7 @@ class C { >foo : (x: T) => string >x : T >T : T ->null : null +>null : string } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.types index 4974b0874eba2..1e15dc30cd06d 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.types @@ -16,7 +16,7 @@ class A { >T : T >y : U >U : U ->null : null +>null : string } class B> { @@ -32,7 +32,7 @@ class B> { >T : T >y : U >U : U ->null : null +>null : string } class C { @@ -48,7 +48,7 @@ class C { >T : T >y : U >U : U ->null : null +>null : string } class D { @@ -64,7 +64,7 @@ class D { >T : T >y : U >U : U ->null : null +>null : string } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.types index b5c2f6bdef0e8..cde6266fcbf31 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.types @@ -50,7 +50,7 @@ class A { >T : T >y : U >U : U ->null : null +>null : string } class B { @@ -66,7 +66,7 @@ class B { >T : T >y : U >U : U ->null : null +>null : string } class C { @@ -82,7 +82,7 @@ class C { >T : T >y : U >U : U ->null : null +>null : string } class D> { @@ -98,7 +98,7 @@ class D> { >T : T >y : U >U : U ->null : null +>null : string } interface I> { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.types index ef6799b6ab951..270e1dff43d59 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.types @@ -11,7 +11,7 @@ class A { >T : T >x : T >T : T ->null : null +>null : string } class B { @@ -22,7 +22,7 @@ class B { >foo : (x: T) => number >x : T >T : T ->null : null +>null : number } class C { @@ -33,7 +33,7 @@ class C { >foo : (x: T) => boolean >x : T >T : T ->null : null +>null : boolean } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.types index c964cc46cadb6..43b00f0e4218d 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.types @@ -12,7 +12,7 @@ class A { >Date : Date >x : T >T : T ->null : null +>null : string } class B { @@ -24,7 +24,7 @@ class B { >foo : (x: T) => number >x : T >T : T ->null : null +>null : number } class C { @@ -36,7 +36,7 @@ class C { >foo : (x: T) => boolean >x : T >T : T ->null : null +>null : boolean } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.types index afc2e9ae6cee0..305dea3d86bbf 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.types @@ -10,7 +10,7 @@ class A { >x : T >T : T >T : T ->null : null +>null : T } class B { @@ -23,7 +23,7 @@ class B { >x : U >U : U >U : U ->null : null +>null : U } class C { @@ -37,7 +37,7 @@ class C { >x : V >V : V >V : V ->null : null +>null : V } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.types index 52acb56dfaf3e..ccec923d79d78 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.types @@ -10,7 +10,7 @@ class A { >x : T >T : T >T : T ->null : null +>null : T } class B { @@ -22,7 +22,7 @@ class B { >x : U >U : U >U : U ->null : null +>null : U } class C { @@ -34,7 +34,7 @@ class C { >x : V >V : V >V : V ->null : null +>null : V } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.types index da6144b57e222..1dfcf770907ab 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.types @@ -14,7 +14,7 @@ class A { >y : T >T : T >T : T ->null : null +>null : T } class B { @@ -28,7 +28,7 @@ class B { >y : T >T : T >T : T ->null : null +>null : T } class C { @@ -42,7 +42,7 @@ class C { >y : T >T : T >T : T ->null : null +>null : T } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.types index 09478fc5d3573..4b89b7c3302ce 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.types @@ -15,7 +15,7 @@ class A { >y : U >U : U >T : T ->null : null +>null : T } class B { @@ -30,7 +30,7 @@ class B { >y : U >U : U >T : T ->null : null +>null : T } class C { @@ -45,7 +45,7 @@ class C { >y : U >U : U >T : T ->null : null +>null : T } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.types b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.types index d0356784ed64d..b1319be1fa154 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.types @@ -15,7 +15,7 @@ class A { >y : U >U : U >T : T ->null : null +>null : T } class B { @@ -30,7 +30,7 @@ class B { >y : U >U : U >T : T ->null : null +>null : T } class C { @@ -45,7 +45,7 @@ class C { >y : U >U : U >T : T ->null : null +>null : T } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.types index ef3ec91f479c5..f85235a1ddf3c 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.types @@ -11,7 +11,7 @@ class B> { constructor(x: T) { return null; } >x : T >T : T ->null : null +>null : B } class C { @@ -22,7 +22,7 @@ class C { constructor(x: T) { return null; } >x : T >T : T ->null : null +>null : C } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.types index b1d1d79ac0582..01fc1d82e80c3 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.types @@ -15,7 +15,7 @@ class B> { >T : T >y : U >U : U ->null : null +>null : B } class C { @@ -30,7 +30,7 @@ class C { >T : T >y : U >U : U ->null : null +>null : C } class D { @@ -45,7 +45,7 @@ class D { >T : T >y : U >U : U ->null : null +>null : D } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.types index d8109a6a826fa..ec0244b8df08d 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.types @@ -49,7 +49,7 @@ class B { >T : T >y : U >U : U ->null : null +>null : B } class C { @@ -64,7 +64,7 @@ class C { >T : T >y : U >U : U ->null : null +>null : C } class D> { @@ -79,7 +79,7 @@ class D> { >T : T >y : U >U : U ->null : null +>null : D } interface I> { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.types index 657c38aae9a1d..754717c06caea 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.types @@ -10,7 +10,7 @@ class B { constructor(x: T) { return null; } >x : T >T : T ->null : null +>null : B } class C { @@ -20,7 +20,7 @@ class C { constructor(x: T) { return null; } >x : T >T : T ->null : null +>null : C } interface I { @@ -58,7 +58,7 @@ var b = { new(x: T): T { return null; } }; // not a construct signature, func >x : T >T : T >T : T ->null : null +>null : T function foo1b(x: B); >foo1b : { (x: B): any; (x: B): any; } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.types index 181acc2ce91cb..ec02a9349ff84 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.types @@ -11,7 +11,7 @@ class B { constructor(x: T) { return null; } >x : T >T : T ->null : null +>null : B } class C { @@ -22,7 +22,7 @@ class C { constructor(x: T) { return null; } >x : T >T : T ->null : null +>null : C } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.types index b8e7c15c9b551..1aa39aa5fd497 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.types @@ -9,7 +9,7 @@ class B { constructor(x: U) { return null; } >x : U >U : U ->null : null +>null : B } class C { @@ -21,7 +21,7 @@ class C { constructor(x: V) { return null; } >x : V >V : V ->null : null +>null : C } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.types index db188b1b35887..e74a1328393cf 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.types @@ -8,7 +8,7 @@ class B { constructor(x: U) { return null; } >x : U >U : U ->null : null +>null : B } class C { @@ -18,7 +18,7 @@ class C { constructor(x: V) { return null; } >x : V >V : V ->null : null +>null : C } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.types index 027fe3b0043a1..cf94162f66730 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.types @@ -12,7 +12,7 @@ class B { >T : T >y : T >T : T ->null : null +>null : B } class C { @@ -24,7 +24,7 @@ class C { >T : T >y : T >T : T ->null : null +>null : C } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.types index 9a415f6cbf474..04ec2ce98a37d 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.types @@ -13,7 +13,7 @@ class B { >T : T >y : U >U : U ->null : null +>null : B } class C { @@ -26,7 +26,7 @@ class C { >T : T >y : U >U : U ->null : null +>null : C } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.types b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.types index c73d45260f917..e75b16186f5ec 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.types +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.types @@ -13,7 +13,7 @@ class B { >T : T >y : U >U : U ->null : null +>null : B } class C { @@ -26,7 +26,7 @@ class C { >T : T >y : U >U : U ->null : null +>null : C } interface I { diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.types b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.types index 17fc6a07a005a..0836e553d7d0f 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.types +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.types @@ -68,7 +68,7 @@ var b: { [x: number]: Derived; } = { foo: null }; >foo : Derived >null : Derived >Derived : Derived ->null : null +>null : Derived function foo1(x: A); >foo1 : { (x: A): any; (x: A): any; } diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.types b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.types index 814d0c91814f6..2d1b2591182ad 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.types +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.types @@ -68,7 +68,7 @@ var b: { [x: string]: Derived; } = { foo: null }; >foo : Derived >null : Derived >Derived : Derived ->null : null +>null : Derived function foo1(x: A); >foo1 : { (x: A): any; (x: A): any; } diff --git a/tests/baselines/reference/operatorsAndIntersectionTypes.types b/tests/baselines/reference/operatorsAndIntersectionTypes.types index 6b5987d3a69da..f9ad49e8ee3e2 100644 --- a/tests/baselines/reference/operatorsAndIntersectionTypes.types +++ b/tests/baselines/reference/operatorsAndIntersectionTypes.types @@ -28,7 +28,7 @@ function createSerialNo() { let map1: { [x: string]: number } = {}; >map1 : { [x: string]: number; } >x : string ->{} : {} +>{} : { [x: string]: number; } let guid = createGuid(); >guid : string & { $Guid: any; } @@ -45,7 +45,7 @@ map1[guid] = 123; // Can with tagged string let map2: { [x: number]: string } = {}; >map2 : { [x: number]: string; } >x : number ->{} : {} +>{} : { [x: number]: string; } let serialNo = createSerialNo(); >serialNo : number & { $SerialNo: any; } diff --git a/tests/baselines/reference/optionalAccessorsInInterface1.types b/tests/baselines/reference/optionalAccessorsInInterface1.types index d030849e55433..8e96bcfc215db 100644 --- a/tests/baselines/reference/optionalAccessorsInInterface1.types +++ b/tests/baselines/reference/optionalAccessorsInInterface1.types @@ -20,7 +20,7 @@ declare function defineMyProperty(o: any, p: string, attributes: MyPropertyDescr defineMyProperty({}, "name", { get: function () { return 5; } }); >defineMyProperty({}, "name", { get: function () { return 5; } }) : any >defineMyProperty : (o: any, p: string, attributes: MyPropertyDescriptor) => any ->{} : {} +>{} : any >"name" : string >{ get: function () { return 5; } } : { get: () => number; } >get : () => number @@ -48,7 +48,7 @@ declare function defineMyProperty2(o: any, p: string, attributes: MyPropertyDesc defineMyProperty2({}, "name", { get: function () { return 5; } }); >defineMyProperty2({}, "name", { get: function () { return 5; } }) : any >defineMyProperty2 : (o: any, p: string, attributes: MyPropertyDescriptor2) => any ->{} : {} +>{} : any >"name" : string >{ get: function () { return 5; } } : { get: () => number; } >get : () => number diff --git a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.types b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.types index 311cf971b6188..74f305bb462f3 100644 --- a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.types +++ b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.types @@ -105,17 +105,17 @@ var a1 = a.a({}); >a.a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } >a : A >a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } ->{} : {} +>{} : Opt3 var a1 = a({}); >a1 : Opt3 >a({}) : Opt3 >a : A ->{} : {} +>{} : Opt3 var a1 = new a({}); >a1 : Opt3 >new a({}) : Opt3 >a : A ->{} : {} +>{} : Opt3 diff --git a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.types b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.types index e67ff2f8de6a4..2a2bab25117c6 100644 --- a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.types +++ b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.types @@ -108,17 +108,17 @@ var a1 = a.a({}); >a.a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } >a : A >a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } ->{} : {} +>{} : Opt3 var a1 = a({}); >a1 : Opt3 >a({}) : Opt3 >a : A ->{} : {} +>{} : Opt3 var a1 = new a({}); >a1 : Opt3 >new a({}) : Opt3 >a : A ->{} : {} +>{} : Opt3 diff --git a/tests/baselines/reference/overloadEquivalenceWithStatics.types b/tests/baselines/reference/overloadEquivalenceWithStatics.types index 1f59b64572a9b..b5363c6e7e5ae 100644 --- a/tests/baselines/reference/overloadEquivalenceWithStatics.types +++ b/tests/baselines/reference/overloadEquivalenceWithStatics.types @@ -28,7 +28,7 @@ static B(v: any): A1 { >S : S return null; ->null : null +>null : A1 } } diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks1.types b/tests/baselines/reference/overloadOnConstConstraintChecks1.types index 012774b3cc9eb..cacf5f1973a98 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks1.types +++ b/tests/baselines/reference/overloadOnConstConstraintChecks1.types @@ -74,6 +74,6 @@ class D implements MyDoc { >Base : Base return null; ->null : null +>null : Base } } diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks2.types b/tests/baselines/reference/overloadOnConstConstraintChecks2.types index 6102c282a60a3..946cf694f8766 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks2.types +++ b/tests/baselines/reference/overloadOnConstConstraintChecks2.types @@ -34,5 +34,5 @@ function foo(name: any): A { >A : A return null; ->null : null +>null : A } diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks3.types b/tests/baselines/reference/overloadOnConstConstraintChecks3.types index 0348d3d4b79b8..2e2b2515bc2c6 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks3.types +++ b/tests/baselines/reference/overloadOnConstConstraintChecks3.types @@ -36,6 +36,6 @@ function foo(name: any): A { >A : A return null; ->null : null +>null : A } diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks4.types b/tests/baselines/reference/overloadOnConstConstraintChecks4.types index 6ca7288ead9ba..4cb84789eaa14 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks4.types +++ b/tests/baselines/reference/overloadOnConstConstraintChecks4.types @@ -40,6 +40,6 @@ function foo(name: any): Z { >Z : Z return null; ->null : null +>null : Z } diff --git a/tests/baselines/reference/overloadResolutionOverNonCTObjectLit.types b/tests/baselines/reference/overloadResolutionOverNonCTObjectLit.types index e6ff0cda468dc..3f1ba41f378b4 100644 --- a/tests/baselines/reference/overloadResolutionOverNonCTObjectLit.types +++ b/tests/baselines/reference/overloadResolutionOverNonCTObjectLit.types @@ -37,7 +37,7 @@ module Bugs { var tokens:IToken[]= []; >tokens : IToken[] >IToken : IToken ->[] : undefined[] +>[] : IToken[] tokens.push({ startIndex: 1, type: '', bracket: 3 }); >tokens.push({ startIndex: 1, type: '', bracket: 3 }) : number diff --git a/tests/baselines/reference/overloadedStaticMethodSpecialization.types b/tests/baselines/reference/overloadedStaticMethodSpecialization.types index aac8f645687b0..2b370d1c38cd0 100644 --- a/tests/baselines/reference/overloadedStaticMethodSpecialization.types +++ b/tests/baselines/reference/overloadedStaticMethodSpecialization.types @@ -28,7 +28,7 @@ class A { >S : S return null; ->null : null +>null : A } } diff --git a/tests/baselines/reference/parenthesizedContexualTyping1.types b/tests/baselines/reference/parenthesizedContexualTyping1.types index 61ec1a24ec5bb..d0ff5c36f74ea 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping1.types +++ b/tests/baselines/reference/parenthesizedContexualTyping1.types @@ -162,7 +162,7 @@ var i = fun((Math.random() < 0.5 ? x => x : x => undefined), 10); >x : number >x => undefined : (x: number) => any >x : number ->undefined : undefined +>undefined : number >10 : number var j = fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), 10); @@ -184,7 +184,7 @@ var j = fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), 10); >(x => undefined) : (x: number) => any >x => undefined : (x: number) => any >x : number ->undefined : undefined +>undefined : number >10 : number var k = fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), x => x, 10); @@ -206,7 +206,7 @@ var k = fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), x => x, 10); >(x => undefined) : (x: number) => any >x => undefined : (x: number) => any >x : number ->undefined : undefined +>undefined : number >x => x : (x: number) => number >x : number >x : number @@ -234,7 +234,7 @@ var l = fun(((Math.random() < 0.5 ? ((x => x)) : ((x => undefined)))), ((x => x) >(x => undefined) : (x: number) => any >x => undefined : (x: number) => any >x : number ->undefined : undefined +>undefined : number >((x => x)) : (x: number) => number >(x => x) : (x: number) => number >x => x : (x: number) => number @@ -267,39 +267,39 @@ type ObjType = { x: (p: number) => string; y: (p: string) => number }; var obj1: ObjType = { x: x => (x, undefined), y: y => (y, undefined) }; >obj1 : { x: (p: number) => string; y: (p: string) => number; } >ObjType : { x: (p: number) => string; y: (p: string) => number; } ->{ x: x => (x, undefined), y: y => (y, undefined) } : { x: (x: number) => any; y: (y: string) => any; } ->x : (x: number) => any ->x => (x, undefined) : (x: number) => any +>{ x: x => (x, undefined), y: y => (y, undefined) } : { x: (x: number) => string; y: (y: string) => number; } +>x : (x: number) => string +>x => (x, undefined) : (x: number) => string >x : number ->(x, undefined) : undefined ->x, undefined : undefined +>(x, undefined) : string +>x, undefined : string >x : number ->undefined : undefined ->y : (y: string) => any ->y => (y, undefined) : (y: string) => any +>undefined : string +>y : (y: string) => number +>y => (y, undefined) : (y: string) => number >y : string ->(y, undefined) : undefined ->y, undefined : undefined +>(y, undefined) : number +>y, undefined : number >y : string ->undefined : undefined +>undefined : number var obj2: ObjType = ({ x: x => (x, undefined), y: y => (y, undefined) }); >obj2 : { x: (p: number) => string; y: (p: string) => number; } >ObjType : { x: (p: number) => string; y: (p: string) => number; } ->({ x: x => (x, undefined), y: y => (y, undefined) }) : { x: (x: number) => any; y: (y: string) => any; } ->{ x: x => (x, undefined), y: y => (y, undefined) } : { x: (x: number) => any; y: (y: string) => any; } ->x : (x: number) => any ->x => (x, undefined) : (x: number) => any +>({ x: x => (x, undefined), y: y => (y, undefined) }) : { x: (x: number) => string; y: (y: string) => number; } +>{ x: x => (x, undefined), y: y => (y, undefined) } : { x: (x: number) => string; y: (y: string) => number; } +>x : (x: number) => string +>x => (x, undefined) : (x: number) => string >x : number ->(x, undefined) : undefined ->x, undefined : undefined +>(x, undefined) : string +>x, undefined : string >x : number ->undefined : undefined ->y : (y: string) => any ->y => (y, undefined) : (y: string) => any +>undefined : string +>y : (y: string) => number +>y => (y, undefined) : (y: string) => number >y : string ->(y, undefined) : undefined ->y, undefined : undefined +>(y, undefined) : number +>y, undefined : number >y : string ->undefined : undefined +>undefined : number diff --git a/tests/baselines/reference/parenthesizedContexualTyping2.types b/tests/baselines/reference/parenthesizedContexualTyping2.types index a055f2f1bbd6f..63717941fe008 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping2.types +++ b/tests/baselines/reference/parenthesizedContexualTyping2.types @@ -41,7 +41,7 @@ function fun(...rest: any[]): T { >T : T return undefined; ->undefined : undefined +>undefined : T } var a = fun(x => { x(undefined); return x; }, 10); @@ -52,7 +52,7 @@ var a = fun(x => { x(undefined); return x; }, 10); >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >10 : number @@ -65,7 +65,7 @@ var b = fun((x => { x(undefined); return x; }), 10); >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >10 : number @@ -79,7 +79,7 @@ var c = fun(((x => { x(undefined); return x; })), 10); >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >10 : number @@ -94,7 +94,7 @@ var d = fun((((x => { x(undefined); return x; }))), 10); >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >10 : number @@ -106,13 +106,13 @@ var e = fun(x => { x(undefined); return x; }, x => { x(undefined >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >x => { x(undefined); return x; } : (x: (p: T) => T) => (p: T) => T >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >10 : number @@ -125,14 +125,14 @@ var f = fun((x => { x(undefined); return x; }),(x => { x(undefin >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >(x => { x(undefined); return x; }) : (x: (p: T) => T) => (p: T) => T >x => { x(undefined); return x; } : (x: (p: T) => T) => (p: T) => T >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >10 : number @@ -146,7 +146,7 @@ var g = fun(((x => { x(undefined); return x; })),((x => { x(unde >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >((x => { x(undefined); return x; })) : (x: (p: T) => T) => (p: T) => T >(x => { x(undefined); return x; }) : (x: (p: T) => T) => (p: T) => T @@ -154,7 +154,7 @@ var g = fun(((x => { x(undefined); return x; })),((x => { x(unde >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >10 : number @@ -169,7 +169,7 @@ var h = fun((((x => { x(undefined); return x; }))),((x => { x(un >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >((x => { x(undefined); return x; })) : (x: (p: T) => T) => (p: T) => T >(x => { x(undefined); return x; }) : (x: (p: T) => T) => (p: T) => T @@ -177,7 +177,7 @@ var h = fun((((x => { x(undefined); return x; }))),((x => { x(un >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >10 : number @@ -198,11 +198,11 @@ var i = fun((Math.random() < 0.5 ? x => { x(undefined); return x; } : x >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >x => undefined : (x: (p: T) => T) => any >x : (p: T) => T ->undefined : undefined +>undefined : (p: T) => T >10 : number var j = fun((Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)), 10); @@ -222,12 +222,12 @@ var j = fun((Math.random() < 0.5 ? (x => { x(undefined); return x; }) : >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >(x => undefined) : (x: (p: T) => T) => any >x => undefined : (x: (p: T) => T) => any >x : (p: T) => T ->undefined : undefined +>undefined : (p: T) => T >10 : number var k = fun((Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)), x => { x(undefined); return x; }, 10); @@ -247,17 +247,17 @@ var k = fun((Math.random() < 0.5 ? (x => { x(undefined); return x; }) : >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >(x => undefined) : (x: (p: T) => T) => any >x => undefined : (x: (p: T) => T) => any >x : (p: T) => T ->undefined : undefined +>undefined : (p: T) => T >x => { x(undefined); return x; } : (x: (p: T) => T) => (p: T) => T >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >10 : number @@ -280,20 +280,20 @@ var l = fun(((Math.random() < 0.5 ? ((x => { x(undefined); return x; })) >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >((x => undefined)) : (x: (p: T) => T) => any >(x => undefined) : (x: (p: T) => T) => any >x => undefined : (x: (p: T) => T) => any >x : (p: T) => T ->undefined : undefined +>undefined : (p: T) => T >((x => { x(undefined); return x; })) : (x: (p: T) => T) => (p: T) => T >(x => { x(undefined); return x; }) : (x: (p: T) => T) => (p: T) => T >x => { x(undefined); return x; } : (x: (p: T) => T) => (p: T) => T >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >10 : number @@ -304,7 +304,7 @@ var lambda1: FuncType = x => { x(undefined); return x; }; >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T var lambda2: FuncType = (x => { x(undefined); return x; }); @@ -315,7 +315,7 @@ var lambda2: FuncType = (x => { x(undefined); return x; }); >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T type ObjType = { x: (p: number) => string; y: (p: string) => number }; @@ -328,39 +328,39 @@ type ObjType = { x: (p: number) => string; y: (p: string) => number }; var obj1: ObjType = { x: x => (x, undefined), y: y => (y, undefined) }; >obj1 : { x: (p: number) => string; y: (p: string) => number; } >ObjType : { x: (p: number) => string; y: (p: string) => number; } ->{ x: x => (x, undefined), y: y => (y, undefined) } : { x: (x: number) => any; y: (y: string) => any; } ->x : (x: number) => any ->x => (x, undefined) : (x: number) => any +>{ x: x => (x, undefined), y: y => (y, undefined) } : { x: (x: number) => string; y: (y: string) => number; } +>x : (x: number) => string +>x => (x, undefined) : (x: number) => string >x : number ->(x, undefined) : undefined ->x, undefined : undefined +>(x, undefined) : string +>x, undefined : string >x : number ->undefined : undefined ->y : (y: string) => any ->y => (y, undefined) : (y: string) => any +>undefined : string +>y : (y: string) => number +>y => (y, undefined) : (y: string) => number >y : string ->(y, undefined) : undefined ->y, undefined : undefined +>(y, undefined) : number +>y, undefined : number >y : string ->undefined : undefined +>undefined : number var obj2: ObjType = ({ x: x => (x, undefined), y: y => (y, undefined) }); >obj2 : { x: (p: number) => string; y: (p: string) => number; } >ObjType : { x: (p: number) => string; y: (p: string) => number; } ->({ x: x => (x, undefined), y: y => (y, undefined) }) : { x: (x: number) => any; y: (y: string) => any; } ->{ x: x => (x, undefined), y: y => (y, undefined) } : { x: (x: number) => any; y: (y: string) => any; } ->x : (x: number) => any ->x => (x, undefined) : (x: number) => any +>({ x: x => (x, undefined), y: y => (y, undefined) }) : { x: (x: number) => string; y: (y: string) => number; } +>{ x: x => (x, undefined), y: y => (y, undefined) } : { x: (x: number) => string; y: (y: string) => number; } +>x : (x: number) => string +>x => (x, undefined) : (x: number) => string >x : number ->(x, undefined) : undefined ->x, undefined : undefined +>(x, undefined) : string +>x, undefined : string >x : number ->undefined : undefined ->y : (y: string) => any ->y => (y, undefined) : (y: string) => any +>undefined : string +>y : (y: string) => number +>y => (y, undefined) : (y: string) => number >y : string ->(y, undefined) : undefined ->y, undefined : undefined +>(y, undefined) : number +>y, undefined : number >y : string ->undefined : undefined +>undefined : number diff --git a/tests/baselines/reference/parenthesizedContexualTyping3.types b/tests/baselines/reference/parenthesizedContexualTyping3.types index 5d424e5a7b0d1..4a7f4485b6bb8 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping3.types +++ b/tests/baselines/reference/parenthesizedContexualTyping3.types @@ -161,5 +161,5 @@ var h = tempFun `${ (x => x) } ${ (((x => x))) } ${ undefined }` >x => x : (x: any) => any >x : any >x : any ->undefined : undefined +>undefined : any diff --git a/tests/baselines/reference/parserModule1.types b/tests/baselines/reference/parserModule1.types index 2d3b670aaa6f3..baa67d5ec8963 100644 --- a/tests/baselines/reference/parserModule1.types +++ b/tests/baselines/reference/parserModule1.types @@ -17,7 +17,7 @@ export var diagnosticWriter: IDiagnosticWriter = null; >diagnosticWriter : IDiagnosticWriter >IDiagnosticWriter : IDiagnosticWriter ->null : null +>null : IDiagnosticWriter export var analysisPass: number = 0; >analysisPass : number diff --git a/tests/baselines/reference/privacyCheckAnonymousFunctionParameter.types b/tests/baselines/reference/privacyCheckAnonymousFunctionParameter.types index c8e4d237091ab..6781f553a7367 100644 --- a/tests/baselines/reference/privacyCheckAnonymousFunctionParameter.types +++ b/tests/baselines/reference/privacyCheckAnonymousFunctionParameter.types @@ -22,7 +22,7 @@ module Query { >T : T return null; ->null : null +>null : Iterator } function fromOrderBy() { diff --git a/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.types b/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.types index 445e318c0fb67..f986bf8c8045e 100644 --- a/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.types +++ b/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.types @@ -34,6 +34,6 @@ module Q { foo(null); >foo(null) : (a: Iterator<{}>) => number >foo : (x: (a: Iterator) => number) => (a: Iterator) => number ->null : null +>null : (a: Iterator<{}>) => number } } diff --git a/tests/baselines/reference/privacyCheckExportAssignmentOnExportedGenericInterface2.types b/tests/baselines/reference/privacyCheckExportAssignmentOnExportedGenericInterface2.types index ce785983ce87f..6eaf6e3525acd 100644 --- a/tests/baselines/reference/privacyCheckExportAssignmentOnExportedGenericInterface2.types +++ b/tests/baselines/reference/privacyCheckExportAssignmentOnExportedGenericInterface2.types @@ -16,7 +16,7 @@ function Foo(array: T[]): Foo { >T : T return undefined; ->undefined : undefined +>undefined : Foo } module Foo { diff --git a/tests/baselines/reference/promiseTest.types b/tests/baselines/reference/promiseTest.types index 5ec43b9f42b39..ac117d98239a4 100644 --- a/tests/baselines/reference/promiseTest.types +++ b/tests/baselines/reference/promiseTest.types @@ -33,7 +33,7 @@ interface Promise { var p: Promise = null; >p : Promise >Promise : Promise ->null : null +>null : Promise var p2 = p.then(function (x) { >p2 : Promise diff --git a/tests/baselines/reference/propertyNameWithoutTypeAnnotation.types b/tests/baselines/reference/propertyNameWithoutTypeAnnotation.types index 9bc56de386771..b592e9aced562 100644 --- a/tests/baselines/reference/propertyNameWithoutTypeAnnotation.types +++ b/tests/baselines/reference/propertyNameWithoutTypeAnnotation.types @@ -44,7 +44,7 @@ var r2 = (null).foo; >(null) : I >null : I >I : I ->null : null +>null : I >foo : any var r3 = a.foo; diff --git a/tests/baselines/reference/protoInIndexer.types b/tests/baselines/reference/protoInIndexer.types index bfafc56404ae4..515ae4d7b8385 100644 --- a/tests/baselines/reference/protoInIndexer.types +++ b/tests/baselines/reference/protoInIndexer.types @@ -4,10 +4,10 @@ class X { constructor() { this['__proto__'] = null; // used to cause ICE ->this['__proto__'] = null : null +>this['__proto__'] = null : any >this['__proto__'] : any >this : this >'__proto__' : string ->null : null +>null : any } } diff --git a/tests/baselines/reference/reExportUndefined2.types b/tests/baselines/reference/reExportUndefined2.types index d3f3dc9d7263a..be58a8d002d97 100644 --- a/tests/baselines/reference/reExportUndefined2.types +++ b/tests/baselines/reference/reExportUndefined2.types @@ -17,5 +17,5 @@ declare function use(a: number); use(undefined); >use(undefined) : any >use : (a: number) => any ->undefined : any +>undefined : number diff --git a/tests/baselines/reference/recursiveComplicatedClasses.types b/tests/baselines/reference/recursiveComplicatedClasses.types index 1bb48a3c0c9ce..ea39f5792b2b6 100644 --- a/tests/baselines/reference/recursiveComplicatedClasses.types +++ b/tests/baselines/reference/recursiveComplicatedClasses.types @@ -5,7 +5,7 @@ class Signature { public parameters: ParameterSymbol[] = null; >parameters : ParameterSymbol[] >ParameterSymbol : ParameterSymbol ->null : null +>null : ParameterSymbol[] } function aEnclosesB(a: Symbol) { diff --git a/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.types b/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.types index b800b2641fefd..5502476af7c93 100644 --- a/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.types +++ b/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.types @@ -133,7 +133,7 @@ function other, U>() { >foo5 : { (x: T): string; (x: List): number; (x: MyList): boolean; } >V : V >x : any ->null : null +>null : any var list: List; >list : List diff --git a/tests/baselines/reference/requiredInitializedParameter2.errors.txt b/tests/baselines/reference/requiredInitializedParameter2.errors.txt index 5dcec536e1b67..48994b9fc32f0 100644 --- a/tests/baselines/reference/requiredInitializedParameter2.errors.txt +++ b/tests/baselines/reference/requiredInitializedParameter2.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/requiredInitializedParameter2.ts(5,7): error TS2420: Class 'C1' incorrectly implements interface 'I1'. Types of property 'method' are incompatible. - Type '(a: number, b: any) => void' is not assignable to type '() => any'. + Type '(a: any, b: any) => void' is not assignable to type '() => any'. ==== tests/cases/compiler/requiredInitializedParameter2.ts (1 errors) ==== @@ -12,6 +12,6 @@ tests/cases/compiler/requiredInitializedParameter2.ts(5,7): error TS2420: Class ~~ !!! error TS2420: Class 'C1' incorrectly implements interface 'I1'. !!! error TS2420: Types of property 'method' are incompatible. -!!! error TS2420: Type '(a: number, b: any) => void' is not assignable to type '() => any'. +!!! error TS2420: Type '(a: any, b: any) => void' is not assignable to type '() => any'. method(a = 0, b) { } } \ No newline at end of file diff --git a/tests/baselines/reference/requiredInitializedParameter3.js b/tests/baselines/reference/requiredInitializedParameter3.js index 983955b79e832..231ab46ec6d97 100644 --- a/tests/baselines/reference/requiredInitializedParameter3.js +++ b/tests/baselines/reference/requiredInitializedParameter3.js @@ -23,5 +23,5 @@ interface I1 { method(): any; } declare class C1 implements I1 { - method(a?: number, b?: any): void; + method(a?: any, b?: any): void; } diff --git a/tests/baselines/reference/requiredInitializedParameter3.types b/tests/baselines/reference/requiredInitializedParameter3.types index aa37f5e13ddb3..9c30188f2b729 100644 --- a/tests/baselines/reference/requiredInitializedParameter3.types +++ b/tests/baselines/reference/requiredInitializedParameter3.types @@ -11,8 +11,8 @@ class C1 implements I1 { >I1 : I1 method(a = 0, b?) { } ->method : (a?: number, b?: any) => void ->a : number +>method : (a?: any, b?: any) => void +>a : any >0 : number >b : any } diff --git a/tests/baselines/reference/returnStatements.types b/tests/baselines/reference/returnStatements.types index e5332b2e6acbd..771f459eea6b1 100644 --- a/tests/baselines/reference/returnStatements.types +++ b/tests/baselines/reference/returnStatements.types @@ -10,7 +10,7 @@ function fn2(): string { return ''; } function fn3(): void { return undefined; } >fn3 : () => void ->undefined : undefined +>undefined : void function fn4(): void { return; } >fn4 : () => void @@ -28,7 +28,7 @@ function fn6(): Date { return new Date(12); } function fn7(): any { return null; } >fn7 : () => any ->null : null +>null : any function fn8(): any { return; } // OK, eq. to 'return undefined' >fn8 : () => any @@ -76,5 +76,5 @@ function fn12(): C { return new D(); } function fn13(): C { return null; } >fn13 : () => C >C : C ->null : null +>null : C diff --git a/tests/baselines/reference/sigantureIsSubTypeIfTheyAreIdentical.types b/tests/baselines/reference/sigantureIsSubTypeIfTheyAreIdentical.types index 181effe4f9059..e2df20e6bd82c 100644 --- a/tests/baselines/reference/sigantureIsSubTypeIfTheyAreIdentical.types +++ b/tests/baselines/reference/sigantureIsSubTypeIfTheyAreIdentical.types @@ -19,6 +19,6 @@ class CacheService implements ICache { // Should not error that property type of >T : T return undefined; ->undefined : undefined +>undefined : T } } diff --git a/tests/baselines/reference/sourceMapValidationClasses.types b/tests/baselines/reference/sourceMapValidationClasses.types index 5b3512c06c16d..af647cd6cb8ff 100644 --- a/tests/baselines/reference/sourceMapValidationClasses.types +++ b/tests/baselines/reference/sourceMapValidationClasses.types @@ -60,7 +60,7 @@ module Foo.Bar { var greeters: Greeter[] = []; /* inline block comment */ >greeters : Greeter[] >Greeter : Greeter ->[] : undefined[] +>[] : Greeter[] greeters[0] = new Greeter(greeting); >greeters[0] = new Greeter(greeting) : Greeter diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.types b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.types index 253c5feae8fbf..a67201de185bc 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.types +++ b/tests/baselines/reference/sourceMapValidationDestructuringParameterObjectBindingPatternDefaultValues.types @@ -34,7 +34,7 @@ function foo1({ name: nameA = "" }: Robot = { }) { >nameA : string >"" : string >Robot : Robot ->{ } : {} +>{ } : Robot console.log(nameA); >console.log(nameA) : void @@ -52,7 +52,7 @@ function foo2({ name: nameB = "", skill: skillB = "noSkill" }: Robot = { >skillB : string >"noSkill" : string >Robot : Robot ->{} : {} +>{} : Robot console.log(nameB); >console.log(nameB) : void @@ -66,7 +66,7 @@ function foo3({ name = "" }: Robot = {}) { >name : string >"" : string >Robot : Robot ->{} : {} +>{} : Robot console.log(name); >console.log(name) : void diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.types index 7edf6c63e4aed..93fc6bfda4d62 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.types +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.types @@ -97,30 +97,30 @@ let multiRobotAInfo: (string | string[])[]; [, multiSkillB = []] = multiRobotB; >[, multiSkillB = []] = multiRobotB : [string, string[]] ->[, multiSkillB = []] : [undefined, undefined[]] +>[, multiSkillB = []] : [undefined, string[]] > : undefined ->multiSkillB = [] : undefined[] +>multiSkillB = [] : string[] >multiSkillB : string[] ->[] : undefined[] +>[] : string[] >multiRobotB : [string, string[]] [, multiSkillB = []] = getMultiRobotB(); >[, multiSkillB = []] = getMultiRobotB() : [string, string[]] ->[, multiSkillB = []] : [undefined, undefined[]] +>[, multiSkillB = []] : [undefined, string[]] > : undefined ->multiSkillB = [] : undefined[] +>multiSkillB = [] : string[] >multiSkillB : string[] ->[] : undefined[] +>[] : string[] >getMultiRobotB() : [string, string[]] >getMultiRobotB : () => [string, string[]] [, multiSkillB = []] = ["roomba", ["vaccum", "mopping"]]; >[, multiSkillB = []] = ["roomba", ["vaccum", "mopping"]] : [string, string[]] ->[, multiSkillB = []] : [undefined, undefined[]] +>[, multiSkillB = []] : [undefined, string[]] > : undefined ->multiSkillB = [] : undefined[] +>multiSkillB = [] : string[] >multiSkillB : string[] ->[] : undefined[] +>[] : string[] >["roomba", ["vaccum", "mopping"]] : [string, string[]] >"roomba" : string >["vaccum", "mopping"] : string[] diff --git a/tests/baselines/reference/specializeVarArgs1.types b/tests/baselines/reference/specializeVarArgs1.types index 97b46876e6687..274b8b54064a6 100644 --- a/tests/baselines/reference/specializeVarArgs1.types +++ b/tests/baselines/reference/specializeVarArgs1.types @@ -27,7 +27,7 @@ function observableArray(): ObservableArray { return null;} >T : T >ObservableArray : ObservableArray >T : T ->null : null +>null : ObservableArray diff --git a/tests/baselines/reference/specializedOverloadWithRestParameters.types b/tests/baselines/reference/specializedOverloadWithRestParameters.types index 1f7fd391ec741..4b4bed3dc92d0 100644 --- a/tests/baselines/reference/specializedOverloadWithRestParameters.types +++ b/tests/baselines/reference/specializedOverloadWithRestParameters.types @@ -26,7 +26,7 @@ function f(tagName: any): Base { >Base : Base return null; ->null : null +>null : Base } function g(tagName: 'span', arg): Derived1; // error >g : { (tagName: "span", arg: any): Derived1; (tagName: number, arg: any): Base; } @@ -46,5 +46,5 @@ function g(tagName: any): Base { >Base : Base return null; ->null : null +>null : Base } diff --git a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types index 90148bdbb1974..ef008517e100d 100644 --- a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types +++ b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types @@ -121,7 +121,7 @@ namespace tessst { } } return undefined; ->undefined : undefined +>undefined : U } } interface Scanner { @@ -217,7 +217,7 @@ class ListWrapper { if (!array) return null; >!array : boolean >array : T[] ->null : null +>null : T return array[0]; >array[0] : T @@ -242,7 +242,7 @@ class ListWrapper { >array : T[] >length : number >0 : number ->null : null +>null : T return array[array.length - 1]; >array[array.length - 1] : T @@ -507,7 +507,7 @@ class ListWrapper { >start : number >0 : number >end : number ->null : null +>null : number list.fill(value, start, end === null ? list.length : end); >list.fill(value, start, end === null ? list.length : end) : void @@ -576,7 +576,7 @@ class ListWrapper { >from : number >0 : number >to : number ->null : null +>null : number >T : T return l.slice(from, to === null ? undefined : to); @@ -589,7 +589,7 @@ class ListWrapper { >to === null : boolean >to : number >null : null ->undefined : undefined +>undefined : number >to : number } static splice(dit: typeof ListWrapper, l: T[], from: number, length: number): T[] { return l.splice(from, length); } @@ -687,12 +687,12 @@ class ListWrapper { >0 : number return null; ->null : null +>null : T } var solution: T = null; >solution : T >T : T ->null : null +>null : T var maxValue = -Infinity; >maxValue : number diff --git a/tests/baselines/reference/staticInstanceResolution3.types b/tests/baselines/reference/staticInstanceResolution3.types index fe50c659f6d5c..53e8ceb2bb21c 100644 --- a/tests/baselines/reference/staticInstanceResolution3.types +++ b/tests/baselines/reference/staticInstanceResolution3.types @@ -22,7 +22,7 @@ export class Promise { >Promise : Promise return null; ->null : null +>null : Promise } } diff --git a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.types b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.types index e518547617350..a768b62c42d99 100644 --- a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.types +++ b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.types @@ -121,93 +121,93 @@ class C implements String { toString(): string { return null; } >toString : () => string ->null : null +>null : string charAt(pos: number): string { return null; } >charAt : (pos: number) => string >pos : number ->null : null +>null : string charCodeAt(index: number): number { return null; } >charCodeAt : (index: number) => number >index : number ->null : null +>null : number concat(...strings: string[]): string { return null; } >concat : (...strings: string[]) => string >strings : string[] ->null : null +>null : string indexOf(searchString: string, position?: number): number { return null; } >indexOf : (searchString: string, position?: number) => number >searchString : string >position : number ->null : null +>null : number lastIndexOf(searchString: string, position?: number): number { return null; } >lastIndexOf : (searchString: string, position?: number) => number >searchString : string >position : number ->null : null +>null : number localeCompare(that: string): number { return null; } >localeCompare : (that: string) => number >that : string ->null : null +>null : number match(regexp: any): string[] { return null; } >match : (regexp: any) => string[] >regexp : any ->null : null +>null : string[] replace(searchValue: any, replaceValue: any): string { return null; } >replace : (searchValue: any, replaceValue: any) => string >searchValue : any >replaceValue : any ->null : null +>null : string search(regexp: any): number { return null; } >search : (regexp: any) => number >regexp : any ->null : null +>null : number slice(start?: number, end?: number): string { return null; } >slice : (start?: number, end?: number) => string >start : number >end : number ->null : null +>null : string split(separator: any, limit?: number): string[] { return null; } >split : (separator: any, limit?: number) => string[] >separator : any >limit : number ->null : null +>null : string[] substring(start: number, end?: number): string { return null; } >substring : (start: number, end?: number) => string >start : number >end : number ->null : null +>null : string toLowerCase(): string { return null; } >toLowerCase : () => string ->null : null +>null : string toLocaleLowerCase(): string { return null; } >toLocaleLowerCase : () => string ->null : null +>null : string toUpperCase(): string { return null; } >toUpperCase : () => string ->null : null +>null : string toLocaleUpperCase(): string { return null; } >toLocaleUpperCase : () => string ->null : null +>null : string trim(): string { return null; } >trim : () => string ->null : null +>null : string length: number; >length : number @@ -216,11 +216,11 @@ class C implements String { >substr : (from: number, length?: number) => string >from : number >length : number ->null : null +>null : string valueOf(): string { return null; } >valueOf : () => string ->null : null +>null : string [index: number]: string; >index : number diff --git a/tests/baselines/reference/stringLiteralTypesOverloads03.types b/tests/baselines/reference/stringLiteralTypesOverloads03.types index 643979ee987ca..b547312a730ac 100644 --- a/tests/baselines/reference/stringLiteralTypesOverloads03.types +++ b/tests/baselines/reference/stringLiteralTypesOverloads03.types @@ -68,7 +68,7 @@ function f(...args: any[]): any { >args : any[] return undefined; ->undefined : undefined +>undefined : any } let fResult1 = f(hello); @@ -114,7 +114,7 @@ function g(...args: any[]): any { >args : any[] return undefined; ->undefined : undefined +>undefined : any } let gResult1 = g(hello); diff --git a/tests/baselines/reference/subtypingWithCallSignatures2.types b/tests/baselines/reference/subtypingWithCallSignatures2.types index b72993e7bea1c..8d63365da8f91 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures2.types +++ b/tests/baselines/reference/subtypingWithCallSignatures2.types @@ -454,7 +454,7 @@ var r5arg1 = (x: (arg: T) => U) => null; >U : U >null : T >T : T ->null : null +>null : T var r5arg2 = (x: (arg: string) => number) => ''; >r5arg2 : (x: (arg: string) => number) => string @@ -494,7 +494,7 @@ var r6arg1 = (x: (arg: T) => U) => null; >U : U >null : T >T : T ->null : null +>null : T var r6arg2 = (x: (arg: Base) => Derived) => null; >r6arg2 : (x: (arg: Base) => Derived) => Base @@ -505,7 +505,7 @@ var r6arg2 = (x: (arg: Base) => Derived) => null; >Derived : Derived >null : Base >Base : Base ->null : null +>null : Base var r6 = foo6(r6arg1); // any >r6 : any @@ -541,7 +541,7 @@ var r7arg1 = (x: (arg: T) => U) => (r: T) => >T : T >null : U >U : U ->null : null +>null : U var r7arg2 = (x: (arg: Base) => Derived) => (r: Base) => null; >r7arg2 : (x: (arg: Base) => Derived) => (r: Base) => Derived @@ -555,7 +555,7 @@ var r7arg2 = (x: (arg: Base) => Derived) => (r: Base) => null; >Base : Base >null : Derived >Derived : Derived ->null : null +>null : Derived var r7 = foo7(r7arg1); // any >r7 : any @@ -595,7 +595,7 @@ var r8arg1 = (x: (arg: T) => U, y: (arg2: T) >T : T >null : U >U : U ->null : null +>null : U var r8arg2 = (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => null; >r8arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived @@ -613,7 +613,7 @@ var r8arg2 = (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base >Base : Base >null : Derived >Derived : Derived ->null : null +>null : Derived var r8 = foo8(r8arg1); // any >r8 : any @@ -654,7 +654,7 @@ var r9arg1 = (x: (arg: T) => U, y: (arg2: { f >T : T >null : U >U : U ->null : null +>null : U var r9arg2 = (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => null; >r9arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived @@ -672,7 +672,7 @@ var r9arg2 = (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base >Base : Base >null : Derived >Derived : Derived ->null : null +>null : Derived var r9 = foo9(r9arg1); // any >r9 : any @@ -710,7 +710,7 @@ var r10arg2 = (...x: Derived[]) => null; >Derived : Derived >null : Derived >Derived : Derived ->null : null +>null : Derived var r10 = foo10(r10arg1); // any >r10 : any @@ -751,7 +751,7 @@ var r11arg2 = (x: { foo: string }, y: { foo: string; bar: string }) => nul >bar : string >null : Base >Base : Base ->null : null +>null : Base var r11 = foo11(r11arg1); // any >r11 : any @@ -785,7 +785,7 @@ var r12arg1 = >(x: Array, y: T) => >n >>null : Derived[] >Array : T[] >Derived : Derived ->null : null +>null : Derived[] var r12arg2 = (x: Array, y: Array) => >null; >r12arg2 : (x: Base[], y: Derived2[]) => Derived[] @@ -799,7 +799,7 @@ var r12arg2 = (x: Array, y: Array) => >null; >>null : Derived[] >Array : T[] >Derived : Derived ->null : null +>null : Derived[] var r12 = foo12(r12arg1); // any >r12 : (x: Base[], y: Derived2[]) => Derived[] @@ -844,7 +844,7 @@ var r13arg2 = (x: Array, y: Array) => >null; >>null : Derived[] >Array : T[] >Derived : Derived ->null : null +>null : Derived[] var r13 = foo13(r13arg1); // any >r13 : any @@ -885,7 +885,7 @@ var r14arg2 = (x: { a: string; b: number }) => null; >b : number >null : Object >Object : Object ->null : null +>null : Object var r14 = foo14(r14arg1); // any >r14 : any @@ -913,7 +913,7 @@ var r15arg1 = (x: T) => null >T : T >null : T[] >T : T ->null : null +>null : T[] var r15 = foo15(r15arg1); // any >r15 : any @@ -947,7 +947,7 @@ var r17arg1 = (x: (a: T) => T) => null; >T : T >null : T[] >T : T ->null : null +>null : T[] var r17 = foo17(r17arg1); // any >r17 : any @@ -965,7 +965,7 @@ var r18arg1 = (x: (a: T) => T) => null; >T : T >null : T[] >T : T ->null : null +>null : T[] var r18 = foo18(r18arg1); >r18 : { (x: { (a: number): number; (a: string): string; }): any[]; (x: { (a: boolean): boolean; (a: Date): Date; }): any[]; } diff --git a/tests/baselines/reference/subtypingWithCallSignatures3.types b/tests/baselines/reference/subtypingWithCallSignatures3.types index 2d4c6e9fda572..106c11871db01 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures3.types +++ b/tests/baselines/reference/subtypingWithCallSignatures3.types @@ -216,7 +216,7 @@ module Errors { >T : T >null : U[] >U : U ->null : null +>null : U[] var r1a = [(x: number) => [''], (x: T) => null]; >r1a : ((x: T) => U[])[] @@ -232,7 +232,7 @@ module Errors { >T : T >null : U[] >U : U ->null : null +>null : U[] var r1b = [(x: T) => null, (x: number) => ['']]; >r1b : ((x: T) => U[])[] @@ -244,7 +244,7 @@ module Errors { >T : T >null : U[] >U : U ->null : null +>null : U[] >(x: number) => [''] : (x: number) => string[] >x : number >[''] : string[] @@ -268,7 +268,7 @@ module Errors { >T : T >null : V >V : V ->null : null +>null : V var r2arg2 = (x: (arg: Base) => Derived) => (r: Base) => null; >r2arg2 : (x: (arg: Base) => Derived) => (r: Base) => Derived2 @@ -282,7 +282,7 @@ module Errors { >Base : Base >null : Derived2 >Derived2 : Derived2 ->null : null +>null : Derived2 var r2 = foo7(r2arg); // any >r2 : any @@ -322,7 +322,7 @@ module Errors { >T : T >null : U >U : U ->null : null +>null : U var r3arg2 = (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => null; >r3arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived @@ -340,7 +340,7 @@ module Errors { >Base : Base >null : Derived >Derived : Derived ->null : null +>null : Derived var r3 = foo8(r3arg); // any >r3 : any @@ -369,7 +369,7 @@ module Errors { >T : T >null : T >T : T ->null : null +>null : T var r4arg2 = (...x: Base[]) => null; >r4arg2 : (...x: Base[]) => Base @@ -378,7 +378,7 @@ module Errors { >Base : Base >null : Base >Base : Base ->null : null +>null : Base var r4 = foo10(r4arg); // any >r4 : any @@ -409,7 +409,7 @@ module Errors { >T : T >null : T >T : T ->null : null +>null : T var r5arg2 = (x: { foo: string }, y: { foo: string; bar: string }) => null; >r5arg2 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base @@ -421,7 +421,7 @@ module Errors { >bar : string >null : Base >Base : Base ->null : null +>null : Base var r5 = foo11(r5arg); // any >r5 : any @@ -453,7 +453,7 @@ module Errors { >>null : Derived[] >Array : T[] >Derived : Derived ->null : null +>null : Derived[] var r6arg2 = >(x: Array, y: Array) => null; >r6arg2 : (x: Base[], y: Base[]) => T @@ -469,7 +469,7 @@ module Errors { >Base : Base >null : T >T : T ->null : null +>null : T var r6 = foo12(r6arg); // (x: Array, y: Array) => Array >r6 : (x: Base[], y: Derived2[]) => Derived[] @@ -500,7 +500,7 @@ module Errors { >T : T >null : T >T : T ->null : null +>null : T var r7arg2 = (x: { a: string; b: number }) => 1; >r7arg2 : (x: { a: string; b: number; }) => number @@ -568,7 +568,7 @@ module Errors { >T : T >null : T[] >T : T ->null : null +>null : T[] var r8 = foo16(r8arg); // any >r8 : any @@ -585,7 +585,7 @@ module Errors { >T : T >T : T >null : any[] ->null : null +>null : any[] var r9 = foo17(r9arg); // (x: { (a: T): T; (a: T): T; }): any[]; (x: { (a: T): T; (a: T): T; }): any[]; >r9 : { (x: { (a: T): T; (a: T): T; }): any[]; (x: { (a: T): T; (a: T): T; }): any[]; } @@ -645,7 +645,7 @@ module WithGenericSignaturesInBaseType { >T : T >null : T[] >T : T ->null : null +>null : T[] var r3 = foo3(r3arg2); // any >r3 : any diff --git a/tests/baselines/reference/subtypingWithCallSignatures4.types b/tests/baselines/reference/subtypingWithCallSignatures4.types index f490f78787823..e8bf0beb8603f 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures4.types +++ b/tests/baselines/reference/subtypingWithCallSignatures4.types @@ -227,7 +227,7 @@ var r1arg = (x: T) => null; >T : T >null : T[] >T : T ->null : null +>null : T[] var r1arg2 = (x: T) => null; >r1arg2 : (x: T) => T[] @@ -237,7 +237,7 @@ var r1arg2 = (x: T) => null; >T : T >null : T[] >T : T ->null : null +>null : T[] var r1 = foo1(r1arg); >r1 : any @@ -301,7 +301,7 @@ var r3arg = (x: T) => null; >T : T >null : T >T : T ->null : null +>null : T var r3arg2 = (x: T) => { }; >r3arg2 : (x: T) => void @@ -379,7 +379,7 @@ var r5arg = (x: (arg: T) => U) => null; >U : U >null : T >T : T ->null : null +>null : T var r5arg2 = (x: (arg: T) => U) => null; >r5arg2 : (x: (arg: T) => U) => T @@ -392,7 +392,7 @@ var r5arg2 = (x: (arg: T) => U) => null; >U : U >null : T >T : T ->null : null +>null : T var r5 = foo5(r5arg); >r5 : any @@ -425,7 +425,7 @@ var r6arg = (x: (arg: T) => U) => null; >U : U >null : T >T : T ->null : null +>null : T var r6arg2 = (x: (arg: T) => Derived) => null; >r6arg2 : (x: (arg: T) => Derived) => T @@ -438,7 +438,7 @@ var r6arg2 = (x: (arg: T) => Derived) => null; >Derived : Derived >null : T >T : T ->null : null +>null : T var r6 = foo6(r6arg); >r6 : any @@ -473,7 +473,7 @@ var r11arg = (x: { foo: T }, y: { foo: U; bar: U }) => null; >U : U >null : Base >Base : Base ->null : null +>null : Base var r11arg2 = (x: { foo: T }, y: { foo: T; bar: T }) => null; >r11arg2 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base @@ -489,7 +489,7 @@ var r11arg2 = (x: { foo: T }, y: { foo: T; bar: T }) => null; >T : T >null : Base >Base : Base ->null : null +>null : Base var r11 = foo11(r11arg); >r11 : any @@ -521,7 +521,7 @@ var r15arg = (x: { a: U; b: V; }) => null; >V : V >null : U[] >U : U ->null : null +>null : U[] var r15arg2 = (x: { a: T; b: T }) => null; >r15arg2 : (x: { a: T; b: T; }) => T[] @@ -534,7 +534,7 @@ var r15arg2 = (x: { a: T; b: T }) => null; >T : T >null : T[] >T : T ->null : null +>null : T[] var r15 = foo15(r15arg); >r15 : any @@ -566,7 +566,7 @@ var r16arg = (x: { a: T; b: T }) => null; >T : T >null : T[] >T : T ->null : null +>null : T[] var r16arg2 = (x: { a: T; b: T }) => null; >r16arg2 : (x: { a: T; b: T; }) => T[] @@ -580,7 +580,7 @@ var r16arg2 = (x: { a: T; b: T }) => null; >T : T >null : T[] >T : T ->null : null +>null : T[] var r16 = foo16(r16arg); >r16 : any @@ -610,7 +610,7 @@ var r17arg = (x: (a: T) => T) => null; >T : T >null : T[] >T : T ->null : null +>null : T[] var r17 = foo17(r17arg); >r17 : any @@ -627,7 +627,7 @@ var r18arg = (x: (a: T) => T) => null; >T : T >T : T >null : any[] ->null : null +>null : any[] var r18 = foo18(r18arg); >r18 : any diff --git a/tests/baselines/reference/subtypingWithObjectMembersOptionality.types b/tests/baselines/reference/subtypingWithObjectMembersOptionality.types index 815f2d60740ca..517a6a531328c 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersOptionality.types +++ b/tests/baselines/reference/subtypingWithObjectMembersOptionality.types @@ -82,7 +82,7 @@ var b = { Foo: null }; >Foo : Derived >null : Derived >Derived : Derived ->null : null +>null : Derived var r = true ? a : b; >r : { Foo?: Base; } @@ -153,7 +153,7 @@ module TwoLevels { >Foo : Derived2 >null : Derived2 >Derived2 : Derived2 ->null : null +>null : Derived2 var r = true ? a : b; >r : { Foo?: Base; } diff --git a/tests/baselines/reference/superCallBeforeThisAccessing8.types b/tests/baselines/reference/superCallBeforeThisAccessing8.types index dd92d924cebb7..b8abbc1507606 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing8.types +++ b/tests/baselines/reference/superCallBeforeThisAccessing8.types @@ -21,7 +21,7 @@ class D extends Base { >k : void >super(undefined) : void >super : typeof Base ->undefined : undefined +>undefined : any j: this._t, // no error >j : any diff --git a/tests/baselines/reference/taggedTemplateContextualTyping1.types b/tests/baselines/reference/taggedTemplateContextualTyping1.types index 93ca81f8446fb..05d101ec7a8e8 100644 --- a/tests/baselines/reference/taggedTemplateContextualTyping1.types +++ b/tests/baselines/reference/taggedTemplateContextualTyping1.types @@ -40,7 +40,7 @@ function tempTag1(...rest: any[]): T { >T : T return undefined; ->undefined : undefined +>undefined : T } // If contextual typing takes place, these functions should work. @@ -55,7 +55,7 @@ tempTag1 `${ x => { x(undefined); return x; } }${ 10 } >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >10 : number @@ -67,13 +67,13 @@ tempTag1 `${ x => { x(undefined); return x; } }${ y => >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >y => { y(undefined); return y; } : (y: (p: T) => T) => (p: T) => T >y : (p: T) => T >y(undefined) : number >y : (p: T) => T ->undefined : undefined +>undefined : number >y : (p: T) => T >10 : number @@ -85,7 +85,7 @@ tempTag1 `${ x => { x(undefined); return x; } }${ (y: >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >(y: (p: T) => T) => { y(undefined); return y } : (y: (p: T) => T) => (p: T) => T >y : (p: T) => T @@ -95,9 +95,9 @@ tempTag1 `${ x => { x(undefined); return x; } }${ (y: >T : T >y(undefined) : number >y : (p: T) => T ->undefined : undefined +>undefined : number >y : (p: T) => T ->undefined : undefined +>undefined : any tempTag1 `${ (x: (p: T) => T) => { x(undefined); return x; } }${ y => { y(undefined); return y; } }${ undefined }`; >tempTag1 `${ (x: (p: T) => T) => { x(undefined); return x; } }${ y => { y(undefined); return y; } }${ undefined }` : any @@ -111,13 +111,13 @@ tempTag1 `${ (x: (p: T) => T) => { x(undefined); return x; } }${ y => >T : T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >y => { y(undefined); return y; } : (y: (p: T) => T) => (p: T) => T >y : (p: T) => T >y(undefined) : number >y : (p: T) => T ->undefined : undefined +>undefined : number >y : (p: T) => T ->undefined : undefined +>undefined : any diff --git a/tests/baselines/reference/taggedTemplateContextualTyping2.types b/tests/baselines/reference/taggedTemplateContextualTyping2.types index 8fcfc02c62b69..c42d93871cb96 100644 --- a/tests/baselines/reference/taggedTemplateContextualTyping2.types +++ b/tests/baselines/reference/taggedTemplateContextualTyping2.types @@ -42,7 +42,7 @@ function tempTag2(...rest: any[]): any { >rest : any[] return undefined; ->undefined : undefined +>undefined : any } // If contextual typing takes place, these functions should work. @@ -57,7 +57,7 @@ tempTag2 `${ x => { x(undefined); return x; } }${ 0 }`; >x : (p: T) => T >x(undefined) : number >x : (p: T) => T ->undefined : undefined +>undefined : number >x : (p: T) => T >0 : number @@ -69,13 +69,13 @@ tempTag2 `${ x => { x(undefined); return x; } }${ y => { yx : (p: T) => T >x(undefined) : string >x : (p: T) => T ->undefined : undefined +>undefined : string >x : (p: T) => T >y => { y(null); return y; } : (y: (p: T) => T) => (p: T) => T >y : (p: T) => T >y(null) : number >y : (p: T) => T ->null : null +>null : number >y : (p: T) => T >"hello" : string @@ -87,8 +87,8 @@ tempTag2 `${ x => { x(undefined); return x; } }${ undefined }${ >x : (p: T) => T >x(undefined) : string >x : (p: T) => T ->undefined : undefined +>undefined : string >x : (p: T) => T ->undefined : undefined +>undefined : (x: (p: T) => T) => (p: T) => T >"hello" : string diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.types b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.types index 77353e9b3cedc..f7859256a3872 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.types +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.types @@ -16,7 +16,7 @@ function foo1(...stuff: any[]): any { >stuff : any[] return undefined; ->undefined : undefined +>undefined : any } var a = foo1 `${1}`; // string @@ -30,7 +30,7 @@ var b = foo1([], 1); // number >b : number >foo1([], 1) : number >foo1 : { (strs: TemplateStringsArray, x: number): string; (strs: string[], x: number): number; } ->[] : undefined[] +>[] : string[] >1 : number function foo2(strs: string[], x: number): number; @@ -49,7 +49,7 @@ function foo2(...stuff: any[]): any { >stuff : any[] return undefined; ->undefined : undefined +>undefined : any } var c = foo2 `${1}`; // number @@ -63,6 +63,6 @@ var d = foo2([], 1); // number >d : number >foo2([], 1) : number >foo2 : { (strs: string[], x: number): number; (strs: TemplateStringsArray, x: number): string; } ->[] : undefined[] +>[] : string[] >1 : number diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2_ES6.types b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2_ES6.types index 306bf38cac46d..dfac8fb1755dc 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2_ES6.types +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2_ES6.types @@ -15,7 +15,7 @@ function foo1(...stuff: any[]): any { >stuff : any[] return undefined; ->undefined : undefined +>undefined : any } var a = foo1 `${1}`; // string @@ -29,7 +29,7 @@ var b = foo1([], 1); // number >b : number >foo1([], 1) : number >foo1 : { (strs: TemplateStringsArray, x: number): string; (strs: string[], x: number): number; } ->[] : undefined[] +>[] : string[] >1 : number function foo2(strs: string[], x: number): number; @@ -48,7 +48,7 @@ function foo2(...stuff: any[]): any { >stuff : any[] return undefined; ->undefined : undefined +>undefined : any } var c = foo2 `${1}`; // number @@ -62,6 +62,6 @@ var d = foo2([], 1); // number >d : number >foo2([], 1) : number >foo2 : { (strs: string[], x: number): number; (strs: TemplateStringsArray, x: number): string; } ->[] : undefined[] +>[] : string[] >1 : number diff --git a/tests/baselines/reference/thisTypeInClasses.types b/tests/baselines/reference/thisTypeInClasses.types index 69d0f0b1f8f69..93dcb3056431e 100644 --- a/tests/baselines/reference/thisTypeInClasses.types +++ b/tests/baselines/reference/thisTypeInClasses.types @@ -8,7 +8,7 @@ class C1 { f(x: this): this { return undefined; } >f : (x: this) => this >x : this ->undefined : undefined +>undefined : this } class C2 { @@ -135,12 +135,12 @@ class C5 { let x1 = undefined; >x1 : this >undefined : this ->undefined : undefined +>undefined : this let x2 = undefined as this; >x2 : this >undefined as this : this ->undefined : undefined +>undefined : this } } diff --git a/tests/baselines/reference/transitiveTypeArgumentInference1.types b/tests/baselines/reference/transitiveTypeArgumentInference1.types index 78f5b2becdd96..00f9c2fbb8b65 100644 --- a/tests/baselines/reference/transitiveTypeArgumentInference1.types +++ b/tests/baselines/reference/transitiveTypeArgumentInference1.types @@ -14,7 +14,7 @@ interface I1 { var i: I1 = null; >i : I1 >I1 : I1 ->null : null +>null : I1 class C { >C : C diff --git a/tests/baselines/reference/tupleElementTypes1.types b/tests/baselines/reference/tupleElementTypes1.types index 3b0b8b6e85454..759717b379923 100644 --- a/tests/baselines/reference/tupleElementTypes1.types +++ b/tests/baselines/reference/tupleElementTypes1.types @@ -2,7 +2,7 @@ var [a, b]: [number, any] = [undefined, undefined]; >a : number >b : any ->[undefined, undefined] : [undefined, undefined] ->undefined : undefined ->undefined : undefined +>[undefined, undefined] : [number, any] +>undefined : number +>undefined : any diff --git a/tests/baselines/reference/tupleElementTypes3.types b/tests/baselines/reference/tupleElementTypes3.types index 6f29ba1371a1d..f0f4d561b0b78 100644 --- a/tests/baselines/reference/tupleElementTypes3.types +++ b/tests/baselines/reference/tupleElementTypes3.types @@ -2,7 +2,7 @@ var [a, b] = [0, undefined]; >a : number >b : any ->[0, undefined] : [number, undefined] +>[0, undefined] : [number, any] >0 : number ->undefined : undefined +>undefined : any diff --git a/tests/baselines/reference/tupleElementTypes4.types b/tests/baselines/reference/tupleElementTypes4.types index 06e19ef72bbf2..66fcb342cdb02 100644 --- a/tests/baselines/reference/tupleElementTypes4.types +++ b/tests/baselines/reference/tupleElementTypes4.types @@ -3,7 +3,7 @@ function f([a, b] = [0, undefined]) { } >f : ([a, b]?: [number, any]) => void >a : number >b : any ->[0, undefined] : [number, undefined] +>[0, undefined] : [number, any] >0 : number ->undefined : undefined +>undefined : any diff --git a/tests/baselines/reference/typeArgInferenceWithNull.types b/tests/baselines/reference/typeArgInferenceWithNull.types index 93ded4267eb02..beb0fc05949b2 100644 --- a/tests/baselines/reference/typeArgInferenceWithNull.types +++ b/tests/baselines/reference/typeArgInferenceWithNull.types @@ -10,7 +10,7 @@ function fn4(n: T) { } fn4(null); >fn4(null) : void >fn4 : (n: T) => void ->null : null +>null : any function fn5(n: T) { } >fn5 : (n: T) => void @@ -22,9 +22,9 @@ function fn5(n: T) { } fn5({ x: null }); >fn5({ x: null }) : void >fn5 : (n: T) => void ->{ x: null } : { x: null; } ->x : null ->null : null +>{ x: null } : { x: any; } +>x : any +>null : any function fn6(n: T, fun: (x: T) => void, n2: T) { } >fn6 : (n: T, fun: (x: T) => void, n2: T) => void @@ -41,9 +41,9 @@ function fn6(n: T, fun: (x: T) => void, n2: T) { } fn6({ x: null }, y => { }, { x: "" }); // y has type { x: any }, but ideally would have type { x: string } >fn6({ x: null }, y => { }, { x: "" }) : void >fn6 : (n: T, fun: (x: T) => void, n2: T) => void ->{ x: null } : { x: null; } ->x : null ->null : null +>{ x: null } : { x: string; } +>x : string +>null : string >y => { } : (y: { x: string; }) => void >y : { x: string; } >{ x: "" } : { x: string; } diff --git a/tests/baselines/reference/typeArgumentInferenceOrdering.types b/tests/baselines/reference/typeArgumentInferenceOrdering.types index 1bbeadcf4d52a..82f33a53fa6d8 100644 --- a/tests/baselines/reference/typeArgumentInferenceOrdering.types +++ b/tests/baselines/reference/typeArgumentInferenceOrdering.types @@ -6,7 +6,7 @@ function foo(f: { y: T }): T { return null } >y : T >T : T >T : T ->null : null +>null : T var x = foo(new C()).x; // was Error that property x does not exist on type {} >x : () => Goo diff --git a/tests/baselines/reference/typeArgumentInferenceWithClassExpression1.types b/tests/baselines/reference/typeArgumentInferenceWithClassExpression1.types index 63ee130938323..8758e09505b2b 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithClassExpression1.types +++ b/tests/baselines/reference/typeArgumentInferenceWithClassExpression1.types @@ -9,7 +9,7 @@ function foo(x = class { static prop: T }): T { >T : T return undefined; ->undefined : undefined +>undefined : T } foo(class { static prop = "hello" }).length; diff --git a/tests/baselines/reference/typeArgumentInferenceWithClassExpression3.types b/tests/baselines/reference/typeArgumentInferenceWithClassExpression3.types index 9a2bddd92963c..8ae373bfa5f28 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithClassExpression3.types +++ b/tests/baselines/reference/typeArgumentInferenceWithClassExpression3.types @@ -9,7 +9,7 @@ function foo(x = class { prop: T }): T { >T : T return undefined; ->undefined : undefined +>undefined : T } foo(class { prop = "hello" }).length; diff --git a/tests/baselines/reference/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.types b/tests/baselines/reference/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.types index 044de70c5cdff..8e6ead0c16c85 100644 --- a/tests/baselines/reference/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.types +++ b/tests/baselines/reference/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.types @@ -19,6 +19,6 @@ var classes = undefined; return new classes(null); >new classes(null) : any >classes : any ->null : null +>null : any } diff --git a/tests/baselines/reference/typeInferenceFBoundedTypeParams.types b/tests/baselines/reference/typeInferenceFBoundedTypeParams.types index 0ce04aabddff6..f66ceab3fab2d 100644 --- a/tests/baselines/reference/typeInferenceFBoundedTypeParams.types +++ b/tests/baselines/reference/typeInferenceFBoundedTypeParams.types @@ -67,7 +67,7 @@ fold( [] as [string, string][], >[] as [string, string][] : [string, string][] ->[] : undefined[] +>[] : [string, string][] (result, value) => append( >(result, value) => append( result, ["", ""] ) : (result: [string, string][], value: number) => [string, string][] diff --git a/tests/baselines/reference/typeInferenceReturnTypeCallback.types b/tests/baselines/reference/typeInferenceReturnTypeCallback.types index 408e60f90ecb9..4460da14d84ef 100644 --- a/tests/baselines/reference/typeInferenceReturnTypeCallback.types +++ b/tests/baselines/reference/typeInferenceReturnTypeCallback.types @@ -31,7 +31,7 @@ class Nil implements IList{ >D : D return null; ->null : null +>null : IList } } @@ -85,6 +85,6 @@ class Cons implements IList{ >E : E return null; ->null : null +>null : E } } diff --git a/tests/baselines/reference/typeInferenceWithTupleType.types b/tests/baselines/reference/typeInferenceWithTupleType.types index a45e72518e844..6c29ad08d2db8 100644 --- a/tests/baselines/reference/typeInferenceWithTupleType.types +++ b/tests/baselines/reference/typeInferenceWithTupleType.types @@ -56,10 +56,10 @@ function zip(array1: T[], array2: U[]): [[T, U]] { >length : number return [[undefined, undefined]]; ->[[undefined, undefined]] : [[undefined, undefined]] ->[undefined, undefined] : [undefined, undefined] ->undefined : undefined ->undefined : undefined +>[[undefined, undefined]] : [[T, U]] +>[undefined, undefined] : [T, U] +>undefined : T +>undefined : U } var length = array1.length; >length : number diff --git a/tests/baselines/reference/typeOfPrototype.types b/tests/baselines/reference/typeOfPrototype.types index 904667870809b..13d2972868e9a 100644 --- a/tests/baselines/reference/typeOfPrototype.types +++ b/tests/baselines/reference/typeOfPrototype.types @@ -11,11 +11,11 @@ class Foo { >'' : string } Foo.prototype.bar = undefined; // Should be OK ->Foo.prototype.bar = undefined : undefined +>Foo.prototype.bar = undefined : number >Foo.prototype.bar : number >Foo.prototype : Foo >Foo : typeof Foo >prototype : Foo >bar : number ->undefined : undefined +>undefined : number diff --git a/tests/baselines/reference/typeParameterAndArgumentOfSameName1.types b/tests/baselines/reference/typeParameterAndArgumentOfSameName1.types index 8e476732ded79..cd8bad46ad315 100644 --- a/tests/baselines/reference/typeParameterAndArgumentOfSameName1.types +++ b/tests/baselines/reference/typeParameterAndArgumentOfSameName1.types @@ -16,5 +16,5 @@ function f(A: A): A { >123 : number return null; ->null : null +>null : A } diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraint.types b/tests/baselines/reference/typeParameterAsTypeParameterConstraint.types index c5f15f1ba5596..982fe6376301b 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraint.types +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraint.types @@ -109,7 +109,7 @@ foo2(1, []); >foo2(1, []) : any[] >foo2 : (x: T, y: U) => U >1 : number ->[] : undefined[] +>[] : any[] foo2(1, ['']); >foo2(1, ['']) : string[] diff --git a/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.types b/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.types index c7841c1a38b45..e9eb0e2a34cd1 100644 --- a/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.types +++ b/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.types @@ -10,7 +10,7 @@ var a = { >y : T >T : T >T : T ->null : null +>null : T } var a2 = { >a2 : { x: (y: any) => any; } @@ -20,7 +20,7 @@ var a2 = { >x : (y: any) => any >function (y: any): any { return null; } : (y: any) => any >y : any ->null : null +>null : any } export interface I { >I : I diff --git a/tests/baselines/reference/typeParameterEquality.types b/tests/baselines/reference/typeParameterEquality.types index 2e51c3a51e669..b0b167e1ef2bc 100644 --- a/tests/baselines/reference/typeParameterEquality.types +++ b/tests/baselines/reference/typeParameterEquality.types @@ -8,7 +8,7 @@ class C { >a : T >T : T >T : T ->null : null +>null : (a: T) => T set x(p: (a: U) => U) {} >x : (a: T) => T diff --git a/tests/baselines/reference/typeParameterFixingWithConstraints.types b/tests/baselines/reference/typeParameterFixingWithConstraints.types index 1e71f439e5e2b..5407e2765b19f 100644 --- a/tests/baselines/reference/typeParameterFixingWithConstraints.types +++ b/tests/baselines/reference/typeParameterFixingWithConstraints.types @@ -35,13 +35,13 @@ foo.foo({ bar: null }, bar => null, bar => null); >foo.foo : (bar: TBar, bar1: (bar: TBar) => TBar, bar2: (bar: TBar) => TBar) => TBar >foo : IFoo >foo : (bar: TBar, bar1: (bar: TBar) => TBar, bar2: (bar: TBar) => TBar) => TBar ->{ bar: null } : { bar: null; } ->bar : null ->null : null +>{ bar: null } : { bar: any; } +>bar : any +>null : any >bar => null : (bar: { bar: any; }) => any >bar : { bar: any; } ->null : null +>null : { bar: any; } >bar => null : (bar: { bar: any; }) => any >bar : { bar: any; } ->null : null +>null : { bar: any; } diff --git a/tests/baselines/reference/typeParameterFixingWithContextSensitiveArguments.types b/tests/baselines/reference/typeParameterFixingWithContextSensitiveArguments.types index df535b5879b68..0029a3b5a4809 100644 --- a/tests/baselines/reference/typeParameterFixingWithContextSensitiveArguments.types +++ b/tests/baselines/reference/typeParameterFixingWithContextSensitiveArguments.types @@ -57,7 +57,7 @@ var d2 = f(b, x => x.a, null); // type [B, A] >x.a : A >x : B >a : A ->null : null +>null : B var d3 = f(b, x => x.b, null); // type [B, any] >d3 : [B, any] @@ -69,5 +69,5 @@ var d3 = f(b, x => x.b, null); // type [B, any] >x.b : any >x : B >b : any ->null : null +>null : B diff --git a/tests/baselines/reference/typeParameterOrderReversal.types b/tests/baselines/reference/typeParameterOrderReversal.types index 9b09ea5d6c90a..cfa0b8bf7d06f 100644 --- a/tests/baselines/reference/typeParameterOrderReversal.types +++ b/tests/baselines/reference/typeParameterOrderReversal.types @@ -30,7 +30,7 @@ function tFirst>(x: U) { } var z: X = null; >z : X >X : X ->null : null +>null : X // Both of these should be allowed uFirst(z); diff --git a/tests/baselines/reference/typeParametersAvailableInNestedScope.types b/tests/baselines/reference/typeParametersAvailableInNestedScope.types index 69264e8471b33..7e5196221fa42 100644 --- a/tests/baselines/reference/typeParametersAvailableInNestedScope.types +++ b/tests/baselines/reference/typeParametersAvailableInNestedScope.types @@ -43,7 +43,7 @@ class C { >temp : (a: U) => T >null : T >T : T ->null : null +>null : T } } @@ -61,7 +61,7 @@ c.data = c.x(null); >c.x : (a: U) => number >c : C >x : (a: U) => number ->null : null +>null : any c.data = c.foo(); >c.data = c.foo() : number diff --git a/tests/baselines/reference/typeReferenceDirectives12.types b/tests/baselines/reference/typeReferenceDirectives12.types index bd429b91f1c1f..a5d9e2ee6dbc6 100644 --- a/tests/baselines/reference/typeReferenceDirectives12.types +++ b/tests/baselines/reference/typeReferenceDirectives12.types @@ -45,14 +45,14 @@ import {Cls} from "./main"; >Cls : typeof Cls Cls.prototype.foo = function() { return undefined; } ->Cls.prototype.foo = function() { return undefined; } : () => any +>Cls.prototype.foo = function() { return undefined; } : () => Lib >Cls.prototype.foo : () => Lib >Cls.prototype : Cls >Cls : typeof Cls >prototype : Cls >foo : () => Lib ->function() { return undefined; } : () => any ->undefined : undefined +>function() { return undefined; } : () => Lib +>undefined : Lib declare module "./main" { interface Cls { diff --git a/tests/baselines/reference/typeReferenceDirectives9.types b/tests/baselines/reference/typeReferenceDirectives9.types index bd429b91f1c1f..a5d9e2ee6dbc6 100644 --- a/tests/baselines/reference/typeReferenceDirectives9.types +++ b/tests/baselines/reference/typeReferenceDirectives9.types @@ -45,14 +45,14 @@ import {Cls} from "./main"; >Cls : typeof Cls Cls.prototype.foo = function() { return undefined; } ->Cls.prototype.foo = function() { return undefined; } : () => any +>Cls.prototype.foo = function() { return undefined; } : () => Lib >Cls.prototype.foo : () => Lib >Cls.prototype : Cls >Cls : typeof Cls >prototype : Cls >foo : () => Lib ->function() { return undefined; } : () => any ->undefined : undefined +>function() { return undefined; } : () => Lib +>undefined : Lib declare module "./main" { interface Cls { diff --git a/tests/baselines/reference/undefinedArgumentInference.types b/tests/baselines/reference/undefinedArgumentInference.types index 998a717b70a9d..544d262bea0fe 100644 --- a/tests/baselines/reference/undefinedArgumentInference.types +++ b/tests/baselines/reference/undefinedArgumentInference.types @@ -10,7 +10,7 @@ function foo1(f1: { x: T; y: T }): T { >T : T return undefined; ->undefined : undefined +>undefined : T } @@ -18,9 +18,9 @@ var z1 = foo1({ x: undefined, y: undefined }); >z1 : any >foo1({ x: undefined, y: undefined }) : any >foo1 : (f1: { x: T; y: T; }) => T ->{ x: undefined, y: undefined } : { x: undefined; y: undefined; } ->x : undefined ->undefined : undefined ->y : undefined ->undefined : undefined +>{ x: undefined, y: undefined } : { x: any; y: any; } +>x : any +>undefined : any +>y : any +>undefined : any diff --git a/tests/baselines/reference/undefinedAssignableToEveryType.types b/tests/baselines/reference/undefinedAssignableToEveryType.types index a32af9cd58fab..d1c27e56fee3c 100644 --- a/tests/baselines/reference/undefinedAssignableToEveryType.types +++ b/tests/baselines/reference/undefinedAssignableToEveryType.types @@ -29,75 +29,75 @@ var ae: E; var b: number = undefined; >b : number ->undefined : undefined +>undefined : number var c: string = undefined; >c : string ->undefined : undefined +>undefined : string var d: boolean = undefined; >d : boolean ->undefined : undefined +>undefined : boolean var e: Date = undefined; >e : Date >Date : Date ->undefined : undefined +>undefined : Date var f: any = undefined; >f : any ->undefined : undefined +>undefined : any var g: void = undefined; >g : void ->undefined : undefined +>undefined : void var h: Object = undefined; >h : Object >Object : Object ->undefined : undefined +>undefined : Object var i: {} = undefined; >i : {} ->undefined : undefined +>undefined : {} var j: () => {} = undefined; >j : () => {} ->undefined : undefined +>undefined : () => {} var k: Function = undefined; >k : Function >Function : Function ->undefined : undefined +>undefined : Function var l: (x: number) => string = undefined; >l : (x: number) => string >x : number ->undefined : undefined +>undefined : (x: number) => string ac = undefined; ->ac = undefined : undefined +>ac = undefined : C >ac : C ->undefined : undefined +>undefined : C ai = undefined; ->ai = undefined : undefined +>ai = undefined : I >ai : I ->undefined : undefined +>undefined : I ae = undefined; ->ae = undefined : undefined +>ae = undefined : E >ae : E ->undefined : undefined +>undefined : E var m: number[] = undefined; >m : number[] ->undefined : undefined +>undefined : number[] var n: { foo: string } = undefined; >n : { foo: string; } >foo : string ->undefined : undefined +>undefined : { foo: string; } var o: (x: T) => T = undefined; >o : (x: T) => T @@ -105,17 +105,17 @@ var o: (x: T) => T = undefined; >x : T >T : T >T : T ->undefined : undefined +>undefined : (x: T) => T var p: Number = undefined; >p : Number >Number : Number ->undefined : undefined +>undefined : Number var q: String = undefined; >q : String >String : String ->undefined : undefined +>undefined : String function foo(x: T, y: U, z: V) { >foo : (x: T, y: U, z: V) => void @@ -131,19 +131,19 @@ function foo(x: T, y: U, z: V) { >V : V x = undefined; ->x = undefined : undefined +>x = undefined : T >x : T ->undefined : undefined +>undefined : T y = undefined; ->y = undefined : undefined +>y = undefined : U >y : U ->undefined : undefined +>undefined : U z = undefined; ->z = undefined : undefined +>z = undefined : V >z : V ->undefined : undefined +>undefined : V } //function foo(x: T, y: U, z: V) { // x = undefined; diff --git a/tests/baselines/reference/undefinedInferentialTyping.types b/tests/baselines/reference/undefinedInferentialTyping.types index 525181f0f4cb2..5a1c1febab8e2 100644 --- a/tests/baselines/reference/undefinedInferentialTyping.types +++ b/tests/baselines/reference/undefinedInferentialTyping.types @@ -9,13 +9,13 @@ function f(arr: T[], elemnt: T): T { >T : T return null; ->null : null +>null : T } var a = f([], 3); // should be number >a : number >f([], 3) : number >f : (arr: T[], elemnt: T) => T ->[] : undefined[] +>[] : number[] >3 : number diff --git a/tests/baselines/reference/underscoreTest1.types b/tests/baselines/reference/underscoreTest1.types index 37f3bdb12ab13..214dd20666860 100644 --- a/tests/baselines/reference/underscoreTest1.types +++ b/tests/baselines/reference/underscoreTest1.types @@ -128,7 +128,7 @@ var flat = _.reduceRight(list, (a, b) => a.concat(b), []); >a : number[] >concat : (...items: (number | number[])[]) => number[] >b : number[] ->[] : undefined[] +>[] : number[] var even = _.find([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); >even : number @@ -238,7 +238,7 @@ _.all([true, 1, null, 'yes'], _.identity); >[true, 1, null, 'yes'] : (boolean | number | string)[] >true : boolean >1 : number ->null : null +>null : boolean | number | string >'yes' : string >_.identity : (value: T) => T >_ : Underscore.Static @@ -250,7 +250,7 @@ _.any([null, 0, 'yes', false]); >_ : Underscore.Static >any : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; } >[null, 0, 'yes', false] : (number | string | boolean)[] ->null : null +>null : number | string | boolean >0 : number >'yes' : string >false : boolean @@ -942,7 +942,7 @@ $(null).scroll(throttled); >$(null).scroll : any >$(null) : any >$ : any ->null : null +>null : any >scroll : any >throttled : () => void @@ -967,7 +967,7 @@ $(null).resize(lazyLayout); >$(null).resize : any >$(null) : any >$ : any ->null : null +>null : any >resize : any >lazyLayout : () => void @@ -1331,7 +1331,7 @@ _.isEmpty({}); >_.isEmpty : (object: any) => boolean >_ : Underscore.Static >isEmpty : (object: any) => boolean ->{} : {} +>{} : any _.isElement($('body')[0]); >_.isElement($('body')[0]) : boolean @@ -1369,7 +1369,7 @@ _.isObject({}); >_.isObject : (value: any) => boolean >_ : Underscore.Static >isObject : (value: any) => boolean ->{} : {} +>{} : any _.isObject(1); >_.isObject(1) : boolean @@ -1434,7 +1434,7 @@ _.isBoolean(null); >_.isBoolean : (object: any) => boolean >_ : Underscore.Static >isBoolean : (object: any) => boolean ->null : null +>null : any _.isDate(new Date()); >_.isDate(new Date()) : boolean @@ -1461,28 +1461,28 @@ _.isNaN(NaN); isNaN(undefined); >isNaN(undefined) : boolean >isNaN : (number: number) => boolean ->undefined : undefined +>undefined : number _.isNaN(undefined); >_.isNaN(undefined) : boolean >_.isNaN : (object: any) => boolean >_ : Underscore.Static >isNaN : (object: any) => boolean ->undefined : undefined +>undefined : any _.isNull(null); >_.isNull(null) : boolean >_.isNull : (object: any) => boolean >_ : Underscore.Static >isNull : (object: any) => boolean ->null : null +>null : any _.isNull(undefined); >_.isNull(undefined) : boolean >_.isNull : (object: any) => boolean >_ : Underscore.Static >isNull : (object: any) => boolean ->undefined : undefined +>undefined : any _.isUndefined((null).missingVariable); >_.isUndefined((null).missingVariable) : boolean @@ -1492,7 +1492,7 @@ _.isUndefined((null).missingVariable); >(null).missingVariable : any >(null) : any >null : any ->null : null +>null : any >missingVariable : any /////////////////////////////////////////////////////////////////////////////////////// diff --git a/tests/baselines/reference/unionAndIntersectionInference1.types b/tests/baselines/reference/unionAndIntersectionInference1.types index 5d23688f0b7c3..98dbd816e62a0 100644 --- a/tests/baselines/reference/unionAndIntersectionInference1.types +++ b/tests/baselines/reference/unionAndIntersectionInference1.types @@ -10,7 +10,7 @@ var y: Y = undefined; >Y : Y >undefined : Y >Y : Y ->undefined : undefined +>undefined : Y function destructure( >destructure : (something: a | Y, haveValue: (value: a) => r, haveY: (value: Y) => r) => r @@ -64,7 +64,7 @@ var value = Math.random() > 0.5 ? 'hey!' : undefined; >'hey!' : string >undefined : Y >Y : Y ->undefined : undefined +>undefined : Y var result = destructure(value, text => 'string', y => 'other one'); // text: string, y: Y >result : string @@ -88,7 +88,7 @@ function isVoid(value: void | a): value is void { >value : any return undefined; ->undefined : undefined +>undefined : boolean } function isNonVoid(value: void | a) : value is a { @@ -100,7 +100,7 @@ function isNonVoid(value: void | a) : value is a { >a : a return undefined; ->undefined : undefined +>undefined : boolean } function foo1(value: void|a): void { @@ -158,7 +158,7 @@ function get(x: U | void): U { >U : U return null; // just an example ->null : null +>null : U } let foo: Maybe; diff --git a/tests/baselines/reference/unionTypeInference.types b/tests/baselines/reference/unionTypeInference.types index 58aa450c81395..64f711ee7f3ef 100644 --- a/tests/baselines/reference/unionTypeInference.types +++ b/tests/baselines/reference/unionTypeInference.types @@ -54,7 +54,7 @@ var a4 = f(undefined, "abc"); >a4 : any >f(undefined, "abc") : any >f : (x: T, y: string | T) => T ->undefined : undefined +>undefined : any >"abc" : string function g(value: [string, T]): T { @@ -99,7 +99,7 @@ function h(x: string|boolean|T): T { >typeof x : string >x : boolean | T >"boolean" : string ->undefined : undefined +>undefined : T >x : T } diff --git a/tests/baselines/reference/validEnumAssignments.types b/tests/baselines/reference/validEnumAssignments.types index 5ac73b126abc3..100c3219b33c0 100644 --- a/tests/baselines/reference/validEnumAssignments.types +++ b/tests/baselines/reference/validEnumAssignments.types @@ -73,14 +73,14 @@ e = n; >n : number e = null; ->e = null : null +>e = null : E >e : E ->null : null +>null : E e = undefined; ->e = undefined : undefined +>e = undefined : E >e : E ->undefined : undefined +>undefined : E e = 1; >e = 1 : number diff --git a/tests/baselines/reference/validUndefinedValues.types b/tests/baselines/reference/validUndefinedValues.types index 2b3bf4f89f374..bb03c6d2ffed6 100644 --- a/tests/baselines/reference/validUndefinedValues.types +++ b/tests/baselines/reference/validUndefinedValues.types @@ -4,7 +4,7 @@ var x: typeof undefined; >undefined : undefined x = undefined; ->x = undefined : undefined +>x = undefined : any >x : any ->undefined : undefined +>undefined : any diff --git a/tests/baselines/reference/validVoidValues.types b/tests/baselines/reference/validVoidValues.types index 2d2d723e1f335..8635b84049f1c 100644 --- a/tests/baselines/reference/validVoidValues.types +++ b/tests/baselines/reference/validVoidValues.types @@ -3,12 +3,12 @@ var x: void; >x : void x = undefined; ->x = undefined : undefined +>x = undefined : void >x : void ->undefined : undefined +>undefined : void x = null; ->x = null : null +>x = null : void >x : void ->null : null +>null : void diff --git a/tests/baselines/reference/widenedTypes.errors.txt b/tests/baselines/reference/widenedTypes.errors.txt index beda634c2a6da..a310ad641e495 100644 --- a/tests/baselines/reference/widenedTypes.errors.txt +++ b/tests/baselines/reference/widenedTypes.errors.txt @@ -3,15 +3,11 @@ tests/cases/compiler/widenedTypes.ts(5,1): error TS2360: The left-hand side of a tests/cases/compiler/widenedTypes.ts(6,7): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/compiler/widenedTypes.ts(8,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/compiler/widenedTypes.ts(11,1): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/compiler/widenedTypes.ts(18,1): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/compiler/widenedTypes.ts(23,5): error TS2322: Type 'number[]' is not assignable to type 'string[]'. +tests/cases/compiler/widenedTypes.ts(21,5): error TS2322: Type 'number[]' is not assignable to type 'string[]'. Type 'number' is not assignable to type 'string'. -tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ x: number; y: null; }' is not assignable to type '{ [x: string]: string; }'. - Property 'x' is incompatible with index signature. - Type 'number' is not assignable to type 'string'. -==== tests/cases/compiler/widenedTypes.ts (8 errors) ==== +==== tests/cases/compiler/widenedTypes.ts (6 errors) ==== null instanceof (() => { }); ~~~~ @@ -37,21 +33,18 @@ tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ x: number; y: var x: typeof undefined = 3; x = 3; - var y; - var u = [3, (y = null)]; - u[3] = ""; - ~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. - var ob: { x: typeof undefined } = { x: "" }; // Highlights the difference between array literals and object literals - var arr: string[] = [3, null]; // not assignable because null is not widened. BCT is {} - ~~~ + // In arrays, null: number, so `strings = numbers` fails + var numbers = [3, null]; + var strings: string[] = numbers; + ~~~~~~~ !!! error TS2322: Type 'number[]' is not assignable to type 'string[]'. !!! error TS2322: Type 'number' is not assignable to type 'string'. - var obj: { [x: string]: string; } = { x: 3, y: null }; // assignable because null is widened, and therefore BCT is any - ~~~ -!!! error TS2322: Type '{ x: number; y: null; }' is not assignable to type '{ [x: string]: string; }'. -!!! error TS2322: Property 'x' is incompatible with index signature. -!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file + + // In objects, null widens to any + var obj1 = { x: "", y: null }; + // y: any is assignable to string + var obj: { [s: string]: string; } = obj1; // assignable because null is widened, and therefore BCT is any + \ No newline at end of file diff --git a/tests/baselines/reference/widenedTypes.js b/tests/baselines/reference/widenedTypes.js index a0ff6327f2500..227163516654d 100644 --- a/tests/baselines/reference/widenedTypes.js +++ b/tests/baselines/reference/widenedTypes.js @@ -14,15 +14,18 @@ t[3] = ""; var x: typeof undefined = 3; x = 3; -var y; -var u = [3, (y = null)]; -u[3] = ""; - var ob: { x: typeof undefined } = { x: "" }; // Highlights the difference between array literals and object literals -var arr: string[] = [3, null]; // not assignable because null is not widened. BCT is {} -var obj: { [x: string]: string; } = { x: 3, y: null }; // assignable because null is widened, and therefore BCT is any +// In arrays, null: number, so `strings = numbers` fails +var numbers = [3, null]; +var strings: string[] = numbers; + +// In objects, null widens to any +var obj1 = { x: "", y: null }; +// y: any is assignable to string +var obj: { [s: string]: string; } = obj1; // assignable because null is widened, and therefore BCT is any + //// [widenedTypes.js] null instanceof (function () { }); @@ -34,24 +37,29 @@ var t = [3, (3, null)]; t[3] = ""; var x = 3; x = 3; -var y; -var u = [3, (y = null)]; -u[3] = ""; var ob = { x: "" }; // Highlights the difference between array literals and object literals -var arr = [3, null]; // not assignable because null is not widened. BCT is {} -var obj = { x: 3, y: null }; // assignable because null is widened, and therefore BCT is any +// In arrays, null: number, so `strings = numbers` fails +var numbers = [3, null]; +var strings = numbers; +// In objects, null widens to any +var obj1 = { x: "", y: null }; +// y: any is assignable to string +var obj = obj1; // assignable because null is widened, and therefore BCT is any //// [widenedTypes.d.ts] declare var t: number[]; declare var x: typeof undefined; -declare var y: any; -declare var u: number[]; declare var ob: { x: typeof undefined; }; -declare var arr: string[]; +declare var numbers: number[]; +declare var strings: string[]; +declare var obj1: { + x: string; + y: any; +}; declare var obj: { - [x: string]: string; + [s: string]: string; }; diff --git a/tests/baselines/reference/wideningTuples1.types b/tests/baselines/reference/wideningTuples1.types index 1fdd4a6cb5329..859115c8f8dc8 100644 --- a/tests/baselines/reference/wideningTuples1.types +++ b/tests/baselines/reference/wideningTuples1.types @@ -10,8 +10,8 @@ var y = foo([undefined]); >y : [any] >foo([undefined]) : [any] >foo : (x: T) => T ->[undefined] : [undefined] ->undefined : undefined +>[undefined] : [any] +>undefined : any y = [""]; >y = [""] : [string] diff --git a/tests/baselines/reference/wideningTuples2.types b/tests/baselines/reference/wideningTuples2.types index c07166c53f036..4673c27b68be2 100644 --- a/tests/baselines/reference/wideningTuples2.types +++ b/tests/baselines/reference/wideningTuples2.types @@ -16,7 +16,7 @@ var foo: () => [any] = function bar() { >"" : string return [undefined]; ->[undefined] : [undefined] ->undefined : undefined +>[undefined] : [any] +>undefined : any }; diff --git a/tests/baselines/reference/wideningTuples3.errors.txt b/tests/baselines/reference/wideningTuples3.errors.txt deleted file mode 100644 index 43c7e349a0cc0..0000000000000 --- a/tests/baselines/reference/wideningTuples3.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/types/tuple/wideningTuples3.ts(3,5): error TS7005: Variable 'b' implicitly has an '[any, any]' type. - - -==== tests/cases/conformance/types/tuple/wideningTuples3.ts (1 errors) ==== - var a: [any]; - - var b = a = [undefined, null]; - ~ -!!! error TS7005: Variable 'b' implicitly has an '[any, any]' type. \ No newline at end of file diff --git a/tests/baselines/reference/wideningTuples3.symbols b/tests/baselines/reference/wideningTuples3.symbols new file mode 100644 index 0000000000000..6a6e0e11bf9c6 --- /dev/null +++ b/tests/baselines/reference/wideningTuples3.symbols @@ -0,0 +1,9 @@ +=== tests/cases/conformance/types/tuple/wideningTuples3.ts === +var a: [any]; +>a : Symbol(a, Decl(wideningTuples3.ts, 0, 3)) + +var b = a = [undefined, null]; +>b : Symbol(b, Decl(wideningTuples3.ts, 2, 3)) +>a : Symbol(a, Decl(wideningTuples3.ts, 0, 3)) +>undefined : Symbol(undefined) + diff --git a/tests/baselines/reference/wideningTuples3.types b/tests/baselines/reference/wideningTuples3.types new file mode 100644 index 0000000000000..9360889a1d9c9 --- /dev/null +++ b/tests/baselines/reference/wideningTuples3.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/types/tuple/wideningTuples3.ts === +var a: [any]; +>a : [any] + +var b = a = [undefined, null]; +>b : [any, any] +>a = [undefined, null] : [any, any] +>a : [any] +>[undefined, null] : [any, any] +>undefined : any +>null : any + diff --git a/tests/baselines/reference/wideningTuples4.types b/tests/baselines/reference/wideningTuples4.types index 6d101dd1e017e..2e172a55eb1d4 100644 --- a/tests/baselines/reference/wideningTuples4.types +++ b/tests/baselines/reference/wideningTuples4.types @@ -4,11 +4,11 @@ var a: [any]; var b = a = [undefined, null]; >b : [any, any] ->a = [undefined, null] : [undefined, null] +>a = [undefined, null] : [any, any] >a : [any] ->[undefined, null] : [undefined, null] ->undefined : undefined ->null : null +>[undefined, null] : [any, any] +>undefined : any +>null : any b = ["", ""]; >b = ["", ""] : [string, string] diff --git a/tests/baselines/reference/wideningTuples6.types b/tests/baselines/reference/wideningTuples6.types index d75c0b49e9e89..ef7359888125b 100644 --- a/tests/baselines/reference/wideningTuples6.types +++ b/tests/baselines/reference/wideningTuples6.types @@ -2,9 +2,9 @@ var [a, b] = [undefined, null]; >a : any >b : any ->[undefined, null] : [undefined, null] ->undefined : undefined ->null : null +>[undefined, null] : [any, any] +>undefined : any +>null : any a = ""; >a = "" : string diff --git a/tests/baselines/reference/wideningTuples7.errors.txt b/tests/baselines/reference/wideningTuples7.errors.txt deleted file mode 100644 index 25fd1f58e64cd..0000000000000 --- a/tests/baselines/reference/wideningTuples7.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/conformance/types/tuple/wideningTuples7.ts(1,20): error TS7010: 'bar', which lacks return-type annotation, implicitly has an '[any]' return type. - - -==== tests/cases/conformance/types/tuple/wideningTuples7.ts (1 errors) ==== - var foo = function bar() { - ~~~ -!!! error TS7010: 'bar', which lacks return-type annotation, implicitly has an '[any]' return type. - let intermediate: [string]; - return intermediate = [undefined]; - }; \ No newline at end of file diff --git a/tests/baselines/reference/wideningTuples7.symbols b/tests/baselines/reference/wideningTuples7.symbols new file mode 100644 index 0000000000000..6b7f6d5289ffb --- /dev/null +++ b/tests/baselines/reference/wideningTuples7.symbols @@ -0,0 +1,13 @@ +=== tests/cases/conformance/types/tuple/wideningTuples7.ts === +var foo = function bar() { +>foo : Symbol(foo, Decl(wideningTuples7.ts, 0, 3)) +>bar : Symbol(bar, Decl(wideningTuples7.ts, 0, 9)) + + let intermediate: [string]; +>intermediate : Symbol(intermediate, Decl(wideningTuples7.ts, 1, 7)) + + return intermediate = [undefined]; +>intermediate : Symbol(intermediate, Decl(wideningTuples7.ts, 1, 7)) +>undefined : Symbol(undefined) + +}; diff --git a/tests/baselines/reference/wideningTuples7.types b/tests/baselines/reference/wideningTuples7.types new file mode 100644 index 0000000000000..f823badbc248c --- /dev/null +++ b/tests/baselines/reference/wideningTuples7.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/types/tuple/wideningTuples7.ts === +var foo = function bar() { +>foo : () => [string] +>function bar() { let intermediate: [string]; return intermediate = [undefined];} : () => [string] +>bar : () => [string] + + let intermediate: [string]; +>intermediate : [string] + + return intermediate = [undefined]; +>intermediate = [undefined] : [string] +>intermediate : [string] +>[undefined] : [string] +>undefined : string + +}; diff --git a/tests/baselines/reference/wrappedAndRecursiveConstraints.types b/tests/baselines/reference/wrappedAndRecursiveConstraints.types index b263650825659..f55b586c803f3 100644 --- a/tests/baselines/reference/wrappedAndRecursiveConstraints.types +++ b/tests/baselines/reference/wrappedAndRecursiveConstraints.types @@ -33,7 +33,7 @@ interface Foo extends Date { var y: Foo = null; >y : Foo >Foo : Foo ->null : null +>null : Foo var c = new C(y); >c : C diff --git a/tests/cases/compiler/widenedTypes.ts b/tests/cases/compiler/widenedTypes.ts index 891342847d19c..c741f5e036689 100644 --- a/tests/cases/compiler/widenedTypes.ts +++ b/tests/cases/compiler/widenedTypes.ts @@ -14,12 +14,14 @@ t[3] = ""; var x: typeof undefined = 3; x = 3; -var y; -var u = [3, (y = null)]; -u[3] = ""; - var ob: { x: typeof undefined } = { x: "" }; // Highlights the difference between array literals and object literals -var arr: string[] = [3, null]; // not assignable because null is not widened. BCT is {} -var obj: { [x: string]: string; } = { x: 3, y: null }; // assignable because null is widened, and therefore BCT is any \ No newline at end of file +// In arrays, null: number, so `strings = numbers` fails +var numbers = [3, null]; +var strings: string[] = numbers; + +// In objects, null widens to any +var obj1 = { x: "", y: null }; +// y: any is assignable to string +var obj: { [s: string]: string; } = obj1; // assignable because null is widened, and therefore BCT is any diff --git a/tests/cases/conformance/expressions/contextualTyping/implementedPresentPropertyContextualTyping.ts b/tests/cases/conformance/expressions/contextualTyping/implementedPresentPropertyContextualTyping.ts new file mode 100644 index 0000000000000..a3ac5f82e3f13 --- /dev/null +++ b/tests/cases/conformance/expressions/contextualTyping/implementedPresentPropertyContextualTyping.ts @@ -0,0 +1,10 @@ +// @strictNullChecks: true +interface X { + n: number +} +class C implements X { // error, n: undefined isn't assignable to n: number + n = undefined; +} +class C2 implements X { + n = null; +} diff --git a/tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts b/tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts new file mode 100644 index 0000000000000..afbb75470de8e --- /dev/null +++ b/tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping1.ts @@ -0,0 +1,72 @@ +// @noImplicitAny: true +interface Event { + time: number; +} +interface Base { + superHandle: (e: Event) => number; +} +interface Listener extends Base { + handle: (e: Event) => void; +} +interface Ringer { + ring: (times: number) => void; +} +interface StringLiteral { + literal(): "A"; + literals: "A" | "B"; +} + +abstract class Watcher { + abstract watch(e: Event): number; +} + +class Alarm extends Watcher implements Listener, Ringer, StringLiteral { + str: string; + handle = e => { + this.str = e.time; // error + } + superHandle = e => { + this.str = e.time; // error + return e.time; + } + ring(times) { + this.str = times; // error + } + watch(e) { + this.str = e.time; // error + return e.time; + } + literal() { + return "A"; // ok: "A" is assignable to "A" + } + literals = "A"; // ok: "A" is assignable to "A" | "B" +} + +interface A { + p: string; + q(n: string): void; + r: string; + s: string; +} +interface B { + p: number; + q(n: number): void; + r: boolean; + s: string; +} +class C { + r: number; +} +class Multiple extends C implements A, B { + p = undefined; // error, Multiple.p is implicitly any because A.p and B.p exist + q(n) { // error, n is implicitly any because A.q and B.q exist + n.length; + n.toFixed; + } + r = null; // OK, C.r wins over A.r and B.r + s = null; // OK, A.s and B.s match +} +let multiple = new Multiple(); +multiple.r.toFixed; // OK, C.r wins so Multiple.r: number +multiple.r.length; // error, Multiple.r: number +multiple.s.length; // OK, A.s and B.s match. diff --git a/tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping2.ts b/tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping2.ts new file mode 100644 index 0000000000000..465d5da931c1b --- /dev/null +++ b/tests/cases/conformance/expressions/contextualTyping/implementedPropertyContextualTyping2.ts @@ -0,0 +1,23 @@ +interface Long { + length: number; +} +interface Lol { + canhaz: string; +} +interface Ceiling { + location: { [coordinates: string]: [number, number] }; +} +interface Invisible { + invisibles: string[]; +} +class Cat implements Long, Lol, Ceiling, Invisible { + length = undefined; + canhaz = null; + location = {}; + invisibles = []; +} +const lolCat = new Cat(); +lolCat.length = "wat"; +lolCat.canhaz = false; +lolCat.location['ceiling'] = -1; +lolCat.invisibles.push(0); diff --git a/tests/cases/fourslash/contextualTyping.ts b/tests/cases/fourslash/contextualTyping.ts index 6861ca84915bd..c340bc20db5ec 100644 --- a/tests/cases/fourslash/contextualTyping.ts +++ b/tests/cases/fourslash/contextualTyping.ts @@ -262,7 +262,7 @@ verify.quickInfoIs("(parameter) s: string"); goTo.marker('33'); verify.quickInfoIs("var c3t14: IFoo"); goTo.marker('34'); -verify.quickInfoIs("(property) a: undefined[]"); +verify.quickInfoIs("(property) a: number[]"); goTo.marker('35'); verify.quickInfoIs("(property) C4T5.foo: (i: number, s: string) => string"); goTo.marker('36'); @@ -334,7 +334,7 @@ verify.quickInfoIs("(parameter) s: string"); goTo.marker('69'); verify.quickInfoIs("(property) t14: IFoo"); goTo.marker('70'); -verify.quickInfoIs("(property) a: undefined[]"); +verify.quickInfoIs("(property) a: number[]"); goTo.marker('71'); verify.quickInfoIs("(parameter) n: number"); goTo.marker('72'); @@ -394,7 +394,7 @@ verify.quickInfoIs("(parameter) s: string"); goTo.marker('99'); verify.quickInfoIs("var c12t14: IFoo"); goTo.marker('100'); -verify.quickInfoIs("(property) a: undefined[]"); +verify.quickInfoIs("(property) a: number[]"); goTo.marker('101'); verify.quickInfoIs("function EF1(a: number, b: number): number"); goTo.marker('102');