diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 35c12dedc37b8..e624eb41d86a5 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3119,7 +3119,7 @@ namespace ts { } function resolveTupleTypeMembers(type: TupleType) { - let arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes, /*noDeduplication*/ true))); + let arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes, /*noSubtypeReduction*/ true))); let members = createTupleTypeMemberSymbols(type.elementTypes); addInheritedMembers(members, arrayType.properties); setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); @@ -3451,29 +3451,6 @@ namespace ts { return undefined; } - // Check if a property with the given name is known anywhere in the given type. In an object - // type, a property is considered known if the object type is empty, if it has any index - // signatures, or if the property is actually declared in the type. In a union or intersection - // type, a property is considered known if it is known in any constituent type. - function isKnownProperty(type: Type, name: string): boolean { - if (type.flags & TypeFlags.ObjectType && type !== globalObjectType) { - const resolved = resolveStructuredTypeMembers(type); - return !!(resolved.properties.length === 0 || - resolved.stringIndexType || - resolved.numberIndexType || - getPropertyOfType(type, name)); - } - if (type.flags & TypeFlags.UnionOrIntersection) { - for (let t of (type).types) { - if (isKnownProperty(t, name)) { - return true; - } - } - return false; - } - return true; - } - function getSignaturesOfStructuredType(type: Type, kind: SignatureKind): Signature[] { if (type.flags & TypeFlags.StructuredType) { let resolved = resolveStructuredTypeMembers(type); @@ -4103,73 +4080,20 @@ namespace ts { } } - function isObjectLiteralTypeDuplicateOf(source: ObjectType, target: ObjectType): boolean { - let sourceProperties = getPropertiesOfObjectType(source); - let targetProperties = getPropertiesOfObjectType(target); - if (sourceProperties.length !== targetProperties.length) { - return false; - } - for (let sourceProp of sourceProperties) { - let targetProp = getPropertyOfObjectType(target, sourceProp.name); - if (!targetProp || - getDeclarationFlagsFromSymbol(targetProp) & (NodeFlags.Private | NodeFlags.Protected) || - !isTypeDuplicateOf(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp))) { - return false; - } - } - return true; - } - - function isTupleTypeDuplicateOf(source: TupleType, target: TupleType): boolean { - let sourceTypes = source.elementTypes; - let targetTypes = target.elementTypes; - if (sourceTypes.length !== targetTypes.length) { - return false; - } - for (var i = 0; i < sourceTypes.length; i++) { - if (!isTypeDuplicateOf(sourceTypes[i], targetTypes[i])) { - return false; - } - } - return true; - } - - // Returns true if the source type is a duplicate of the target type. A source type is a duplicate of - // a target type if the the two are identical, with the exception that the source type may have null or - // undefined in places where the target type doesn't. This is by design an asymmetric relationship. - function isTypeDuplicateOf(source: Type, target: Type): boolean { - if (source === target) { - return true; - } - if (source.flags & TypeFlags.Undefined || source.flags & TypeFlags.Null && !(target.flags & TypeFlags.Undefined)) { - return true; - } - if (source.flags & TypeFlags.ObjectLiteral && target.flags & TypeFlags.ObjectType) { - return isObjectLiteralTypeDuplicateOf(source, target); - } - if (isArrayType(source) && isArrayType(target)) { - return isTypeDuplicateOf((source).typeArguments[0], (target).typeArguments[0]); - } - if (isTupleType(source) && isTupleType(target)) { - return isTupleTypeDuplicateOf(source, target); - } - return isTypeIdenticalTo(source, target); - } - - function isTypeDuplicateOfSomeType(candidate: Type, types: Type[]): boolean { - for (let type of types) { - if (candidate !== type && isTypeDuplicateOf(candidate, type)) { + function isSubtypeOfAny(candidate: Type, types: Type[]): boolean { + for (let i = 0, len = types.length; i < len; i++) { + if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { return true; } } return false; } - function removeDuplicateTypes(types: Type[]) { + function removeSubtypes(types: Type[]) { let i = types.length; while (i > 0) { i--; - if (isTypeDuplicateOfSomeType(types[i], types)) { + if (isSubtypeOfAny(types[i], types)) { types.splice(i, 1); } } @@ -4194,12 +4118,14 @@ namespace ts { } } - // We always deduplicate the constituent type set based on object identity, but we'll also deduplicate - // based on the structure of the types unless the noDeduplication flag is true, which is the case when - // creating a union type from a type node and when instantiating a union type. In both of those cases, - // structural deduplication has to be deferred to properly support recursive union types. For example, - // a type of the form "type Item = string | (() => Item)" cannot be deduplicated during its declaration. - function getUnionType(types: Type[], noDeduplication?: boolean): Type { + // We reduce the constituent type set to only include types that aren't subtypes of other types, unless + // the noSubtypeReduction flag is specified, in which case we perform a simple deduplication based on + // object identity. Subtype reduction is possible only when union types are known not to circularly + // reference themselves (as is the case with union types created by expression constructs such as array + // literals and the || and ?: operators). Named types can circularly reference themselves and therefore + // cannot be deduplicated during their declaration. For example, "type Item = string | (() => Item" is + // a named type that circularly references itself. + function getUnionType(types: Type[], noSubtypeReduction?: boolean): Type { if (types.length === 0) { return emptyObjectType; } @@ -4208,12 +4134,12 @@ namespace ts { if (containsTypeAny(typeSet)) { return anyType; } - if (noDeduplication) { + if (noSubtypeReduction) { removeAllButLast(typeSet, undefinedType); removeAllButLast(typeSet, nullType); } else { - removeDuplicateTypes(typeSet); + removeSubtypes(typeSet); } if (typeSet.length === 1) { return typeSet[0]; @@ -4230,7 +4156,7 @@ namespace ts { function getTypeFromUnionTypeNode(node: UnionTypeNode): Type { let links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(map(node.types, getTypeFromTypeNode), /*noDeduplication*/ true); + links.resolvedType = getUnionType(map(node.types, getTypeFromTypeNode), /*noSubtypeReduction*/ true); } return links.resolvedType; } @@ -4526,7 +4452,7 @@ namespace ts { return createTupleType(instantiateList((type).elementTypes, mapper, instantiateType)); } if (type.flags & TypeFlags.Union) { - return getUnionType(instantiateList((type).types, mapper, instantiateType), /*noDeduplication*/ true); + return getUnionType(instantiateList((type).types, mapper, instantiateType), /*noSubtypeReduction*/ true); } if (type.flags & TypeFlags.Intersection) { return getIntersectionType(instantiateList((type).types, mapper, instantiateType)); @@ -4813,6 +4739,30 @@ namespace ts { return Ternary.False; } + // Check if a property with the given name is known anywhere in the given type. In an object type, a property + // is considered known if the object type is empty and the check is for assignability, if the object type has + // index signatures, or if the property is actually declared in the object type. In a union or intersection + // type, a property is considered known if it is known in any constituent type. + function isKnownProperty(type: Type, name: string): boolean { + if (type.flags & TypeFlags.ObjectType) { + const resolved = resolveStructuredTypeMembers(type); + if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) || + resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) { + return true; + } + return false; + } + if (type.flags & TypeFlags.UnionOrIntersection) { + for (let t of (type).types) { + if (isKnownProperty(t, name)) { + return true; + } + } + return false; + } + return true; + } + function hasExcessProperties(source: FreshObjectLiteralType, target: Type, reportErrors: boolean): boolean { for (let prop of getPropertiesOfObjectType(source)) { if (!isKnownProperty(target, prop.name)) { @@ -5594,7 +5544,7 @@ namespace ts { return getWidenedTypeOfObjectLiteral(type); } if (type.flags & TypeFlags.Union) { - return getUnionType(map((type).types, getWidenedType)); + return getUnionType(map((type).types, getWidenedType), /*noSubtypeReduction*/ true); } if (isArrayType(type)) { return createArrayType(getWidenedType((type).typeArguments[0])); diff --git a/tests/baselines/reference/arrayBestCommonTypes.types b/tests/baselines/reference/arrayBestCommonTypes.types index 9b05aff5ac670..20f36e5c459c5 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.types +++ b/tests/baselines/reference/arrayBestCommonTypes.types @@ -294,8 +294,8 @@ module EmptyTypes { // Order matters here so test all the variants var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; ->a1 : ({ x: number; y: string; } | { x: string; y: string; } | { x: any; y: string; })[] ->[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : ({ x: number; y: string; } | { x: string; y: string; } | { x: any; y: string; })[] +>a1 : { x: any; y: string; }[] +>[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : { x: any; y: string; }[] >{ x: 0, y: 'a' } : { x: number; y: string; } >x : number >0 : number @@ -313,8 +313,8 @@ module EmptyTypes { >'a' : string var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }]; ->a2 : ({ x: any; y: string; } | { x: number; y: string; } | { x: string; y: string; })[] ->[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : ({ x: any; y: string; } | { x: number; y: string; } | { x: string; y: string; })[] +>a2 : { x: any; y: string; }[] +>[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[] >{ x: anyObj, y: 'a' } : { x: any; y: string; } >x : any >anyObj : any @@ -332,8 +332,8 @@ module EmptyTypes { >'a' : string var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }]; ->a3 : ({ x: number; y: string; } | { x: any; y: string; } | { x: string; y: string; })[] ->[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : ({ x: number; y: string; } | { x: any; y: string; } | { x: string; y: string; })[] +>a3 : { x: any; y: string; }[] +>[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[] >{ x: 0, y: 'a' } : { x: number; y: string; } >x : number >0 : number @@ -639,7 +639,7 @@ module NonEmptyTypes { >x : number >y : base >base : base ->[{ x: 7, y: new derived() }, { x: 5, y: new base() }] : ({ x: number; y: derived; } | { x: number; y: base; })[] +>[{ x: 7, y: new derived() }, { x: 5, y: new base() }] : { x: number; y: base; }[] >{ x: 7, y: new derived() } : { x: number; y: derived; } >x : number >7 : number @@ -658,7 +658,7 @@ module NonEmptyTypes { >x : boolean >y : base >base : base ->[{ x: true, y: new derived() }, { x: false, y: new base() }] : ({ x: boolean; y: derived; } | { x: boolean; y: base; })[] +>[{ x: true, y: new derived() }, { x: false, y: new base() }] : { x: boolean; y: base; }[] >{ x: true, y: new derived() } : { x: boolean; y: derived; } >x : boolean >true : boolean @@ -697,8 +697,8 @@ module NonEmptyTypes { // Order matters here so test all the variants var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; ->a1 : ({ x: number; y: string; } | { x: string; y: string; } | { x: any; y: string; })[] ->[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : ({ x: number; y: string; } | { x: string; y: string; } | { x: any; y: string; })[] +>a1 : { x: any; y: string; }[] +>[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : { x: any; y: string; }[] >{ x: 0, y: 'a' } : { x: number; y: string; } >x : number >0 : number @@ -716,8 +716,8 @@ module NonEmptyTypes { >'a' : string var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }]; ->a2 : ({ x: any; y: string; } | { x: number; y: string; } | { x: string; y: string; })[] ->[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : ({ x: any; y: string; } | { x: number; y: string; } | { x: string; y: string; })[] +>a2 : { x: any; y: string; }[] +>[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[] >{ x: anyObj, y: 'a' } : { x: any; y: string; } >x : any >anyObj : any @@ -735,8 +735,8 @@ module NonEmptyTypes { >'a' : string var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }]; ->a3 : ({ x: number; y: string; } | { x: any; y: string; } | { x: string; y: string; })[] ->[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : ({ x: number; y: string; } | { x: any; y: string; } | { x: string; y: string; })[] +>a3 : { x: any; y: string; }[] +>[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[] >{ x: 0, y: 'a' } : { x: number; y: string; } >x : number >0 : number @@ -769,29 +769,29 @@ module NonEmptyTypes { >base2 : typeof base2 var b1 = [baseObj, base2Obj, ifaceObj]; ->b1 : (base | base2 | iface)[] ->[baseObj, base2Obj, ifaceObj] : (base | base2 | iface)[] +>b1 : iface[] +>[baseObj, base2Obj, ifaceObj] : iface[] >baseObj : base >base2Obj : base2 >ifaceObj : iface var b2 = [base2Obj, baseObj, ifaceObj]; ->b2 : (base2 | base | iface)[] ->[base2Obj, baseObj, ifaceObj] : (base2 | base | iface)[] +>b2 : iface[] +>[base2Obj, baseObj, ifaceObj] : iface[] >base2Obj : base2 >baseObj : base >ifaceObj : iface var b3 = [baseObj, ifaceObj, base2Obj]; ->b3 : (base | iface | base2)[] ->[baseObj, ifaceObj, base2Obj] : (base | iface | base2)[] +>b3 : iface[] +>[baseObj, ifaceObj, base2Obj] : iface[] >baseObj : base >ifaceObj : iface >base2Obj : base2 var b4 = [ifaceObj, baseObj, base2Obj]; ->b4 : (iface | base | base2)[] ->[ifaceObj, baseObj, base2Obj] : (iface | base | base2)[] +>b4 : iface[] +>[ifaceObj, baseObj, base2Obj] : iface[] >ifaceObj : iface >baseObj : base >base2Obj : base2 diff --git a/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types index 5b5a1be6b8a73..1bbb6c41e8aeb 100644 --- a/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types +++ b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types @@ -36,8 +36,8 @@ var cs = [a, b, c]; // { x: number; y?: number };[] >c : { x: number; a?: number; } var ds = [(x: Object) => 1, (x: string) => 2]; // { (x:Object) => number }[] ->ds : (((x: Object) => number) | ((x: string) => number))[] ->[(x: Object) => 1, (x: string) => 2] : (((x: Object) => number) | ((x: string) => number))[] +>ds : ((x: Object) => number)[] +>[(x: Object) => 1, (x: string) => 2] : ((x: Object) => number)[] >(x: Object) => 1 : (x: Object) => number >x : Object >Object : Object @@ -47,8 +47,8 @@ var ds = [(x: Object) => 1, (x: string) => 2]; // { (x:Object) => number }[] >2 : number var es = [(x: string) => 2, (x: Object) => 1]; // { (x:string) => number }[] ->es : (((x: string) => number) | ((x: Object) => number))[] ->[(x: string) => 2, (x: Object) => 1] : (((x: string) => number) | ((x: Object) => number))[] +>es : ((x: string) => number)[] +>[(x: string) => 2, (x: Object) => 1] : ((x: string) => number)[] >(x: string) => 2 : (x: string) => number >x : string >2 : number diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types index b7224fe91c43c..9cdbe0a0a6157 100644 --- a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types @@ -77,8 +77,8 @@ var myDerivedList: DerivedList; >DerivedList : DerivedList var as = [list, myDerivedList]; // List[] ->as : (List | DerivedList)[] ->[list, myDerivedList] : (List | DerivedList)[] +>as : List[] +>[list, myDerivedList] : List[] >list : List >myDerivedList : DerivedList diff --git a/tests/baselines/reference/arrayOfFunctionTypes3.errors.txt b/tests/baselines/reference/arrayOfFunctionTypes3.errors.txt deleted file mode 100644 index 499d6bca387e6..0000000000000 --- a/tests/baselines/reference/arrayOfFunctionTypes3.errors.txt +++ /dev/null @@ -1,35 +0,0 @@ -tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts(17,13): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts(26,10): error TS2349: Cannot invoke an expression whose type lacks a call signature. - - -==== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts (2 errors) ==== - // valid uses of arrays of function types - - var x = [() => 1, () => { }]; - var r2 = x[0](); - - class C { - foo: string; - } - var y = [C, C]; - var r3 = new y[0](); - - var a: { (x: number): number; (x: string): string; }; - var b: { (x: number): number; (x: string): string; }; - var c: { (x: number): number; (x: any): any; }; - var z = [a, b, c]; - var r4 = z[0]; - var r5 = r4(''); // any not string - ~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. - var r5b = r4(1); - - var a2: { (x: T): number; (x: string): string;}; - var b2: { (x: T): number; (x: string): string; }; - var c2: { (x: number): number; (x: T): any; }; - - var z2 = [a2, b2, c2]; - var r6 = z2[0]; - var r7 = r6(''); // any not string - ~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. \ No newline at end of file diff --git a/tests/baselines/reference/arrayOfFunctionTypes3.symbols b/tests/baselines/reference/arrayOfFunctionTypes3.symbols new file mode 100644 index 0000000000000..d26effeb5b77b --- /dev/null +++ b/tests/baselines/reference/arrayOfFunctionTypes3.symbols @@ -0,0 +1,93 @@ +=== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts === +// valid uses of arrays of function types + +var x = [() => 1, () => { }]; +>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 2, 3)) + +var r2 = x[0](); +>r2 : Symbol(r2, Decl(arrayOfFunctionTypes3.ts, 3, 3)) +>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 2, 3)) + +class C { +>C : Symbol(C, Decl(arrayOfFunctionTypes3.ts, 3, 16)) + + foo: string; +>foo : Symbol(foo, Decl(arrayOfFunctionTypes3.ts, 5, 9)) +} +var y = [C, C]; +>y : Symbol(y, Decl(arrayOfFunctionTypes3.ts, 8, 3)) +>C : Symbol(C, Decl(arrayOfFunctionTypes3.ts, 3, 16)) +>C : Symbol(C, Decl(arrayOfFunctionTypes3.ts, 3, 16)) + +var r3 = new y[0](); +>r3 : Symbol(r3, Decl(arrayOfFunctionTypes3.ts, 9, 3)) +>y : Symbol(y, Decl(arrayOfFunctionTypes3.ts, 8, 3)) + +var a: { (x: number): number; (x: string): string; }; +>a : Symbol(a, Decl(arrayOfFunctionTypes3.ts, 11, 3)) +>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 11, 10)) +>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 11, 31)) + +var b: { (x: number): number; (x: string): string; }; +>b : Symbol(b, Decl(arrayOfFunctionTypes3.ts, 12, 3)) +>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 12, 10)) +>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 12, 31)) + +var c: { (x: number): number; (x: any): any; }; +>c : Symbol(c, Decl(arrayOfFunctionTypes3.ts, 13, 3)) +>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 13, 10)) +>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 13, 31)) + +var z = [a, b, c]; +>z : Symbol(z, Decl(arrayOfFunctionTypes3.ts, 14, 3)) +>a : Symbol(a, Decl(arrayOfFunctionTypes3.ts, 11, 3)) +>b : Symbol(b, Decl(arrayOfFunctionTypes3.ts, 12, 3)) +>c : Symbol(c, Decl(arrayOfFunctionTypes3.ts, 13, 3)) + +var r4 = z[0]; +>r4 : Symbol(r4, Decl(arrayOfFunctionTypes3.ts, 15, 3)) +>z : Symbol(z, Decl(arrayOfFunctionTypes3.ts, 14, 3)) + +var r5 = r4(''); // any not string +>r5 : Symbol(r5, Decl(arrayOfFunctionTypes3.ts, 16, 3)) +>r4 : Symbol(r4, Decl(arrayOfFunctionTypes3.ts, 15, 3)) + +var r5b = r4(1); +>r5b : Symbol(r5b, Decl(arrayOfFunctionTypes3.ts, 17, 3)) +>r4 : Symbol(r4, Decl(arrayOfFunctionTypes3.ts, 15, 3)) + +var a2: { (x: T): number; (x: string): string;}; +>a2 : Symbol(a2, Decl(arrayOfFunctionTypes3.ts, 19, 3)) +>T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 19, 11)) +>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 19, 14)) +>T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 19, 11)) +>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 19, 30)) + +var b2: { (x: T): number; (x: string): string; }; +>b2 : Symbol(b2, Decl(arrayOfFunctionTypes3.ts, 20, 3)) +>T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 20, 11)) +>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 20, 14)) +>T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 20, 11)) +>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 20, 30)) + +var c2: { (x: number): number; (x: T): any; }; +>c2 : Symbol(c2, Decl(arrayOfFunctionTypes3.ts, 21, 3)) +>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 21, 11)) +>T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 21, 32)) +>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 21, 35)) +>T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 21, 32)) + +var z2 = [a2, b2, c2]; +>z2 : Symbol(z2, Decl(arrayOfFunctionTypes3.ts, 23, 3)) +>a2 : Symbol(a2, Decl(arrayOfFunctionTypes3.ts, 19, 3)) +>b2 : Symbol(b2, Decl(arrayOfFunctionTypes3.ts, 20, 3)) +>c2 : Symbol(c2, Decl(arrayOfFunctionTypes3.ts, 21, 3)) + +var r6 = z2[0]; +>r6 : Symbol(r6, Decl(arrayOfFunctionTypes3.ts, 24, 3)) +>z2 : Symbol(z2, Decl(arrayOfFunctionTypes3.ts, 23, 3)) + +var r7 = r6(''); // any not string +>r7 : Symbol(r7, Decl(arrayOfFunctionTypes3.ts, 25, 3)) +>r6 : Symbol(r6, Decl(arrayOfFunctionTypes3.ts, 24, 3)) + diff --git a/tests/baselines/reference/arrayOfFunctionTypes3.types b/tests/baselines/reference/arrayOfFunctionTypes3.types new file mode 100644 index 0000000000000..0ed92991ed08a --- /dev/null +++ b/tests/baselines/reference/arrayOfFunctionTypes3.types @@ -0,0 +1,116 @@ +=== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts === +// valid uses of arrays of function types + +var x = [() => 1, () => { }]; +>x : (() => void)[] +>[() => 1, () => { }] : (() => void)[] +>() => 1 : () => number +>1 : number +>() => { } : () => void + +var r2 = x[0](); +>r2 : void +>x[0]() : void +>x[0] : () => void +>x : (() => void)[] +>0 : number + +class C { +>C : C + + foo: string; +>foo : string +} +var y = [C, C]; +>y : typeof C[] +>[C, C] : typeof C[] +>C : typeof C +>C : typeof C + +var r3 = new y[0](); +>r3 : C +>new y[0]() : C +>y[0] : typeof C +>y : typeof C[] +>0 : number + +var a: { (x: number): number; (x: string): string; }; +>a : { (x: number): number; (x: string): string; } +>x : number +>x : string + +var b: { (x: number): number; (x: string): string; }; +>b : { (x: number): number; (x: string): string; } +>x : number +>x : string + +var c: { (x: number): number; (x: any): any; }; +>c : { (x: number): number; (x: any): any; } +>x : number +>x : any + +var z = [a, b, c]; +>z : { (x: number): number; (x: any): any; }[] +>[a, b, c] : { (x: number): number; (x: any): any; }[] +>a : { (x: number): number; (x: string): string; } +>b : { (x: number): number; (x: string): string; } +>c : { (x: number): number; (x: any): any; } + +var r4 = z[0]; +>r4 : { (x: number): number; (x: any): any; } +>z[0] : { (x: number): number; (x: any): any; } +>z : { (x: number): number; (x: any): any; }[] +>0 : number + +var r5 = r4(''); // any not string +>r5 : any +>r4('') : any +>r4 : { (x: number): number; (x: any): any; } +>'' : string + +var r5b = r4(1); +>r5b : number +>r4(1) : number +>r4 : { (x: number): number; (x: any): any; } +>1 : number + +var a2: { (x: T): number; (x: string): string;}; +>a2 : { (x: T): number; (x: string): string; } +>T : T +>x : T +>T : T +>x : string + +var b2: { (x: T): number; (x: string): string; }; +>b2 : { (x: T): number; (x: string): string; } +>T : T +>x : T +>T : T +>x : string + +var c2: { (x: number): number; (x: T): any; }; +>c2 : { (x: number): number; (x: T): any; } +>x : number +>T : T +>x : T +>T : T + +var z2 = [a2, b2, c2]; +>z2 : { (x: number): number; (x: T): any; }[] +>[a2, b2, c2] : { (x: number): number; (x: T): any; }[] +>a2 : { (x: T): number; (x: string): string; } +>b2 : { (x: T): number; (x: string): string; } +>c2 : { (x: number): number; (x: T): any; } + +var r6 = z2[0]; +>r6 : { (x: number): number; (x: T): any; } +>z2[0] : { (x: number): number; (x: T): any; } +>z2 : { (x: number): number; (x: T): any; }[] +>0 : number + +var r7 = r6(''); // any not string +>r7 : any +>r6('') : any +>r6 : { (x: number): number; (x: T): any; } +>'' : string + diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types index 933d46cc80228..1191004a32bef 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types @@ -46,8 +46,8 @@ var r = true ? 1 : 2; >2 : number var r3 = true ? 1 : {}; ->r3 : number | {} ->true ? 1 : {} : number | {} +>r3 : {} +>true ? 1 : {} : {} >true : boolean >1 : number >{} : {} @@ -67,8 +67,8 @@ var r5 = true ? b : a; // typeof b >a : { x: number; y?: number; } var r6 = true ? (x: number) => { } : (x: Object) => { }; // returns number => void ->r6 : ((x: number) => void) | ((x: Object) => void) ->true ? (x: number) => { } : (x: Object) => { } : ((x: number) => void) | ((x: Object) => void) +>r6 : (x: number) => void +>true ? (x: number) => { } : (x: Object) => { } : (x: number) => void >true : boolean >(x: number) => { } : (x: number) => void >x : number @@ -80,7 +80,7 @@ var r7: (x: Object) => void = true ? (x: number) => { } : (x: Object) => { }; >r7 : (x: Object) => void >x : Object >Object : Object ->true ? (x: number) => { } : (x: Object) => { } : ((x: number) => void) | ((x: Object) => void) +>true ? (x: number) => { } : (x: Object) => { } : (x: number) => void >true : boolean >(x: number) => { } : (x: number) => void >x : number @@ -89,8 +89,8 @@ var r7: (x: Object) => void = true ? (x: number) => { } : (x: Object) => { }; >Object : Object var r8 = true ? (x: Object) => { } : (x: number) => { }; // returns Object => void ->r8 : ((x: Object) => void) | ((x: number) => void) ->true ? (x: Object) => { } : (x: number) => { } : ((x: Object) => void) | ((x: number) => void) +>r8 : (x: Object) => void +>true ? (x: Object) => { } : (x: number) => { } : (x: Object) => void >true : boolean >(x: Object) => { } : (x: Object) => void >x : Object @@ -107,8 +107,8 @@ var r10: Base = true ? derived : derived2; // no error since we use the contextu >derived2 : Derived2 var r11 = true ? base : derived2; ->r11 : Base | Derived2 ->true ? base : derived2 : Base | Derived2 +>r11 : Base +>true ? base : derived2 : Base >true : boolean >base : Base >derived2 : Derived2 diff --git a/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types b/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types index 4c47753a90d7a..df40291b0e507 100644 --- a/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types +++ b/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types @@ -27,43 +27,43 @@ var z: Z; // All these arrays should be X[] var b1 = [x, y, z]; ->b1 : (X | Y | Z)[] ->[x, y, z] : (X | Y | Z)[] +>b1 : X[] +>[x, y, z] : X[] >x : X >y : Y >z : Z var b2 = [x, z, y]; ->b2 : (X | Z | Y)[] ->[x, z, y] : (X | Z | Y)[] +>b2 : X[] +>[x, z, y] : X[] >x : X >z : Z >y : Y var b3 = [y, x, z]; ->b3 : (Y | X | Z)[] ->[y, x, z] : (Y | X | Z)[] +>b3 : X[] +>[y, x, z] : X[] >y : Y >x : X >z : Z var b4 = [y, z, x]; ->b4 : (Y | Z | X)[] ->[y, z, x] : (Y | Z | X)[] +>b4 : X[] +>[y, z, x] : X[] >y : Y >z : Z >x : X var b5 = [z, x, y]; ->b5 : (Z | X | Y)[] ->[z, x, y] : (Z | X | Y)[] +>b5 : X[] +>[z, x, y] : X[] >z : Z >x : X >y : Y var b6 = [z, y, x]; ->b6 : (Z | Y | X)[] ->[z, y, x] : (Z | Y | X)[] +>b6 : X[] +>[z, y, x] : X[] >z : Z >y : Y >x : X diff --git a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types index d5530f98fe854..026c8f4227218 100644 --- a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types +++ b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types @@ -31,21 +31,21 @@ var b: B; //Cond ? Expr1 : Expr2, Expr1 is supertype //Be Not contextually typed true ? x : a; ->true ? x : a : X | A +>true ? x : a : X >true : boolean >x : X >a : A var result1 = true ? x : a; ->result1 : X | A ->true ? x : a : X | A +>result1 : X +>true ? x : a : X >true : boolean >x : X >a : A //Expr1 and Expr2 are literals true ? {} : 1; ->true ? {} : 1 : {} | number +>true ? {} : 1 : {} >true : boolean >{} : {} >1 : number @@ -63,8 +63,8 @@ true ? { a: 1 } : { a: 2, b: 'string' }; >'string' : string var result2 = true ? {} : 1; ->result2 : {} | number ->true ? {} : 1 : {} | number +>result2 : {} +>true ? {} : 1 : {} >true : boolean >{} : {} >1 : number @@ -86,7 +86,7 @@ var result3 = true ? { a: 1 } : { a: 2, b: 'string' }; var resultIsX1: X = true ? x : a; >resultIsX1 : X >X : X ->true ? x : a : X | A +>true ? x : a : X >true : boolean >x : X >a : A @@ -95,7 +95,7 @@ var result4: (t: A) => any = true ? (m) => m.propertyX : (n) => n.propertyA; >result4 : (t: A) => any >t : A >A : A ->true ? (m) => m.propertyX : (n) => n.propertyA : ((m: A) => any) | ((n: A) => number) +>true ? (m) => m.propertyX : (n) => n.propertyA : (m: A) => any >true : boolean >(m) => m.propertyX : (m: A) => any >m : A @@ -111,21 +111,21 @@ var result4: (t: A) => any = true ? (m) => m.propertyX : (n) => n.propertyA; //Cond ? Expr1 : Expr2, Expr2 is supertype //Be Not contextually typed true ? a : x; ->true ? a : x : A | X +>true ? a : x : X >true : boolean >a : A >x : X var result5 = true ? a : x; ->result5 : A | X ->true ? a : x : A | X +>result5 : X +>true ? a : x : X >true : boolean >a : A >x : X //Expr1 and Expr2 are literals true ? 1 : {}; ->true ? 1 : {} : number | {} +>true ? 1 : {} : {} >true : boolean >1 : number >{} : {} @@ -143,8 +143,8 @@ true ? { a: 2, b: 'string' } : { a: 1 }; >1 : number var result6 = true ? 1 : {}; ->result6 : number | {} ->true ? 1 : {} : number | {} +>result6 : {} +>true ? 1 : {} : {} >true : boolean >1 : number >{} : {} @@ -166,7 +166,7 @@ var result7 = true ? { a: 2, b: 'string' } : { a: 1 }; var resultIsX2: X = true ? x : a; >resultIsX2 : X >X : X ->true ? x : a : X | A +>true ? x : a : X >true : boolean >x : X >a : A @@ -175,7 +175,7 @@ var result8: (t: A) => any = true ? (m) => m.propertyA : (n) => n.propertyX; >result8 : (t: A) => any >t : A >A : A ->true ? (m) => m.propertyA : (n) => n.propertyX : ((m: A) => number) | ((n: A) => any) +>true ? (m) => m.propertyA : (n) => n.propertyX : (n: A) => any >true : boolean >(m) => m.propertyA : (m: A) => number >m : A diff --git a/tests/baselines/reference/contextualTypingArrayOfLambdas.types b/tests/baselines/reference/contextualTypingArrayOfLambdas.types index 0bb6160433627..d3e5b9942e37a 100644 --- a/tests/baselines/reference/contextualTypingArrayOfLambdas.types +++ b/tests/baselines/reference/contextualTypingArrayOfLambdas.types @@ -23,8 +23,8 @@ class C extends A { } var xs = [(x: A) => { }, (x: B) => { }, (x: C) => { }]; ->xs : (((x: A) => void) | ((x: B) => void) | ((x: C) => void))[] ->[(x: A) => { }, (x: B) => { }, (x: C) => { }] : (((x: A) => void) | ((x: B) => void) | ((x: C) => void))[] +>xs : ((x: A) => void)[] +>[(x: A) => { }, (x: B) => { }, (x: C) => { }] : ((x: A) => void)[] >(x: A) => { } : (x: A) => void >x : A >A : A diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt b/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt index 098afe94b471c..53ecb88363df4 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt @@ -7,7 +7,7 @@ tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDec tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(40,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(43,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(46,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. -tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(47,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | C2 | D)[]'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(47,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(50,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(53,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. @@ -79,7 +79,7 @@ tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDec !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. for( var arr = [new C(), new C2(), new D()];;){} ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | C2 | D)[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. for(var arr2 = [new D()];;){} for( var arr2 = new Array>();;){} diff --git a/tests/baselines/reference/functionImplementations.types b/tests/baselines/reference/functionImplementations.types index 4facd65bda774..1398e2974f09b 100644 --- a/tests/baselines/reference/functionImplementations.types +++ b/tests/baselines/reference/functionImplementations.types @@ -342,7 +342,7 @@ var f7: (x: number) => string | number = x => { // should be (x: number) => numb var f8: (x: number) => any = x => { // should be (x: number) => Base >f8 : (x: number) => any >x : number ->x => { // should be (x: number) => Base return new Base(); return new Derived2();} : (x: number) => Base | Derived2 +>x => { // should be (x: number) => Base return new Base(); return new Derived2();} : (x: number) => Base >x : number return new Base(); @@ -356,7 +356,7 @@ var f8: (x: number) => any = x => { // should be (x: number) => Base var f9: (x: number) => any = x => { // should be (x: number) => Base >f9 : (x: number) => any >x : number ->x => { // should be (x: number) => Base return new Base(); return new Derived(); return new Derived2();} : (x: number) => Base | Derived | Derived2 +>x => { // should be (x: number) => Base return new Base(); return new Derived(); return new Derived2();} : (x: number) => Base >x : number return new Base(); diff --git a/tests/baselines/reference/generatedContextualTyping.types b/tests/baselines/reference/generatedContextualTyping.types index 06745d0d7aa06..e8f434d31a88c 100644 --- a/tests/baselines/reference/generatedContextualTyping.types +++ b/tests/baselines/reference/generatedContextualTyping.types @@ -2125,8 +2125,8 @@ var x216 = >{ func: n => { return [d1, d2]; } }; >d2 : Derived2 var x217 = (<() => Base[]>undefined) || function() { return [d1, d2] }; ->x217 : (() => Base[]) | (() => (Derived1 | Derived2)[]) ->(<() => Base[]>undefined) || function() { return [d1, d2] } : (() => Base[]) | (() => (Derived1 | Derived2)[]) +>x217 : () => Base[] +>(<() => Base[]>undefined) || function() { return [d1, d2] } : () => Base[] >(<() => Base[]>undefined) : () => Base[] ><() => Base[]>undefined : () => Base[] >Base : Base @@ -2137,8 +2137,8 @@ var x217 = (<() => Base[]>undefined) || function() { return [d1, d2] }; >d2 : Derived2 var x218 = (<() => Base[]>undefined) || function named() { return [d1, d2] }; ->x218 : (() => Base[]) | (() => (Derived1 | Derived2)[]) ->(<() => Base[]>undefined) || function named() { return [d1, d2] } : (() => Base[]) | (() => (Derived1 | Derived2)[]) +>x218 : () => Base[] +>(<() => Base[]>undefined) || function named() { return [d1, d2] } : () => Base[] >(<() => Base[]>undefined) : () => Base[] ><() => Base[]>undefined : () => Base[] >Base : Base @@ -2150,8 +2150,8 @@ var x218 = (<() => Base[]>undefined) || function named() { return [d1, d2] }; >d2 : Derived2 var x219 = (<{ (): Base[]; }>undefined) || function() { return [d1, d2] }; ->x219 : (() => Base[]) | (() => (Derived1 | Derived2)[]) ->(<{ (): Base[]; }>undefined) || function() { return [d1, d2] } : (() => Base[]) | (() => (Derived1 | Derived2)[]) +>x219 : () => Base[] +>(<{ (): Base[]; }>undefined) || function() { return [d1, d2] } : () => Base[] >(<{ (): Base[]; }>undefined) : () => Base[] ><{ (): Base[]; }>undefined : () => Base[] >Base : Base @@ -2162,8 +2162,8 @@ var x219 = (<{ (): Base[]; }>undefined) || function() { return [d1, d2] }; >d2 : Derived2 var x220 = (<{ (): Base[]; }>undefined) || function named() { return [d1, d2] }; ->x220 : (() => Base[]) | (() => (Derived1 | Derived2)[]) ->(<{ (): Base[]; }>undefined) || function named() { return [d1, d2] } : (() => Base[]) | (() => (Derived1 | Derived2)[]) +>x220 : () => Base[] +>(<{ (): Base[]; }>undefined) || function named() { return [d1, d2] } : () => Base[] >(<{ (): Base[]; }>undefined) : () => Base[] ><{ (): Base[]; }>undefined : () => Base[] >Base : Base @@ -2175,8 +2175,8 @@ var x220 = (<{ (): Base[]; }>undefined) || function named() { return [d1, d2] }; >d2 : Derived2 var x221 = (undefined) || [d1, d2]; ->x221 : Base[] | (Derived1 | Derived2)[] ->(undefined) || [d1, d2] : Base[] | (Derived1 | Derived2)[] +>x221 : Base[] +>(undefined) || [d1, d2] : Base[] >(undefined) : Base[] >undefined : Base[] >Base : Base @@ -2186,8 +2186,8 @@ var x221 = (undefined) || [d1, d2]; >d2 : Derived2 var x222 = (>undefined) || [d1, d2]; ->x222 : Base[] | (Derived1 | Derived2)[] ->(>undefined) || [d1, d2] : Base[] | (Derived1 | Derived2)[] +>x222 : Base[] +>(>undefined) || [d1, d2] : Base[] >(>undefined) : Base[] >>undefined : Base[] >Array : T[] @@ -2198,8 +2198,8 @@ var x222 = (>undefined) || [d1, d2]; >d2 : Derived2 var x223 = (<{ [n: number]: Base; }>undefined) || [d1, d2]; ->x223 : { [n: number]: Base; } | (Derived1 | Derived2)[] ->(<{ [n: number]: Base; }>undefined) || [d1, d2] : { [n: number]: Base; } | (Derived1 | Derived2)[] +>x223 : { [n: number]: Base; } +>(<{ [n: number]: Base; }>undefined) || [d1, d2] : { [n: number]: Base; } >(<{ [n: number]: Base; }>undefined) : { [n: number]: Base; } ><{ [n: number]: Base; }>undefined : { [n: number]: Base; } >n : number @@ -2210,8 +2210,8 @@ var x223 = (<{ [n: number]: Base; }>undefined) || [d1, d2]; >d2 : Derived2 var x224 = (<{n: Base[]; } >undefined) || { n: [d1, d2] }; ->x224 : { n: Base[]; } | { n: (Derived1 | Derived2)[]; } ->(<{n: Base[]; } >undefined) || { n: [d1, d2] } : { n: Base[]; } | { n: (Derived1 | Derived2)[]; } +>x224 : { n: Base[]; } +>(<{n: Base[]; } >undefined) || { n: [d1, d2] } : { n: Base[]; } >(<{n: Base[]; } >undefined) : { n: Base[]; } ><{n: Base[]; } >undefined : { n: Base[]; } >n : Base[] diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.types b/tests/baselines/reference/heterogeneousArrayLiterals.types index 952200d74f89c..c760e5a566f3e 100644 --- a/tests/baselines/reference/heterogeneousArrayLiterals.types +++ b/tests/baselines/reference/heterogeneousArrayLiterals.types @@ -21,14 +21,14 @@ var c = [1, '', null]; // {}[] >null : null var d = [{}, 1]; // {}[] ->d : ({} | number)[] ->[{}, 1] : ({} | number)[] +>d : {}[] +>[{}, 1] : {}[] >{} : {} >1 : number var e = [{}, Object]; // {}[] ->e : ({} | ObjectConstructor)[] ->[{}, Object] : ({} | ObjectConstructor)[] +>e : {}[] +>[{}, Object] : {}[] >{} : {} >Object : ObjectConstructor @@ -88,16 +88,16 @@ var k = [() => 1, () => 1]; // { (): number }[] >1 : number var l = [() => 1, () => null]; // { (): any }[] ->l : ((() => number) | (() => any))[] ->[() => 1, () => null] : ((() => number) | (() => any))[] +>l : (() => any)[] +>[() => 1, () => null] : (() => any)[] >() => 1 : () => number >1 : number >() => null : () => any >null : null var m = [() => 1, () => '', () => null]; // { (): any }[] ->m : ((() => number) | (() => string) | (() => any))[] ->[() => 1, () => '', () => null] : ((() => number) | (() => string) | (() => any))[] +>m : (() => any)[] +>[() => 1, () => '', () => null] : (() => any)[] >() => 1 : () => number >1 : number >() => '' : () => string @@ -169,8 +169,8 @@ module Derived { >derived : Derived var j = [() => base, () => derived]; // { {}: Base } ->j : ((() => Base) | (() => Derived))[] ->[() => base, () => derived] : ((() => Base) | (() => Derived))[] +>j : (() => Base)[] +>[() => base, () => derived] : (() => Base)[] >() => base : () => Base >base : Base >() => derived : () => Derived @@ -185,16 +185,16 @@ module Derived { >1 : number var l = [() => base, () => null]; // { (): any }[] ->l : ((() => Base) | (() => any))[] ->[() => base, () => null] : ((() => Base) | (() => any))[] +>l : (() => any)[] +>[() => base, () => null] : (() => any)[] >() => base : () => Base >base : Base >() => null : () => any >null : null var m = [() => base, () => derived, () => null]; // { (): any }[] ->m : ((() => Base) | (() => Derived) | (() => any))[] ->[() => base, () => derived, () => null] : ((() => Base) | (() => Derived) | (() => any))[] +>m : (() => any)[] +>[() => base, () => derived, () => null] : (() => any)[] >() => base : () => Base >base : Base >() => derived : () => Derived @@ -203,8 +203,8 @@ module Derived { >null : null var n = [[() => base], [() => derived]]; // { (): Base }[] ->n : ((() => Base)[] | (() => Derived)[])[] ->[[() => base], [() => derived]] : ((() => Base)[] | (() => Derived)[])[] +>n : (() => Base)[][] +>[[() => base], [() => derived]] : (() => Base)[][] >[() => base] : (() => Base)[] >() => base : () => Base >base : Base @@ -219,8 +219,8 @@ module Derived { >derived2 : Derived2 var p = [derived, derived2, base]; // Base[] ->p : (Derived | Derived2 | Base)[] ->[derived, derived2, base] : (Derived | Derived2 | Base)[] +>p : Base[] +>[derived, derived2, base] : Base[] >derived : Derived >derived2 : Derived2 >base : Base @@ -310,8 +310,8 @@ function foo(t: T, u: U) { >u : U var f = [() => t, () => u, () => null]; // { (): any }[] ->f : ((() => T) | (() => U) | (() => any))[] ->[() => t, () => u, () => null] : ((() => T) | (() => U) | (() => any))[] +>f : (() => any)[] +>[() => t, () => u, () => null] : (() => any)[] >() => t : () => T >t : T >() => u : () => U @@ -364,8 +364,8 @@ function foo2(t: T, u: U) { >u : U var f = [() => t, () => u, () => null]; // { (): any }[] ->f : ((() => T) | (() => U) | (() => any))[] ->[() => t, () => u, () => null] : ((() => T) | (() => U) | (() => any))[] +>f : (() => any)[] +>[() => t, () => u, () => null] : (() => any)[] >() => t : () => T >t : T >() => u : () => U @@ -374,8 +374,8 @@ function foo2(t: T, u: U) { >null : null var g = [t, base]; // Base[] ->g : (T | Base)[] ->[t, base] : (T | Base)[] +>g : Base[] +>[t, base] : Base[] >t : T >base : Base @@ -386,14 +386,14 @@ function foo2(t: T, u: U) { >derived : Derived var i = [u, base]; // Base[] ->i : (U | Base)[] ->[u, base] : (U | Base)[] +>i : Base[] +>[u, base] : Base[] >u : U >base : Base var j = [u, derived]; // Derived[] ->j : (U | Derived)[] ->[u, derived] : (U | Derived)[] +>j : Derived[] +>[u, derived] : Derived[] >u : U >derived : Derived } @@ -442,8 +442,8 @@ function foo3(t: T, u: U) { >u : U var f = [() => t, () => u, () => null]; // { (): any }[] ->f : ((() => T) | (() => U) | (() => any))[] ->[() => t, () => u, () => null] : ((() => T) | (() => U) | (() => any))[] +>f : (() => any)[] +>[() => t, () => u, () => null] : (() => any)[] >() => t : () => T >t : T >() => u : () => U @@ -452,26 +452,26 @@ function foo3(t: T, u: U) { >null : null var g = [t, base]; // Base[] ->g : (T | Base)[] ->[t, base] : (T | Base)[] +>g : Base[] +>[t, base] : Base[] >t : T >base : Base var h = [t, derived]; // Derived[] ->h : (T | Derived)[] ->[t, derived] : (T | Derived)[] +>h : Derived[] +>[t, derived] : Derived[] >t : T >derived : Derived var i = [u, base]; // Base[] ->i : (U | Base)[] ->[u, base] : (U | Base)[] +>i : Base[] +>[u, base] : Base[] >u : U >base : Base var j = [u, derived]; // Derived[] ->j : (U | Derived)[] ->[u, derived] : (U | Derived)[] +>j : Derived[] +>[u, derived] : Derived[] >u : U >derived : Derived } @@ -520,8 +520,8 @@ function foo4(t: T, u: U) { >u : U var f = [() => t, () => u, () => null]; // { (): any }[] ->f : ((() => T) | (() => U) | (() => any))[] ->[() => t, () => u, () => null] : ((() => T) | (() => U) | (() => any))[] +>f : (() => any)[] +>[() => t, () => u, () => null] : (() => any)[] >() => t : () => T >t : T >() => u : () => U @@ -530,8 +530,8 @@ function foo4(t: T, u: U) { >null : null var g = [t, base]; // Base[] ->g : (T | Base)[] ->[t, base] : (T | Base)[] +>g : Base[] +>[t, base] : Base[] >t : T >base : Base @@ -542,8 +542,8 @@ function foo4(t: T, u: U) { >derived : Derived var i = [u, base]; // Base[] ->i : (U | Base)[] ->[u, base] : (U | Base)[] +>i : Base[] +>[u, base] : Base[] >u : U >base : Base diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt b/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt index 0c4b95214b02d..3ec718f3b25fe 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt @@ -7,7 +7,7 @@ tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDec tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(43,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(46,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. -tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(47,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | C2 | D)[]'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(47,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(50,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(53,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. @@ -79,7 +79,7 @@ tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDec !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. var arr = [new C(), new C2(), new D()]; ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | C2 | D)[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. var arr2 = [new D()]; var arr2 = new Array>(); diff --git a/tests/baselines/reference/logicalOrOperatorWithEveryType.types b/tests/baselines/reference/logicalOrOperatorWithEveryType.types index 04bc188e308ef..4540e35aaf459 100644 --- a/tests/baselines/reference/logicalOrOperatorWithEveryType.types +++ b/tests/baselines/reference/logicalOrOperatorWithEveryType.types @@ -187,8 +187,8 @@ var rc5 = a5 || a3; // void || number is void | number >a3 : number var rc6 = a6 || a3; // enum || number is number ->rc6 : E | number ->a6 || a3 : E | number +>rc6 : number +>a6 || a3 : number >a6 : E >a3 : number @@ -349,8 +349,8 @@ var rg2 = a2 || a6; // boolean || enum is boolean | enum >a6 : E var rg3 = a3 || a6; // number || enum is number ->rg3 : number | E ->a3 || a6 : number | E +>rg3 : number +>a3 || a6 : number >a3 : number >a6 : E diff --git a/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types b/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types index df8f6cac6db78..f887ad7ae140c 100644 --- a/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types +++ b/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types @@ -107,8 +107,8 @@ function fn3u : U var r3 = t || { a: '' }; ->r3 : T | { a: string; } ->t || { a: '' } : T | { a: string; } +>r3 : { a: string; } +>t || { a: '' } : { a: string; } >t : T >{ a: '' } : { a: string; } >a : string diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt index 71e164d5d6252..ff18160e9a50e 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(16,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(25,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(34,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(39,5): error TS2322: Type '{ [x: number]: A | B | number; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(39,5): error TS2322: Type '{ [x: number]: A | number; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. Index signatures are incompatible. - Type 'A | B | number' is not assignable to type 'A'. + Type 'A | number' is not assignable to type 'A'. Type 'number' is not assignable to type 'A'. @@ -54,9 +54,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo // error var b: { [x: number]: A } = { ~ -!!! error TS2322: Type '{ [x: number]: A | B | number; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. +!!! error TS2322: Type '{ [x: number]: A | number; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'A | B | number' is not assignable to type 'A'. +!!! error TS2322: Type 'A | number' is not assignable to type 'A'. !!! error TS2322: Type 'number' is not assignable to type 'A'. 1.0: new A(), 2.0: new B(), diff --git a/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt b/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt index edb6d031b1fa3..c35e49f02a31f 100644 --- a/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ [x: string]: B | A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. +tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. Index signatures are incompatible. Type 'A' is not assignable to type 'B'. @@ -18,7 +18,7 @@ tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ var o1: { [s: string]: A;[n: number]: B; } = { x: b, 0: a }; // both indexers are A ~~ -!!! error TS2322: Type '{ [x: string]: B | A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. +!!! error TS2322: Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'A' is not assignable to type 'B'. o1 = { x: c, 0: a }; // string indexer is any, number indexer is A \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralIndexers.types b/tests/baselines/reference/objectLiteralIndexers.types index 55cec857c7098..d5add00ebafb6 100644 --- a/tests/baselines/reference/objectLiteralIndexers.types +++ b/tests/baselines/reference/objectLiteralIndexers.types @@ -31,7 +31,7 @@ var o1: { [s: string]: A;[n: number]: B; } = { x: a, 0: b }; // string indexer i >A : A >n : number >B : B ->{ x: a, 0: b } : { [x: string]: A | B; [x: number]: B; 0: B; x: A; } +>{ x: a, 0: b } : { [x: string]: A; [x: number]: B; 0: B; x: A; } >x : A >a : A >b : B diff --git a/tests/baselines/reference/parenthesizedContexualTyping1.types b/tests/baselines/reference/parenthesizedContexualTyping1.types index 1423901a28fcb..61ec1a24ec5bb 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping1.types +++ b/tests/baselines/reference/parenthesizedContexualTyping1.types @@ -149,8 +149,8 @@ var i = fun((Math.random() < 0.5 ? x => x : x => undefined), 10); >i : number >fun((Math.random() < 0.5 ? x => x : x => undefined), 10) : number >fun : { (g: (x: T) => T, x: T): T; (g: (x: T) => T, h: (y: T) => T, x: T): T; } ->(Math.random() < 0.5 ? x => x : x => undefined) : ((x: number) => number) | ((x: number) => any) ->Math.random() < 0.5 ? x => x : x => undefined : ((x: number) => number) | ((x: number) => any) +>(Math.random() < 0.5 ? x => x : x => undefined) : (x: number) => any +>Math.random() < 0.5 ? x => x : x => undefined : (x: number) => any >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -169,8 +169,8 @@ var j = fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), 10); >j : number >fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), 10) : number >fun : { (g: (x: T) => T, x: T): T; (g: (x: T) => T, h: (y: T) => T, x: T): T; } ->(Math.random() < 0.5 ? (x => x) : (x => undefined)) : ((x: number) => number) | ((x: number) => any) ->Math.random() < 0.5 ? (x => x) : (x => undefined) : ((x: number) => number) | ((x: number) => any) +>(Math.random() < 0.5 ? (x => x) : (x => undefined)) : (x: number) => any +>Math.random() < 0.5 ? (x => x) : (x => undefined) : (x: number) => any >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -191,8 +191,8 @@ var k = fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), x => x, 10); >k : number >fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), x => x, 10) : number >fun : { (g: (x: T) => T, x: T): T; (g: (x: T) => T, h: (y: T) => T, x: T): T; } ->(Math.random() < 0.5 ? (x => x) : (x => undefined)) : ((x: number) => number) | ((x: number) => any) ->Math.random() < 0.5 ? (x => x) : (x => undefined) : ((x: number) => number) | ((x: number) => any) +>(Math.random() < 0.5 ? (x => x) : (x => undefined)) : (x: number) => any +>Math.random() < 0.5 ? (x => x) : (x => undefined) : (x: number) => any >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -216,9 +216,9 @@ var l = fun(((Math.random() < 0.5 ? ((x => x)) : ((x => undefined)))), ((x => x) >l : number >fun(((Math.random() < 0.5 ? ((x => x)) : ((x => undefined)))), ((x => x)), 10) : number >fun : { (g: (x: T) => T, x: T): T; (g: (x: T) => T, h: (y: T) => T, x: T): T; } ->((Math.random() < 0.5 ? ((x => x)) : ((x => undefined)))) : ((x: number) => number) | ((x: number) => any) ->(Math.random() < 0.5 ? ((x => x)) : ((x => undefined))) : ((x: number) => number) | ((x: number) => any) ->Math.random() < 0.5 ? ((x => x)) : ((x => undefined)) : ((x: number) => number) | ((x: number) => any) +>((Math.random() < 0.5 ? ((x => x)) : ((x => undefined)))) : (x: number) => any +>(Math.random() < 0.5 ? ((x => x)) : ((x => undefined))) : (x: number) => any +>Math.random() < 0.5 ? ((x => x)) : ((x => undefined)) : (x: number) => any >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number diff --git a/tests/baselines/reference/parenthesizedContexualTyping2.types b/tests/baselines/reference/parenthesizedContexualTyping2.types index 344933ea1fc8c..a055f2f1bbd6f 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping2.types +++ b/tests/baselines/reference/parenthesizedContexualTyping2.types @@ -186,8 +186,8 @@ var i = fun((Math.random() < 0.5 ? x => { x(undefined); return x; } : x >i : number >fun((Math.random() < 0.5 ? x => { x(undefined); return x; } : x => undefined), 10) : number >fun : { (f: (x: (p: T) => T) => (p: T) => T, x: T): T; (f: (x: (p: T) => T) => (p: T) => T, g: (x: (p: T) => T) => (p: T) => T, x: T): T; } ->(Math.random() < 0.5 ? x => { x(undefined); return x; } : x => undefined) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) ->Math.random() < 0.5 ? x => { x(undefined); return x; } : x => undefined : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) +>(Math.random() < 0.5 ? x => { x(undefined); return x; } : x => undefined) : (x: (p: T) => T) => any +>Math.random() < 0.5 ? x => { x(undefined); return x; } : x => undefined : (x: (p: T) => T) => any >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -209,8 +209,8 @@ var j = fun((Math.random() < 0.5 ? (x => { x(undefined); return x; }) : >j : number >fun((Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)), 10) : number >fun : { (f: (x: (p: T) => T) => (p: T) => T, x: T): T; (f: (x: (p: T) => T) => (p: T) => T, g: (x: (p: T) => T) => (p: T) => T, x: T): T; } ->(Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) ->Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) +>(Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)) : (x: (p: T) => T) => any +>Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined) : (x: (p: T) => T) => any >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -234,8 +234,8 @@ var k = fun((Math.random() < 0.5 ? (x => { x(undefined); return x; }) : >k : number >fun((Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)), x => { x(undefined); return x; }, 10) : number >fun : { (f: (x: (p: T) => T) => (p: T) => T, x: T): T; (f: (x: (p: T) => T) => (p: T) => T, g: (x: (p: T) => T) => (p: T) => T, x: T): T; } ->(Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) ->Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) +>(Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)) : (x: (p: T) => T) => any +>Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined) : (x: (p: T) => T) => any >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -265,9 +265,9 @@ var l = fun(((Math.random() < 0.5 ? ((x => { x(undefined); return x; })) >l : number >fun(((Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined)))),((x => { x(undefined); return x; })), 10) : number >fun : { (f: (x: (p: T) => T) => (p: T) => T, x: T): T; (f: (x: (p: T) => T) => (p: T) => T, g: (x: (p: T) => T) => (p: T) => T, x: T): T; } ->((Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined)))) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) ->(Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined))) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) ->Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined)) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) +>((Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined)))) : (x: (p: T) => T) => any +>(Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined))) : (x: (p: T) => T) => any +>Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined)) : (x: (p: T) => T) => any >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt index e6cba35be257e..1f4ee3debed75 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt @@ -22,9 +22,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(71,5): error TS2411: Property 'foo' of type '() => string' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(73,5): error TS2411: Property '"4.0"' of type 'number' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(74,5): error TS2411: Property 'f' of type 'MyString' is not assignable to string index type 'string'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: string]: string | number | (() => void) | MyString | (() => string); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: string]: string | number | (() => void) | MyString; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. Index signatures are incompatible. - Type 'string | number | (() => void) | MyString | (() => string)' is not assignable to type 'string'. + Type 'string | number | (() => void) | MyString' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -160,9 +160,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon // error var b: { [x: string]: string; } = { ~ -!!! error TS2322: Type '{ [x: string]: string | number | (() => void) | MyString | (() => string); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. +!!! error TS2322: Type '{ [x: string]: string | number | (() => void) | MyString; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'string | number | (() => void) | MyString | (() => string)' is not assignable to type 'string'. +!!! error TS2322: Type 'string | number | (() => void) | MyString' is not assignable to type 'string'. !!! error TS2322: Type 'number' is not assignable to type 'string'. a: '', b: 1, diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt index 13d5adcf1f5ed..faef790545368 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt @@ -4,11 +4,10 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(24,5): error TS2411: Property 'd' of type 'string' is not assignable to string index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(31,5): error TS2411: Property 'c' of type 'number' is not assignable to string index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(32,5): error TS2411: Property 'd' of type 'string' is not assignable to string index type 'A'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(36,5): error TS2322: Type '{ [x: string]: typeof A | typeof B; a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(36,5): error TS2322: Type '{ [x: string]: typeof A; a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. Index signatures are incompatible. - Type 'typeof A | typeof B' is not assignable to type 'A'. - Type 'typeof A' is not assignable to type 'A'. - Property 'foo' is missing in type 'typeof A'. + Type 'typeof A' is not assignable to type 'A'. + Property 'foo' is missing in type 'typeof A'. ==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts (7 errors) ==== @@ -61,11 +60,10 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon // error var b: { [x: string]: A } = { ~ -!!! error TS2322: Type '{ [x: string]: typeof A | typeof B; a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. +!!! error TS2322: Type '{ [x: string]: typeof A; a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'typeof A | typeof B' is not assignable to type 'A'. -!!! error TS2322: Type 'typeof A' is not assignable to type 'A'. -!!! error TS2322: Property 'foo' is missing in type 'typeof A'. +!!! error TS2322: Type 'typeof A' is not assignable to type 'A'. +!!! error TS2322: Property 'foo' is missing in type 'typeof A'. a: A, b: B } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithCallSignatures2.types b/tests/baselines/reference/subtypingWithCallSignatures2.types index e43382766acae..b72993e7bea1c 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures2.types +++ b/tests/baselines/reference/subtypingWithCallSignatures2.types @@ -331,14 +331,14 @@ var r1 = foo1(r1arg1); // any, return types are not subtype of first overload >r1arg1 : (x: T) => T[] var r1a = [r1arg2, r1arg1]; // generic signature, subtype in both directions ->r1a : (((x: number) => number[]) | ((x: T) => T[]))[] ->[r1arg2, r1arg1] : (((x: number) => number[]) | ((x: T) => T[]))[] +>r1a : ((x: T) => T[])[] +>[r1arg2, r1arg1] : ((x: T) => T[])[] >r1arg2 : (x: number) => number[] >r1arg1 : (x: T) => T[] var r1b = [r1arg1, r1arg2]; // generic signature, subtype in both directions ->r1b : (((x: T) => T[]) | ((x: number) => number[]))[] ->[r1arg1, r1arg2] : (((x: T) => T[]) | ((x: number) => number[]))[] +>r1b : ((x: T) => T[])[] +>[r1arg1, r1arg2] : ((x: T) => T[])[] >r1arg1 : (x: T) => T[] >r1arg2 : (x: number) => number[] @@ -365,14 +365,14 @@ var r2 = foo2(r2arg1); >r2arg1 : (x: T) => string[] var r2a = [r2arg1, r2arg2]; ->r2a : (((x: T) => string[]) | ((x: number) => string[]))[] ->[r2arg1, r2arg2] : (((x: T) => string[]) | ((x: number) => string[]))[] +>r2a : ((x: T) => string[])[] +>[r2arg1, r2arg2] : ((x: T) => string[])[] >r2arg1 : (x: T) => string[] >r2arg2 : (x: number) => string[] var r2b = [r2arg2, r2arg1]; ->r2b : (((x: number) => string[]) | ((x: T) => string[]))[] ->[r2arg2, r2arg1] : (((x: number) => string[]) | ((x: T) => string[]))[] +>r2b : ((x: number) => string[])[] +>[r2arg2, r2arg1] : ((x: number) => string[])[] >r2arg2 : (x: number) => string[] >r2arg1 : (x: T) => string[] @@ -396,14 +396,14 @@ var r3 = foo3(r3arg1); >r3arg1 : (x: T) => T var r3a = [r3arg1, r3arg2]; ->r3a : (((x: T) => T) | ((x: number) => void))[] ->[r3arg1, r3arg2] : (((x: T) => T) | ((x: number) => void))[] +>r3a : ((x: T) => T)[] +>[r3arg1, r3arg2] : ((x: T) => T)[] >r3arg1 : (x: T) => T >r3arg2 : (x: number) => void var r3b = [r3arg2, r3arg1]; ->r3b : (((x: number) => void) | ((x: T) => T))[] ->[r3arg2, r3arg1] : (((x: number) => void) | ((x: T) => T))[] +>r3b : ((x: number) => void)[] +>[r3arg2, r3arg1] : ((x: number) => void)[] >r3arg2 : (x: number) => void >r3arg1 : (x: T) => T @@ -432,14 +432,14 @@ var r4 = foo4(r4arg1); // any >r4arg1 : (x: T, y: U) => T var r4a = [r4arg1, r4arg2]; ->r4a : (((x: T, y: U) => T) | ((x: string, y: number) => string))[] ->[r4arg1, r4arg2] : (((x: T, y: U) => T) | ((x: string, y: number) => string))[] +>r4a : ((x: T, y: U) => T)[] +>[r4arg1, r4arg2] : ((x: T, y: U) => T)[] >r4arg1 : (x: T, y: U) => T >r4arg2 : (x: string, y: number) => string var r4b = [r4arg2, r4arg1]; ->r4b : (((x: string, y: number) => string) | ((x: T, y: U) => T))[] ->[r4arg2, r4arg1] : (((x: string, y: number) => string) | ((x: T, y: U) => T))[] +>r4b : ((x: T, y: U) => T)[] +>[r4arg2, r4arg1] : ((x: T, y: U) => T)[] >r4arg2 : (x: string, y: number) => string >r4arg1 : (x: T, y: U) => T @@ -470,14 +470,14 @@ var r5 = foo5(r5arg1); // any >r5arg1 : (x: (arg: T) => U) => T var r5a = [r5arg1, r5arg2]; ->r5a : (((x: (arg: T) => U) => T) | ((x: (arg: string) => number) => string))[] ->[r5arg1, r5arg2] : (((x: (arg: T) => U) => T) | ((x: (arg: string) => number) => string))[] +>r5a : ((x: (arg: T) => U) => T)[] +>[r5arg1, r5arg2] : ((x: (arg: T) => U) => T)[] >r5arg1 : (x: (arg: T) => U) => T >r5arg2 : (x: (arg: string) => number) => string var r5b = [r5arg2, r5arg1]; ->r5b : (((x: (arg: string) => number) => string) | ((x: (arg: T) => U) => T))[] ->[r5arg2, r5arg1] : (((x: (arg: string) => number) => string) | ((x: (arg: T) => U) => T))[] +>r5b : ((x: (arg: T) => U) => T)[] +>[r5arg2, r5arg1] : ((x: (arg: T) => U) => T)[] >r5arg2 : (x: (arg: string) => number) => string >r5arg1 : (x: (arg: T) => U) => T @@ -514,14 +514,14 @@ var r6 = foo6(r6arg1); // any >r6arg1 : (x: (arg: T) => U) => T var r6a = [r6arg1, r6arg2]; ->r6a : (((x: (arg: T) => U) => T) | ((x: (arg: Base) => Derived) => Base))[] ->[r6arg1, r6arg2] : (((x: (arg: T) => U) => T) | ((x: (arg: Base) => Derived) => Base))[] +>r6a : ((x: (arg: T) => U) => T)[] +>[r6arg1, r6arg2] : ((x: (arg: T) => U) => T)[] >r6arg1 : (x: (arg: T) => U) => T >r6arg2 : (x: (arg: Base) => Derived) => Base var r6b = [r6arg2, r6arg1]; ->r6b : (((x: (arg: Base) => Derived) => Base) | ((x: (arg: T) => U) => T))[] ->[r6arg2, r6arg1] : (((x: (arg: Base) => Derived) => Base) | ((x: (arg: T) => U) => T))[] +>r6b : ((x: (arg: T) => U) => T)[] +>[r6arg2, r6arg1] : ((x: (arg: T) => U) => T)[] >r6arg2 : (x: (arg: Base) => Derived) => Base >r6arg1 : (x: (arg: T) => U) => T @@ -564,14 +564,14 @@ var r7 = foo7(r7arg1); // any >r7arg1 : (x: (arg: T) => U) => (r: T) => U var r7a = [r7arg1, r7arg2]; ->r7a : (((x: (arg: T) => U) => (r: T) => U) | ((x: (arg: Base) => Derived) => (r: Base) => Derived))[] ->[r7arg1, r7arg2] : (((x: (arg: T) => U) => (r: T) => U) | ((x: (arg: Base) => Derived) => (r: Base) => Derived))[] +>r7a : ((x: (arg: T) => U) => (r: T) => U)[] +>[r7arg1, r7arg2] : ((x: (arg: T) => U) => (r: T) => U)[] >r7arg1 : (x: (arg: T) => U) => (r: T) => U >r7arg2 : (x: (arg: Base) => Derived) => (r: Base) => Derived var r7b = [r7arg2, r7arg1]; ->r7b : (((x: (arg: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U) => (r: T) => U))[] ->[r7arg2, r7arg1] : (((x: (arg: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U) => (r: T) => U))[] +>r7b : ((x: (arg: T) => U) => (r: T) => U)[] +>[r7arg2, r7arg1] : ((x: (arg: T) => U) => (r: T) => U)[] >r7arg2 : (x: (arg: Base) => Derived) => (r: Base) => Derived >r7arg1 : (x: (arg: T) => U) => (r: T) => U @@ -622,14 +622,14 @@ var r8 = foo8(r8arg1); // any >r8arg1 : (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U var r8a = [r8arg1, r8arg2]; ->r8a : (((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] ->[r8arg1, r8arg2] : (((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] +>r8a : ((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U)[] +>[r8arg1, r8arg2] : ((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U)[] >r8arg1 : (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U >r8arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived var r8b = [r8arg2, r8arg1]; ->r8b : (((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U))[] ->[r8arg2, r8arg1] : (((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U))[] +>r8b : ((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U)[] +>[r8arg2, r8arg1] : ((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U)[] >r8arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived >r8arg1 : (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U @@ -681,14 +681,14 @@ var r9 = foo9(r9arg1); // any >r9arg1 : (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U var r9a = [r9arg1, r9arg2]; ->r9a : (((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] ->[r9arg1, r9arg2] : (((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] +>r9a : ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U)[] +>[r9arg1, r9arg2] : ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U)[] >r9arg1 : (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U >r9arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived var r9b = [r9arg2, r9arg1]; ->r9b : (((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U))[] ->[r9arg2, r9arg1] : (((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U))[] +>r9b : ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U)[] +>[r9arg2, r9arg1] : ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U)[] >r9arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived >r9arg1 : (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U @@ -719,14 +719,14 @@ var r10 = foo10(r10arg1); // any >r10arg1 : (...x: T[]) => T var r10a = [r10arg1, r10arg2]; ->r10a : (((...x: T[]) => T) | ((...x: Derived[]) => Derived))[] ->[r10arg1, r10arg2] : (((...x: T[]) => T) | ((...x: Derived[]) => Derived))[] +>r10a : ((...x: T[]) => T)[] +>[r10arg1, r10arg2] : ((...x: T[]) => T)[] >r10arg1 : (...x: T[]) => T >r10arg2 : (...x: Derived[]) => Derived var r10b = [r10arg2, r10arg1]; ->r10b : (((...x: Derived[]) => Derived) | ((...x: T[]) => T))[] ->[r10arg2, r10arg1] : (((...x: Derived[]) => Derived) | ((...x: T[]) => T))[] +>r10b : ((...x: T[]) => T)[] +>[r10arg2, r10arg1] : ((...x: T[]) => T)[] >r10arg2 : (...x: Derived[]) => Derived >r10arg1 : (...x: T[]) => T @@ -760,14 +760,14 @@ var r11 = foo11(r11arg1); // any >r11arg1 : (x: T, y: T) => T var r11a = [r11arg1, r11arg2]; ->r11a : (((x: T, y: T) => T) | ((x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] ->[r11arg1, r11arg2] : (((x: T, y: T) => T) | ((x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] +>r11a : ((x: T, y: T) => T)[] +>[r11arg1, r11arg2] : ((x: T, y: T) => T)[] >r11arg1 : (x: T, y: T) => T >r11arg2 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base var r11b = [r11arg2, r11arg1]; ->r11b : (((x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | ((x: T, y: T) => T))[] ->[r11arg2, r11arg1] : (((x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | ((x: T, y: T) => T))[] +>r11b : ((x: T, y: T) => T)[] +>[r11arg2, r11arg1] : ((x: T, y: T) => T)[] >r11arg2 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base >r11arg1 : (x: T, y: T) => T @@ -808,14 +808,14 @@ var r12 = foo12(r12arg1); // any >r12arg1 : (x: Base[], y: T) => Derived[] var r12a = [r12arg1, r12arg2]; ->r12a : (((x: Base[], y: T) => Derived[]) | ((x: Base[], y: Derived2[]) => Derived[]))[] ->[r12arg1, r12arg2] : (((x: Base[], y: T) => Derived[]) | ((x: Base[], y: Derived2[]) => Derived[]))[] +>r12a : ((x: Base[], y: T) => Derived[])[] +>[r12arg1, r12arg2] : ((x: Base[], y: T) => Derived[])[] >r12arg1 : (x: Base[], y: T) => Derived[] >r12arg2 : (x: Base[], y: Derived2[]) => Derived[] var r12b = [r12arg2, r12arg1]; ->r12b : (((x: Base[], y: Derived2[]) => Derived[]) | ((x: Base[], y: T) => Derived[]))[] ->[r12arg2, r12arg1] : (((x: Base[], y: Derived2[]) => Derived[]) | ((x: Base[], y: T) => Derived[]))[] +>r12b : ((x: Base[], y: Derived2[]) => Derived[])[] +>[r12arg2, r12arg1] : ((x: Base[], y: Derived2[]) => Derived[])[] >r12arg2 : (x: Base[], y: Derived2[]) => Derived[] >r12arg1 : (x: Base[], y: T) => Derived[] @@ -853,14 +853,14 @@ var r13 = foo13(r13arg1); // any >r13arg1 : (x: Base[], y: T) => T var r13a = [r13arg1, r13arg2]; ->r13a : (((x: Base[], y: T) => T) | ((x: Base[], y: Derived[]) => Derived[]))[] ->[r13arg1, r13arg2] : (((x: Base[], y: T) => T) | ((x: Base[], y: Derived[]) => Derived[]))[] +>r13a : ((x: Base[], y: T) => T)[] +>[r13arg1, r13arg2] : ((x: Base[], y: T) => T)[] >r13arg1 : (x: Base[], y: T) => T >r13arg2 : (x: Base[], y: Derived[]) => Derived[] var r13b = [r13arg2, r13arg1]; ->r13b : (((x: Base[], y: Derived[]) => Derived[]) | ((x: Base[], y: T) => T))[] ->[r13arg2, r13arg1] : (((x: Base[], y: Derived[]) => Derived[]) | ((x: Base[], y: T) => T))[] +>r13b : ((x: Base[], y: T) => T)[] +>[r13arg2, r13arg1] : ((x: Base[], y: T) => T)[] >r13arg2 : (x: Base[], y: Derived[]) => Derived[] >r13arg1 : (x: Base[], y: T) => T @@ -894,14 +894,14 @@ var r14 = foo14(r14arg1); // any >r14arg1 : (x: { a: T; b: T; }) => T var r14a = [r14arg1, r14arg2]; ->r14a : (((x: { a: T; b: T; }) => T) | ((x: { a: string; b: number; }) => Object))[] ->[r14arg1, r14arg2] : (((x: { a: T; b: T; }) => T) | ((x: { a: string; b: number; }) => Object))[] +>r14a : ((x: { a: T; b: T; }) => T)[] +>[r14arg1, r14arg2] : ((x: { a: T; b: T; }) => T)[] >r14arg1 : (x: { a: T; b: T; }) => T >r14arg2 : (x: { a: string; b: number; }) => Object var r14b = [r14arg2, r14arg1]; ->r14b : (((x: { a: string; b: number; }) => Object) | ((x: { a: T; b: T; }) => T))[] ->[r14arg2, r14arg1] : (((x: { a: string; b: number; }) => Object) | ((x: { a: T; b: T; }) => T))[] +>r14b : ((x: { a: T; b: T; }) => T)[] +>[r14arg2, r14arg1] : ((x: { a: T; b: T; }) => T)[] >r14arg2 : (x: { a: string; b: number; }) => Object >r14arg1 : (x: { a: T; b: T; }) => T diff --git a/tests/baselines/reference/subtypingWithCallSignatures3.types b/tests/baselines/reference/subtypingWithCallSignatures3.types index 0d3a84ac99c2e..2d4c6e9fda572 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures3.types +++ b/tests/baselines/reference/subtypingWithCallSignatures3.types @@ -219,8 +219,8 @@ module Errors { >null : null var r1a = [(x: number) => [''], (x: T) => null]; ->r1a : (((x: number) => string[]) | ((x: T) => U[]))[] ->[(x: number) => [''], (x: T) => null] : (((x: number) => string[]) | ((x: T) => U[]))[] +>r1a : ((x: T) => U[])[] +>[(x: number) => [''], (x: T) => null] : ((x: T) => U[])[] >(x: number) => [''] : (x: number) => string[] >x : number >[''] : string[] @@ -235,8 +235,8 @@ module Errors { >null : null var r1b = [(x: T) => null, (x: number) => ['']]; ->r1b : (((x: T) => U[]) | ((x: number) => string[]))[] ->[(x: T) => null, (x: number) => ['']] : (((x: T) => U[]) | ((x: number) => string[]))[] +>r1b : ((x: T) => U[])[] +>[(x: T) => null, (x: number) => ['']] : ((x: T) => U[])[] >(x: T) => null : (x: T) => U[] >T : T >U : U @@ -291,14 +291,14 @@ module Errors { >r2arg : (x: (arg: T) => U) => (r: T) => V var r2a = [r2arg2, r2arg]; ->r2a : (((x: (arg: Base) => Derived) => (r: Base) => Derived2) | ((x: (arg: T) => U) => (r: T) => V))[] ->[r2arg2, r2arg] : (((x: (arg: Base) => Derived) => (r: Base) => Derived2) | ((x: (arg: T) => U) => (r: T) => V))[] +>r2a : ((x: (arg: T) => U) => (r: T) => V)[] +>[r2arg2, r2arg] : ((x: (arg: T) => U) => (r: T) => V)[] >r2arg2 : (x: (arg: Base) => Derived) => (r: Base) => Derived2 >r2arg : (x: (arg: T) => U) => (r: T) => V var r2b = [r2arg, r2arg2]; ->r2b : (((x: (arg: T) => U) => (r: T) => V) | ((x: (arg: Base) => Derived) => (r: Base) => Derived2))[] ->[r2arg, r2arg2] : (((x: (arg: T) => U) => (r: T) => V) | ((x: (arg: Base) => Derived) => (r: Base) => Derived2))[] +>r2b : ((x: (arg: T) => U) => (r: T) => V)[] +>[r2arg, r2arg2] : ((x: (arg: T) => U) => (r: T) => V)[] >r2arg : (x: (arg: T) => U) => (r: T) => V >r2arg2 : (x: (arg: Base) => Derived) => (r: Base) => Derived2 @@ -387,14 +387,14 @@ module Errors { >r4arg : (...x: T[]) => T var r4a = [r4arg2, r4arg]; ->r4a : (((...x: Base[]) => Base) | ((...x: T[]) => T))[] ->[r4arg2, r4arg] : (((...x: Base[]) => Base) | ((...x: T[]) => T))[] +>r4a : ((...x: T[]) => T)[] +>[r4arg2, r4arg] : ((...x: T[]) => T)[] >r4arg2 : (...x: Base[]) => Base >r4arg : (...x: T[]) => T var r4b = [r4arg, r4arg2]; ->r4b : (((...x: T[]) => T) | ((...x: Base[]) => Base))[] ->[r4arg, r4arg2] : (((...x: T[]) => T) | ((...x: Base[]) => Base))[] +>r4b : ((...x: T[]) => T)[] +>[r4arg, r4arg2] : ((...x: T[]) => T)[] >r4arg : (...x: T[]) => T >r4arg2 : (...x: Base[]) => Base @@ -430,14 +430,14 @@ module Errors { >r5arg : (x: T, y: T) => T var r5a = [r5arg2, r5arg]; ->r5a : (((x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | ((x: T, y: T) => T))[] ->[r5arg2, r5arg] : (((x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | ((x: T, y: T) => T))[] +>r5a : ((x: T, y: T) => T)[] +>[r5arg2, r5arg] : ((x: T, y: T) => T)[] >r5arg2 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base >r5arg : (x: T, y: T) => T var r5b = [r5arg, r5arg2]; ->r5b : (((x: T, y: T) => T) | ((x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] ->[r5arg, r5arg2] : (((x: T, y: T) => T) | ((x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] +>r5b : ((x: T, y: T) => T)[] +>[r5arg, r5arg2] : ((x: T, y: T) => T)[] >r5arg : (x: T, y: T) => T >r5arg2 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base @@ -478,14 +478,14 @@ module Errors { >r6arg : (x: Base[], y: Derived2[]) => Derived[] var r6a = [r6arg2, r6arg]; ->r6a : (((x: Base[], y: Base[]) => T) | ((x: Base[], y: Derived2[]) => Derived[]))[] ->[r6arg2, r6arg] : (((x: Base[], y: Base[]) => T) | ((x: Base[], y: Derived2[]) => Derived[]))[] +>r6a : ((x: Base[], y: Base[]) => T)[] +>[r6arg2, r6arg] : ((x: Base[], y: Base[]) => T)[] >r6arg2 : (x: Base[], y: Base[]) => T >r6arg : (x: Base[], y: Derived2[]) => Derived[] var r6b = [r6arg, r6arg2]; ->r6b : (((x: Base[], y: Derived2[]) => Derived[]) | ((x: Base[], y: Base[]) => T))[] ->[r6arg, r6arg2] : (((x: Base[], y: Derived2[]) => Derived[]) | ((x: Base[], y: Base[]) => T))[] +>r6b : ((x: Base[], y: Base[]) => T)[] +>[r6arg, r6arg2] : ((x: Base[], y: Base[]) => T)[] >r6arg : (x: Base[], y: Derived2[]) => Derived[] >r6arg2 : (x: Base[], y: Base[]) => T @@ -517,14 +517,14 @@ module Errors { >r7arg : (x: { a: T; b: T; }) => T var r7a = [r7arg2, r7arg]; ->r7a : (((x: { a: string; b: number; }) => number) | ((x: { a: T; b: T; }) => T))[] ->[r7arg2, r7arg] : (((x: { a: string; b: number; }) => number) | ((x: { a: T; b: T; }) => T))[] +>r7a : ((x: { a: T; b: T; }) => T)[] +>[r7arg2, r7arg] : ((x: { a: T; b: T; }) => T)[] >r7arg2 : (x: { a: string; b: number; }) => number >r7arg : (x: { a: T; b: T; }) => T var r7b = [r7arg, r7arg2]; ->r7b : (((x: { a: T; b: T; }) => T) | ((x: { a: string; b: number; }) => number))[] ->[r7arg, r7arg2] : (((x: { a: T; b: T; }) => T) | ((x: { a: string; b: number; }) => number))[] +>r7b : ((x: { a: T; b: T; }) => T)[] +>[r7arg, r7arg2] : ((x: { a: T; b: T; }) => T)[] >r7arg : (x: { a: T; b: T; }) => T >r7arg2 : (x: { a: string; b: number; }) => number @@ -547,14 +547,14 @@ module Errors { >r7arg3 : (x: { a: T; b: T; }) => number var r7d = [r7arg2, r7arg3]; ->r7d : (((x: { a: string; b: number; }) => number) | ((x: { a: T; b: T; }) => number))[] ->[r7arg2, r7arg3] : (((x: { a: string; b: number; }) => number) | ((x: { a: T; b: T; }) => number))[] +>r7d : ((x: { a: string; b: number; }) => number)[] +>[r7arg2, r7arg3] : ((x: { a: string; b: number; }) => number)[] >r7arg2 : (x: { a: string; b: number; }) => number >r7arg3 : (x: { a: T; b: T; }) => number var r7e = [r7arg3, r7arg2]; ->r7e : (((x: { a: T; b: T; }) => number) | ((x: { a: string; b: number; }) => number))[] ->[r7arg3, r7arg2] : (((x: { a: T; b: T; }) => number) | ((x: { a: string; b: number; }) => number))[] +>r7e : ((x: { a: T; b: T; }) => number)[] +>[r7arg3, r7arg2] : ((x: { a: T; b: T; }) => number)[] >r7arg3 : (x: { a: T; b: T; }) => number >r7arg2 : (x: { a: string; b: number; }) => number diff --git a/tests/baselines/reference/subtypingWithCallSignatures4.types b/tests/baselines/reference/subtypingWithCallSignatures4.types index 830f065f556b0..f490f78787823 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures4.types +++ b/tests/baselines/reference/subtypingWithCallSignatures4.types @@ -317,14 +317,14 @@ var r3 = foo3(r3arg); >r3arg : (x: T) => T var r3a = [r3arg, r3arg2]; ->r3a : (((x: T) => T) | ((x: T) => void))[] ->[r3arg, r3arg2] : (((x: T) => T) | ((x: T) => void))[] +>r3a : ((x: T) => T)[] +>[r3arg, r3arg2] : ((x: T) => T)[] >r3arg : (x: T) => T >r3arg2 : (x: T) => void var r3b = [r3arg2, r3arg]; ->r3b : (((x: T) => void) | ((x: T) => T))[] ->[r3arg2, r3arg] : (((x: T) => void) | ((x: T) => T))[] +>r3b : ((x: T) => void)[] +>[r3arg2, r3arg] : ((x: T) => void)[] >r3arg2 : (x: T) => void >r3arg : (x: T) => T @@ -447,14 +447,14 @@ var r6 = foo6(r6arg); >r6arg : (x: (arg: T) => U) => T var r6a = [r6arg, r6arg2]; ->r6a : (((x: (arg: T) => U) => T) | ((x: (arg: T) => Derived) => T))[] ->[r6arg, r6arg2] : (((x: (arg: T) => U) => T) | ((x: (arg: T) => Derived) => T))[] +>r6a : ((x: (arg: T) => U) => T)[] +>[r6arg, r6arg2] : ((x: (arg: T) => U) => T)[] >r6arg : (x: (arg: T) => U) => T >r6arg2 : (x: (arg: T) => Derived) => T var r6b = [r6arg2, r6arg]; ->r6b : (((x: (arg: T) => Derived) => T) | ((x: (arg: T) => U) => T))[] ->[r6arg2, r6arg] : (((x: (arg: T) => Derived) => T) | ((x: (arg: T) => U) => T))[] +>r6b : ((x: (arg: T) => Derived) => T)[] +>[r6arg2, r6arg] : ((x: (arg: T) => Derived) => T)[] >r6arg2 : (x: (arg: T) => Derived) => T >r6arg : (x: (arg: T) => U) => T @@ -498,14 +498,14 @@ var r11 = foo11(r11arg); >r11arg : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base var r11a = [r11arg, r11arg2]; ->r11a : (((x: { foo: T; }, y: { foo: U; bar: U; }) => Base) | ((x: { foo: T; }, y: { foo: T; bar: T; }) => Base))[] ->[r11arg, r11arg2] : (((x: { foo: T; }, y: { foo: U; bar: U; }) => Base) | ((x: { foo: T; }, y: { foo: T; bar: T; }) => Base))[] +>r11a : ((x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] +>[r11arg, r11arg2] : ((x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] >r11arg : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base >r11arg2 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base var r11b = [r11arg2, r11arg]; ->r11b : (((x: { foo: T; }, y: { foo: T; bar: T; }) => Base) | ((x: { foo: T; }, y: { foo: U; bar: U; }) => Base))[] ->[r11arg2, r11arg] : (((x: { foo: T; }, y: { foo: T; bar: T; }) => Base) | ((x: { foo: T; }, y: { foo: U; bar: U; }) => Base))[] +>r11b : ((x: { foo: T; }, y: { foo: T; bar: T; }) => Base)[] +>[r11arg2, r11arg] : ((x: { foo: T; }, y: { foo: T; bar: T; }) => Base)[] >r11arg2 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base >r11arg : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base @@ -543,14 +543,14 @@ var r15 = foo15(r15arg); >r15arg : (x: { a: U; b: V; }) => U[] var r15a = [r15arg, r15arg2]; ->r15a : (((x: { a: U; b: V; }) => U[]) | ((x: { a: T; b: T; }) => T[]))[] ->[r15arg, r15arg2] : (((x: { a: U; b: V; }) => U[]) | ((x: { a: T; b: T; }) => T[]))[] +>r15a : ((x: { a: U; b: V; }) => U[])[] +>[r15arg, r15arg2] : ((x: { a: U; b: V; }) => U[])[] >r15arg : (x: { a: U; b: V; }) => U[] >r15arg2 : (x: { a: T; b: T; }) => T[] var r15b = [r15arg2, r15arg]; ->r15b : (((x: { a: T; b: T; }) => T[]) | ((x: { a: U; b: V; }) => U[]))[] ->[r15arg2, r15arg] : (((x: { a: T; b: T; }) => T[]) | ((x: { a: U; b: V; }) => U[]))[] +>r15b : ((x: { a: T; b: T; }) => T[])[] +>[r15arg2, r15arg] : ((x: { a: T; b: T; }) => T[])[] >r15arg2 : (x: { a: T; b: T; }) => T[] >r15arg : (x: { a: U; b: V; }) => U[] diff --git a/tests/baselines/reference/subtypingWithConstructSignatures2.types b/tests/baselines/reference/subtypingWithConstructSignatures2.types index f00ad0332ca9a..c66d6055558ad 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures2.types +++ b/tests/baselines/reference/subtypingWithConstructSignatures2.types @@ -326,14 +326,14 @@ var r1 = foo1(r1arg1); // any, return types are not subtype of first overload >r1arg1 : new (x: T) => T[] var r1a = [r1arg2, r1arg1]; // generic signature, subtype in both directions ->r1a : ((new (x: number) => number[]) | (new (x: T) => T[]))[] ->[r1arg2, r1arg1] : ((new (x: number) => number[]) | (new (x: T) => T[]))[] +>r1a : (new (x: T) => T[])[] +>[r1arg2, r1arg1] : (new (x: T) => T[])[] >r1arg2 : new (x: number) => number[] >r1arg1 : new (x: T) => T[] var r1b = [r1arg1, r1arg2]; // generic signature, subtype in both directions ->r1b : ((new (x: T) => T[]) | (new (x: number) => number[]))[] ->[r1arg1, r1arg2] : ((new (x: T) => T[]) | (new (x: number) => number[]))[] +>r1b : (new (x: T) => T[])[] +>[r1arg1, r1arg2] : (new (x: T) => T[])[] >r1arg1 : new (x: T) => T[] >r1arg2 : new (x: number) => number[] @@ -354,14 +354,14 @@ var r2 = foo2(r2arg1); >r2arg1 : new (x: T) => string[] var r2a = [r2arg1, r2arg2]; ->r2a : ((new (x: T) => string[]) | (new (x: number) => string[]))[] ->[r2arg1, r2arg2] : ((new (x: T) => string[]) | (new (x: number) => string[]))[] +>r2a : (new (x: T) => string[])[] +>[r2arg1, r2arg2] : (new (x: T) => string[])[] >r2arg1 : new (x: T) => string[] >r2arg2 : new (x: number) => string[] var r2b = [r2arg2, r2arg1]; ->r2b : ((new (x: number) => string[]) | (new (x: T) => string[]))[] ->[r2arg2, r2arg1] : ((new (x: number) => string[]) | (new (x: T) => string[]))[] +>r2b : (new (x: number) => string[])[] +>[r2arg2, r2arg1] : (new (x: number) => string[])[] >r2arg2 : new (x: number) => string[] >r2arg1 : new (x: T) => string[] @@ -383,14 +383,14 @@ var r3 = foo3(r3arg1); >r3arg1 : new (x: T) => T var r3a = [r3arg1, r3arg2]; ->r3a : ((new (x: T) => T) | (new (x: number) => void))[] ->[r3arg1, r3arg2] : ((new (x: T) => T) | (new (x: number) => void))[] +>r3a : (new (x: T) => T)[] +>[r3arg1, r3arg2] : (new (x: T) => T)[] >r3arg1 : new (x: T) => T >r3arg2 : new (x: number) => void var r3b = [r3arg2, r3arg1]; ->r3b : ((new (x: number) => void) | (new (x: T) => T))[] ->[r3arg2, r3arg1] : ((new (x: number) => void) | (new (x: T) => T))[] +>r3b : (new (x: number) => void)[] +>[r3arg2, r3arg1] : (new (x: number) => void)[] >r3arg2 : new (x: number) => void >r3arg1 : new (x: T) => T @@ -416,14 +416,14 @@ var r4 = foo4(r4arg1); // any >r4arg1 : new (x: T, y: U) => T var r4a = [r4arg1, r4arg2]; ->r4a : ((new (x: T, y: U) => T) | (new (x: string, y: number) => string))[] ->[r4arg1, r4arg2] : ((new (x: T, y: U) => T) | (new (x: string, y: number) => string))[] +>r4a : (new (x: T, y: U) => T)[] +>[r4arg1, r4arg2] : (new (x: T, y: U) => T)[] >r4arg1 : new (x: T, y: U) => T >r4arg2 : new (x: string, y: number) => string var r4b = [r4arg2, r4arg1]; ->r4b : ((new (x: string, y: number) => string) | (new (x: T, y: U) => T))[] ->[r4arg2, r4arg1] : ((new (x: string, y: number) => string) | (new (x: T, y: U) => T))[] +>r4b : (new (x: T, y: U) => T)[] +>[r4arg2, r4arg1] : (new (x: T, y: U) => T)[] >r4arg2 : new (x: string, y: number) => string >r4arg1 : new (x: T, y: U) => T @@ -449,14 +449,14 @@ var r5 = foo5(r5arg1); // any >r5arg1 : new (x: new (arg: T) => U) => T var r5a = [r5arg1, r5arg2]; ->r5a : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: string) => number) => string))[] ->[r5arg1, r5arg2] : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: string) => number) => string))[] +>r5a : (new (x: new (arg: T) => U) => T)[] +>[r5arg1, r5arg2] : (new (x: new (arg: T) => U) => T)[] >r5arg1 : new (x: new (arg: T) => U) => T >r5arg2 : new (x: new (arg: string) => number) => string var r5b = [r5arg2, r5arg1]; ->r5b : ((new (x: new (arg: string) => number) => string) | (new (x: new (arg: T) => U) => T))[] ->[r5arg2, r5arg1] : ((new (x: new (arg: string) => number) => string) | (new (x: new (arg: T) => U) => T))[] +>r5b : (new (x: new (arg: T) => U) => T)[] +>[r5arg2, r5arg1] : (new (x: new (arg: T) => U) => T)[] >r5arg2 : new (x: new (arg: string) => number) => string >r5arg1 : new (x: new (arg: T) => U) => T @@ -487,14 +487,14 @@ var r6 = foo6(r6arg1); // any >r6arg1 : new (x: new (arg: T) => U) => T var r6a = [r6arg1, r6arg2]; ->r6a : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: Base) => Derived) => Base))[] ->[r6arg1, r6arg2] : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: Base) => Derived) => Base))[] +>r6a : (new (x: new (arg: T) => U) => T)[] +>[r6arg1, r6arg2] : (new (x: new (arg: T) => U) => T)[] >r6arg1 : new (x: new (arg: T) => U) => T >r6arg2 : new (x: new (arg: Base) => Derived) => Base var r6b = [r6arg2, r6arg1]; ->r6b : ((new (x: new (arg: Base) => Derived) => Base) | (new (x: new (arg: T) => U) => T))[] ->[r6arg2, r6arg1] : ((new (x: new (arg: Base) => Derived) => Base) | (new (x: new (arg: T) => U) => T))[] +>r6b : (new (x: new (arg: T) => U) => T)[] +>[r6arg2, r6arg1] : (new (x: new (arg: T) => U) => T)[] >r6arg2 : new (x: new (arg: Base) => Derived) => Base >r6arg1 : new (x: new (arg: T) => U) => T @@ -529,14 +529,14 @@ var r7 = foo7(r7arg1); // any >r7arg1 : new (x: new (arg: T) => U) => new (r: T) => U var r7a = [r7arg1, r7arg2]; ->r7a : ((new (x: new (arg: T) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived) => new (r: Base) => Derived))[] ->[r7arg1, r7arg2] : ((new (x: new (arg: T) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived) => new (r: Base) => Derived))[] +>r7a : (new (x: new (arg: T) => U) => new (r: T) => U)[] +>[r7arg1, r7arg2] : (new (x: new (arg: T) => U) => new (r: T) => U)[] >r7arg1 : new (x: new (arg: T) => U) => new (r: T) => U >r7arg2 : new (x: new (arg: Base) => Derived) => new (r: Base) => Derived var r7b = [r7arg2, r7arg1]; ->r7b : ((new (x: new (arg: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U) => new (r: T) => U))[] ->[r7arg2, r7arg1] : ((new (x: new (arg: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U) => new (r: T) => U))[] +>r7b : (new (x: new (arg: T) => U) => new (r: T) => U)[] +>[r7arg2, r7arg1] : (new (x: new (arg: T) => U) => new (r: T) => U)[] >r7arg2 : new (x: new (arg: Base) => Derived) => new (r: Base) => Derived >r7arg1 : new (x: new (arg: T) => U) => new (r: T) => U @@ -579,14 +579,14 @@ var r8 = foo8(r8arg1); // any >r8arg1 : new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U var r8a = [r8arg1, r8arg2]; ->r8a : ((new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived))[] ->[r8arg1, r8arg2] : ((new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived))[] +>r8a : (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U)[] +>[r8arg1, r8arg2] : (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U)[] >r8arg1 : new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U >r8arg2 : new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived var r8b = [r8arg2, r8arg1]; ->r8b : ((new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U))[] ->[r8arg2, r8arg1] : ((new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U))[] +>r8b : (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U)[] +>[r8arg2, r8arg1] : (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U)[] >r8arg2 : new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived >r8arg1 : new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U @@ -662,14 +662,14 @@ var r10 = foo10(r10arg1); // any >r10arg1 : new (...x: T[]) => T var r10a = [r10arg1, r10arg2]; ->r10a : ((new (...x: T[]) => T) | (new (...x: Derived[]) => Derived))[] ->[r10arg1, r10arg2] : ((new (...x: T[]) => T) | (new (...x: Derived[]) => Derived))[] +>r10a : (new (...x: T[]) => T)[] +>[r10arg1, r10arg2] : (new (...x: T[]) => T)[] >r10arg1 : new (...x: T[]) => T >r10arg2 : new (...x: Derived[]) => Derived var r10b = [r10arg2, r10arg1]; ->r10b : ((new (...x: Derived[]) => Derived) | (new (...x: T[]) => T))[] ->[r10arg2, r10arg1] : ((new (...x: Derived[]) => Derived) | (new (...x: T[]) => T))[] +>r10b : (new (...x: T[]) => T)[] +>[r10arg2, r10arg1] : (new (...x: T[]) => T)[] >r10arg2 : new (...x: Derived[]) => Derived >r10arg1 : new (...x: T[]) => T @@ -699,14 +699,14 @@ var r11 = foo11(r11arg1); // any >r11arg1 : new (x: T, y: T) => T var r11a = [r11arg1, r11arg2]; ->r11a : ((new (x: T, y: T) => T) | (new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] ->[r11arg1, r11arg2] : ((new (x: T, y: T) => T) | (new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] +>r11a : (new (x: T, y: T) => T)[] +>[r11arg1, r11arg2] : (new (x: T, y: T) => T)[] >r11arg1 : new (x: T, y: T) => T >r11arg2 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base var r11b = [r11arg2, r11arg1]; ->r11b : ((new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | (new (x: T, y: T) => T))[] ->[r11arg2, r11arg1] : ((new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | (new (x: T, y: T) => T))[] +>r11b : (new (x: T, y: T) => T)[] +>[r11arg2, r11arg1] : (new (x: T, y: T) => T)[] >r11arg2 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base >r11arg1 : new (x: T, y: T) => T @@ -741,14 +741,14 @@ var r12 = foo12(r12arg1); // any >r12arg1 : new (x: Base[], y: T) => Derived[] var r12a = [r12arg1, r12arg2]; ->r12a : ((new (x: Base[], y: T) => Derived[]) | (new (x: Base[], y: Derived2[]) => Derived[]))[] ->[r12arg1, r12arg2] : ((new (x: Base[], y: T) => Derived[]) | (new (x: Base[], y: Derived2[]) => Derived[]))[] +>r12a : (new (x: Base[], y: T) => Derived[])[] +>[r12arg1, r12arg2] : (new (x: Base[], y: T) => Derived[])[] >r12arg1 : new (x: Base[], y: T) => Derived[] >r12arg2 : new (x: Base[], y: Derived2[]) => Derived[] var r12b = [r12arg2, r12arg1]; ->r12b : ((new (x: Base[], y: Derived2[]) => Derived[]) | (new (x: Base[], y: T) => Derived[]))[] ->[r12arg2, r12arg1] : ((new (x: Base[], y: Derived2[]) => Derived[]) | (new (x: Base[], y: T) => Derived[]))[] +>r12b : (new (x: Base[], y: Derived2[]) => Derived[])[] +>[r12arg2, r12arg1] : (new (x: Base[], y: Derived2[]) => Derived[])[] >r12arg2 : new (x: Base[], y: Derived2[]) => Derived[] >r12arg1 : new (x: Base[], y: T) => Derived[] @@ -782,14 +782,14 @@ var r13 = foo13(r13arg1); // any >r13arg1 : new (x: Base[], y: T) => T var r13a = [r13arg1, r13arg2]; ->r13a : ((new (x: Base[], y: T) => T) | (new (x: Base[], y: Derived[]) => Derived[]))[] ->[r13arg1, r13arg2] : ((new (x: Base[], y: T) => T) | (new (x: Base[], y: Derived[]) => Derived[]))[] +>r13a : (new (x: Base[], y: T) => T)[] +>[r13arg1, r13arg2] : (new (x: Base[], y: T) => T)[] >r13arg1 : new (x: Base[], y: T) => T >r13arg2 : new (x: Base[], y: Derived[]) => Derived[] var r13b = [r13arg2, r13arg1]; ->r13b : ((new (x: Base[], y: Derived[]) => Derived[]) | (new (x: Base[], y: T) => T))[] ->[r13arg2, r13arg1] : ((new (x: Base[], y: Derived[]) => Derived[]) | (new (x: Base[], y: T) => T))[] +>r13b : (new (x: Base[], y: T) => T)[] +>[r13arg2, r13arg1] : (new (x: Base[], y: T) => T)[] >r13arg2 : new (x: Base[], y: Derived[]) => Derived[] >r13arg1 : new (x: Base[], y: T) => T @@ -817,14 +817,14 @@ var r14 = foo14(r14arg1); // any >r14arg1 : new (x: { a: T; b: T; }) => T var r14a = [r14arg1, r14arg2]; ->r14a : ((new (x: { a: T; b: T; }) => T) | (new (x: { a: string; b: number; }) => Object))[] ->[r14arg1, r14arg2] : ((new (x: { a: T; b: T; }) => T) | (new (x: { a: string; b: number; }) => Object))[] +>r14a : (new (x: { a: T; b: T; }) => T)[] +>[r14arg1, r14arg2] : (new (x: { a: T; b: T; }) => T)[] >r14arg1 : new (x: { a: T; b: T; }) => T >r14arg2 : new (x: { a: string; b: number; }) => Object var r14b = [r14arg2, r14arg1]; ->r14b : ((new (x: { a: string; b: number; }) => Object) | (new (x: { a: T; b: T; }) => T))[] ->[r14arg2, r14arg1] : ((new (x: { a: string; b: number; }) => Object) | (new (x: { a: T; b: T; }) => T))[] +>r14b : (new (x: { a: T; b: T; }) => T)[] +>[r14arg2, r14arg1] : (new (x: { a: T; b: T; }) => T)[] >r14arg2 : new (x: { a: string; b: number; }) => Object >r14arg1 : new (x: { a: T; b: T; }) => T diff --git a/tests/baselines/reference/subtypingWithConstructSignatures3.types b/tests/baselines/reference/subtypingWithConstructSignatures3.types index b7c90d8697e4e..741db4f4ba6aa 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures3.types +++ b/tests/baselines/reference/subtypingWithConstructSignatures3.types @@ -224,14 +224,14 @@ module Errors { >r1arg1 : new (x: T) => U[] var r1a = [r1arg2, r1arg1]; ->r1a : ((new (x: number) => string[]) | (new (x: T) => U[]))[] ->[r1arg2, r1arg1] : ((new (x: number) => string[]) | (new (x: T) => U[]))[] +>r1a : (new (x: T) => U[])[] +>[r1arg2, r1arg1] : (new (x: T) => U[])[] >r1arg2 : new (x: number) => string[] >r1arg1 : new (x: T) => U[] var r1b = [r1arg1, r1arg2]; ->r1b : ((new (x: T) => U[]) | (new (x: number) => string[]))[] ->[r1arg1, r1arg2] : ((new (x: T) => U[]) | (new (x: number) => string[]))[] +>r1b : (new (x: T) => U[])[] +>[r1arg1, r1arg2] : (new (x: T) => U[])[] >r1arg1 : new (x: T) => U[] >r1arg2 : new (x: number) => string[] @@ -268,14 +268,14 @@ module Errors { >r2arg1 : new (x: new (arg: T) => U) => new (r: T) => V var r2a = [r2arg2, r2arg1]; ->r2a : ((new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2) | (new (x: new (arg: T) => U) => new (r: T) => V))[] ->[r2arg2, r2arg1] : ((new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2) | (new (x: new (arg: T) => U) => new (r: T) => V))[] +>r2a : (new (x: new (arg: T) => U) => new (r: T) => V)[] +>[r2arg2, r2arg1] : (new (x: new (arg: T) => U) => new (r: T) => V)[] >r2arg2 : new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2 >r2arg1 : new (x: new (arg: T) => U) => new (r: T) => V var r2b = [r2arg1, r2arg2]; ->r2b : ((new (x: new (arg: T) => U) => new (r: T) => V) | (new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2))[] ->[r2arg1, r2arg2] : ((new (x: new (arg: T) => U) => new (r: T) => V) | (new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2))[] +>r2b : (new (x: new (arg: T) => U) => new (r: T) => V)[] +>[r2arg1, r2arg2] : (new (x: new (arg: T) => U) => new (r: T) => V)[] >r2arg1 : new (x: new (arg: T) => U) => new (r: T) => V >r2arg2 : new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2 @@ -350,14 +350,14 @@ module Errors { >r4arg1 : new (...x: T[]) => T var r4a = [r4arg2, r4arg1]; ->r4a : ((new (...x: Base[]) => Base) | (new (...x: T[]) => T))[] ->[r4arg2, r4arg1] : ((new (...x: Base[]) => Base) | (new (...x: T[]) => T))[] +>r4a : (new (...x: T[]) => T)[] +>[r4arg2, r4arg1] : (new (...x: T[]) => T)[] >r4arg2 : new (...x: Base[]) => Base >r4arg1 : new (...x: T[]) => T var r4b = [r4arg1, r4arg2]; ->r4b : ((new (...x: T[]) => T) | (new (...x: Base[]) => Base))[] ->[r4arg1, r4arg2] : ((new (...x: T[]) => T) | (new (...x: Base[]) => Base))[] +>r4b : (new (...x: T[]) => T)[] +>[r4arg1, r4arg2] : (new (...x: T[]) => T)[] >r4arg1 : new (...x: T[]) => T >r4arg2 : new (...x: Base[]) => Base @@ -387,14 +387,14 @@ module Errors { >r5arg1 : new (x: T, y: T) => T var r5a = [r5arg2, r5arg1]; ->r5a : ((new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | (new (x: T, y: T) => T))[] ->[r5arg2, r5arg1] : ((new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | (new (x: T, y: T) => T))[] +>r5a : (new (x: T, y: T) => T)[] +>[r5arg2, r5arg1] : (new (x: T, y: T) => T)[] >r5arg2 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base >r5arg1 : new (x: T, y: T) => T var r5b = [r5arg1, r5arg2]; ->r5b : ((new (x: T, y: T) => T) | (new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] ->[r5arg1, r5arg2] : ((new (x: T, y: T) => T) | (new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] +>r5b : (new (x: T, y: T) => T)[] +>[r5arg1, r5arg2] : (new (x: T, y: T) => T)[] >r5arg1 : new (x: T, y: T) => T >r5arg2 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base @@ -429,14 +429,14 @@ module Errors { >r6arg1 : new (x: Base[], y: Derived2[]) => Derived[] var r6a = [r6arg2, r6arg1]; ->r6a : ((new (x: Base[], y: Base[]) => T) | (new (x: Base[], y: Derived2[]) => Derived[]))[] ->[r6arg2, r6arg1] : ((new (x: Base[], y: Base[]) => T) | (new (x: Base[], y: Derived2[]) => Derived[]))[] +>r6a : (new (x: Base[], y: Base[]) => T)[] +>[r6arg2, r6arg1] : (new (x: Base[], y: Base[]) => T)[] >r6arg2 : new (x: Base[], y: Base[]) => T >r6arg1 : new (x: Base[], y: Derived2[]) => Derived[] var r6b = [r6arg1, r6arg2]; ->r6b : ((new (x: Base[], y: Derived2[]) => Derived[]) | (new (x: Base[], y: Base[]) => T))[] ->[r6arg1, r6arg2] : ((new (x: Base[], y: Derived2[]) => Derived[]) | (new (x: Base[], y: Base[]) => T))[] +>r6b : (new (x: Base[], y: Base[]) => T)[] +>[r6arg1, r6arg2] : (new (x: Base[], y: Base[]) => T)[] >r6arg1 : new (x: Base[], y: Derived2[]) => Derived[] >r6arg2 : new (x: Base[], y: Base[]) => T @@ -463,14 +463,14 @@ module Errors { >r7arg1 : new (x: { a: T; b: T; }) => T var r7a = [r7arg2, r7arg1]; ->r7a : ((new (x: { a: string; b: number; }) => number) | (new (x: { a: T; b: T; }) => T))[] ->[r7arg2, r7arg1] : ((new (x: { a: string; b: number; }) => number) | (new (x: { a: T; b: T; }) => T))[] +>r7a : (new (x: { a: T; b: T; }) => T)[] +>[r7arg2, r7arg1] : (new (x: { a: T; b: T; }) => T)[] >r7arg2 : new (x: { a: string; b: number; }) => number >r7arg1 : new (x: { a: T; b: T; }) => T var r7b = [r7arg1, r7arg2]; ->r7b : ((new (x: { a: T; b: T; }) => T) | (new (x: { a: string; b: number; }) => number))[] ->[r7arg1, r7arg2] : ((new (x: { a: T; b: T; }) => T) | (new (x: { a: string; b: number; }) => number))[] +>r7b : (new (x: { a: T; b: T; }) => T)[] +>[r7arg1, r7arg2] : (new (x: { a: T; b: T; }) => T)[] >r7arg1 : new (x: { a: T; b: T; }) => T >r7arg2 : new (x: { a: string; b: number; }) => number @@ -491,14 +491,14 @@ module Errors { >r7arg3 : new (x: { a: T; b: T; }) => number var r7d = [r7arg2, r7arg3]; ->r7d : ((new (x: { a: string; b: number; }) => number) | (new (x: { a: T; b: T; }) => number))[] ->[r7arg2, r7arg3] : ((new (x: { a: string; b: number; }) => number) | (new (x: { a: T; b: T; }) => number))[] +>r7d : (new (x: { a: string; b: number; }) => number)[] +>[r7arg2, r7arg3] : (new (x: { a: string; b: number; }) => number)[] >r7arg2 : new (x: { a: string; b: number; }) => number >r7arg3 : new (x: { a: T; b: T; }) => number var r7e = [r7arg3, r7arg2]; ->r7e : ((new (x: { a: T; b: T; }) => number) | (new (x: { a: string; b: number; }) => number))[] ->[r7arg3, r7arg2] : ((new (x: { a: T; b: T; }) => number) | (new (x: { a: string; b: number; }) => number))[] +>r7e : (new (x: { a: T; b: T; }) => number)[] +>[r7arg3, r7arg2] : (new (x: { a: T; b: T; }) => number)[] >r7arg3 : new (x: { a: T; b: T; }) => number >r7arg2 : new (x: { a: string; b: number; }) => number diff --git a/tests/baselines/reference/subtypingWithConstructSignatures4.types b/tests/baselines/reference/subtypingWithConstructSignatures4.types index 328dadad41c8c..932adcb7368fa 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures4.types +++ b/tests/baselines/reference/subtypingWithConstructSignatures4.types @@ -301,14 +301,14 @@ var r3 = foo3(r3arg); >r3arg : new (x: T) => T var r3a = [r3arg, r3arg2]; ->r3a : ((new (x: T) => T) | (new (x: T) => void))[] ->[r3arg, r3arg2] : ((new (x: T) => T) | (new (x: T) => void))[] +>r3a : (new (x: T) => T)[] +>[r3arg, r3arg2] : (new (x: T) => T)[] >r3arg : new (x: T) => T >r3arg2 : new (x: T) => void var r3b = [r3arg2, r3arg]; ->r3b : ((new (x: T) => void) | (new (x: T) => T))[] ->[r3arg2, r3arg] : ((new (x: T) => void) | (new (x: T) => T))[] +>r3b : (new (x: T) => void)[] +>[r3arg2, r3arg] : (new (x: T) => void)[] >r3arg2 : new (x: T) => void >r3arg : new (x: T) => T @@ -415,14 +415,14 @@ var r6 = foo6(r6arg); >r6arg : new (x: new (arg: T) => U) => T var r6a = [r6arg, r6arg2]; ->r6a : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: T) => Derived) => T))[] ->[r6arg, r6arg2] : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: T) => Derived) => T))[] +>r6a : (new (x: new (arg: T) => U) => T)[] +>[r6arg, r6arg2] : (new (x: new (arg: T) => U) => T)[] >r6arg : new (x: new (arg: T) => U) => T >r6arg2 : new (x: new (arg: T) => Derived) => T var r6b = [r6arg2, r6arg]; ->r6b : ((new (x: new (arg: T) => Derived) => T) | (new (x: new (arg: T) => U) => T))[] ->[r6arg2, r6arg] : ((new (x: new (arg: T) => Derived) => T) | (new (x: new (arg: T) => U) => T))[] +>r6b : (new (x: new (arg: T) => Derived) => T)[] +>[r6arg2, r6arg] : (new (x: new (arg: T) => Derived) => T)[] >r6arg2 : new (x: new (arg: T) => Derived) => T >r6arg : new (x: new (arg: T) => U) => T @@ -460,14 +460,14 @@ var r11 = foo11(r11arg); >r11arg : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base var r11a = [r11arg, r11arg2]; ->r11a : ((new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base) | (new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base))[] ->[r11arg, r11arg2] : ((new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base) | (new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base))[] +>r11a : (new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] +>[r11arg, r11arg2] : (new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] >r11arg : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base >r11arg2 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base var r11b = [r11arg2, r11arg]; ->r11b : ((new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base) | (new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base))[] ->[r11arg2, r11arg] : ((new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base) | (new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base))[] +>r11b : (new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base)[] +>[r11arg2, r11arg] : (new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base)[] >r11arg2 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base >r11arg : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base @@ -499,14 +499,14 @@ var r15 = foo15(r15arg); >r15arg : new (x: { a: U; b: V; }) => U[] var r15a = [r15arg, r15arg2]; ->r15a : ((new (x: { a: U; b: V; }) => U[]) | (new (x: { a: T; b: T; }) => T[]))[] ->[r15arg, r15arg2] : ((new (x: { a: U; b: V; }) => U[]) | (new (x: { a: T; b: T; }) => T[]))[] +>r15a : (new (x: { a: U; b: V; }) => U[])[] +>[r15arg, r15arg2] : (new (x: { a: U; b: V; }) => U[])[] >r15arg : new (x: { a: U; b: V; }) => U[] >r15arg2 : new (x: { a: T; b: T; }) => T[] var r15b = [r15arg2, r15arg]; ->r15b : ((new (x: { a: T; b: T; }) => T[]) | (new (x: { a: U; b: V; }) => U[]))[] ->[r15arg2, r15arg] : ((new (x: { a: T; b: T; }) => T[]) | (new (x: { a: U; b: V; }) => U[]))[] +>r15b : (new (x: { a: T; b: T; }) => T[])[] +>[r15arg2, r15arg] : (new (x: { a: T; b: T; }) => T[])[] >r15arg2 : new (x: { a: T; b: T; }) => T[] >r15arg : new (x: { a: U; b: V; }) => U[] diff --git a/tests/baselines/reference/subtypingWithObjectMembersOptionality.types b/tests/baselines/reference/subtypingWithObjectMembersOptionality.types index 0d55d78e266b8..815f2d60740ca 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersOptionality.types +++ b/tests/baselines/reference/subtypingWithObjectMembersOptionality.types @@ -85,8 +85,8 @@ var b = { Foo: null }; >null : null var r = true ? a : b; ->r : { Foo?: Base; } | { Foo: Derived; } ->true ? a : b : { Foo?: Base; } | { Foo: Derived; } +>r : { Foo?: Base; } +>true ? a : b : { Foo?: Base; } >true : boolean >a : { Foo?: Base; } >b : { Foo: Derived; } @@ -156,8 +156,8 @@ module TwoLevels { >null : null var r = true ? a : b; ->r : { Foo?: Base; } | { Foo: Derived2; } ->true ? a : b : { Foo?: Base; } | { Foo: Derived2; } +>r : { Foo?: Base; } +>true ? a : b : { Foo?: Base; } >true : boolean >a : { Foo?: Base; } >b : { Foo: Derived2; } diff --git a/tests/baselines/reference/symbolType11.types b/tests/baselines/reference/symbolType11.types index a7de59a11b736..b251db4330106 100644 --- a/tests/baselines/reference/symbolType11.types +++ b/tests/baselines/reference/symbolType11.types @@ -33,7 +33,7 @@ s || 1; >1 : number ({}) || s; ->({}) || s : {} | symbol +>({}) || s : {} >({}) : {} >{} : {} >s : symbol diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.types b/tests/baselines/reference/typeGuardsInConditionalExpression.types index ef048fb85624d..493a8c0a31afd 100644 --- a/tests/baselines/reference/typeGuardsInConditionalExpression.types +++ b/tests/baselines/reference/typeGuardsInConditionalExpression.types @@ -363,9 +363,9 @@ function foo12(x: number | string | boolean) { >10 : number >x.toString().length : number >x.toString() : string ->x.toString : ((radix?: number) => string) | (() => string) +>x.toString : (radix?: number) => string >x : number | string | boolean ->toString : ((radix?: number) => string) | (() => string) +>toString : (radix?: number) => string >length : number : ((b = x) // x is number | boolean | string - changed in true branch diff --git a/tests/baselines/reference/typeGuardsInIfStatement.types b/tests/baselines/reference/typeGuardsInIfStatement.types index 8e22d4ba3e0fe..0095a7cc768ea 100644 --- a/tests/baselines/reference/typeGuardsInIfStatement.types +++ b/tests/baselines/reference/typeGuardsInIfStatement.types @@ -333,9 +333,9 @@ function foo11(x: number | string | boolean) { >10 && x.toString() : string >10 : number >x.toString() : string ->x.toString : ((radix?: number) => string) | (() => string) +>x.toString : (radix?: number) => string >x : number | string | boolean ->toString : ((radix?: number) => string) | (() => string) +>toString : (radix?: number) => string ) : ( @@ -348,9 +348,9 @@ function foo11(x: number | string | boolean) { >x && x.toString() : string >x : number | string | boolean >x.toString() : string ->x.toString : ((radix?: number) => string) | (() => string) +>x.toString : (radix?: number) => string >x : number | string | boolean ->toString : ((radix?: number) => string) | (() => string) +>toString : (radix?: number) => string ); } @@ -369,9 +369,9 @@ function foo12(x: number | string | boolean) { return x.toString(); // string | number | boolean - x changed in else branch >x.toString() : string ->x.toString : ((radix?: number) => string) | (() => string) +>x.toString : (radix?: number) => string >x : number | string | boolean ->toString : ((radix?: number) => string) | (() => string) +>toString : (radix?: number) => string } else { x = 10; diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types index b69c80ff55ae7..22d390618c165 100644 --- a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types +++ b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types @@ -180,9 +180,9 @@ function foo7(x: number | string | boolean) { >10 && x.toString() : string >10 : number >x.toString() : string ->x.toString : ((radix?: number) => string) | (() => string) +>x.toString : (radix?: number) => string >x : number | string | boolean ->toString : ((radix?: number) => string) | (() => string) +>toString : (radix?: number) => string // do not change value : (y = x && x.toString()))); // number | boolean | string @@ -192,9 +192,9 @@ function foo7(x: number | string | boolean) { >x && x.toString() : string >x : number | string | boolean >x.toString() : string ->x.toString : ((radix?: number) => string) | (() => string) +>x.toString : (radix?: number) => string >x : number | string | boolean ->toString : ((radix?: number) => string) | (() => string) +>toString : (radix?: number) => string } function foo8(x: number | string) { >foo8 : (x: number | string) => number diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types index b2f5401e84359..38d9a723d3a86 100644 --- a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types +++ b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types @@ -180,9 +180,9 @@ function foo7(x: number | string | boolean) { >10 && x.toString() : string >10 : number >x.toString() : string ->x.toString : ((radix?: number) => string) | (() => string) +>x.toString : (radix?: number) => string >x : number | string | boolean ->toString : ((radix?: number) => string) | (() => string) +>toString : (radix?: number) => string // do not change value : (y = x && x.toString()))); // number | boolean | string @@ -192,9 +192,9 @@ function foo7(x: number | string | boolean) { >x && x.toString() : string >x : number | string | boolean >x.toString() : string ->x.toString : ((radix?: number) => string) | (() => string) +>x.toString : (radix?: number) => string >x : number | string | boolean ->toString : ((radix?: number) => string) | (() => string) +>toString : (radix?: number) => string } function foo8(x: number | string) { >foo8 : (x: number | string) => boolean | number diff --git a/tests/baselines/reference/underscoreTest1.types b/tests/baselines/reference/underscoreTest1.types index 31b01c5f76e22..7fe233c4490d2 100644 --- a/tests/baselines/reference/underscoreTest1.types +++ b/tests/baselines/reference/underscoreTest1.types @@ -547,7 +547,7 @@ _.flatten([1, [2], [3, [[4]]]]); >_.flatten : { (list: T[][]): T[]; (array: any[], shallow?: boolean): T[]; } >_ : Underscore.Static >flatten : { (list: T[][]): T[]; (array: any[], shallow?: boolean): T[]; } ->[1, [2], [3, [[4]]]] : (number | number[] | (number | number[][])[])[] +>[1, [2], [3, [[4]]]] : (number | (number | number[][])[])[] >1 : number >[2] : number[] >2 : number @@ -562,7 +562,7 @@ _.flatten([1, [2], [3, [[4]]]], true); >_.flatten : { (list: T[][]): T[]; (array: any[], shallow?: boolean): T[]; } >_ : Underscore.Static >flatten : { (list: T[][]): T[]; (array: any[], shallow?: boolean): T[]; } ->[1, [2], [3, [[4]]]] : (number | number[] | (number | number[][])[])[] +>[1, [2], [3, [[4]]]] : (number | (number | number[][])[])[] >1 : number >[2] : number[] >2 : number diff --git a/tests/baselines/reference/unionTypeFromArrayLiteral.types b/tests/baselines/reference/unionTypeFromArrayLiteral.types index 604925eb25f23..63aefdd214c06 100644 --- a/tests/baselines/reference/unionTypeFromArrayLiteral.types +++ b/tests/baselines/reference/unionTypeFromArrayLiteral.types @@ -83,15 +83,15 @@ var arr6 = [c, d]; // (C | D)[] >d : D var arr7 = [c, d, e]; // (C | D)[] ->arr7 : (C | D | E)[] ->[c, d, e] : (C | D | E)[] +>arr7 : (C | D)[] +>[c, d, e] : (C | D)[] >c : C >d : D >e : E var arr8 = [c, e]; // C[] ->arr8 : (C | E)[] ->[c, e] : (C | E)[] +>arr8 : C[] +>[c, e] : C[] >c : C >e : E diff --git a/tests/baselines/reference/unionTypeReduction.types b/tests/baselines/reference/unionTypeReduction.types index 8ecd9b33fb553..073d690162a05 100644 --- a/tests/baselines/reference/unionTypeReduction.types +++ b/tests/baselines/reference/unionTypeReduction.types @@ -25,8 +25,8 @@ var e1: I2 | I3; >I3 : I3 var e2 = i2 || i3; // Type of e2 immediately reduced to I3 ->e2 : I2 | I3 ->i2 || i3 : I2 | I3 +>e2 : I3 +>i2 || i3 : I3 >i2 : I2 >i3 : I3 @@ -38,5 +38,5 @@ var r1 = e1(); // Type of e1 reduced to I3 upon accessing property or signature var r2 = e2(); >r2 : number >e2() : number ->e2 : I2 | I3 +>e2 : I3 diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types index f609301c19c2f..caaa02b7b5391 100644 --- a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types @@ -39,7 +39,7 @@ var t: Class | Property; >Property : Property t.parent; ->t.parent : Namespace | Module | Class +>t.parent : Namespace | Class >t : Class | Property ->parent : Namespace | Module | Class +>parent : Namespace | Class diff --git a/tests/cases/fourslash/bestCommonTypeObjectLiterals1.ts b/tests/cases/fourslash/bestCommonTypeObjectLiterals1.ts index d7ccbe73f3384..5a8f661789c9f 100644 --- a/tests/cases/fourslash/bestCommonTypeObjectLiterals1.ts +++ b/tests/cases/fourslash/bestCommonTypeObjectLiterals1.ts @@ -24,7 +24,7 @@ goTo.marker('1'); verify.quickInfoIs('var c: {\n name: string;\n age: number;\n}[]'); goTo.marker('2'); -verify.quickInfoIs('var c1: ({\n name: string;\n age: number;\n} | {\n name: string;\n age: number;\n dob: Date;\n})[]'); +verify.quickInfoIs('var c1: {\n name: string;\n age: number;\n}[]'); goTo.marker('3'); verify.quickInfoIs('var c2: ({\n\ diff --git a/tests/cases/fourslash/completionEntryForUnionProperty2.ts b/tests/cases/fourslash/completionEntryForUnionProperty2.ts index aa5bc40b5e354..c2d7bc406a5e3 100644 --- a/tests/cases/fourslash/completionEntryForUnionProperty2.ts +++ b/tests/cases/fourslash/completionEntryForUnionProperty2.ts @@ -1,12 +1,12 @@ /// ////interface One { -//// commonProperty: number; +//// commonProperty: string; //// commonFunction(): number; ////} //// ////interface Two { -//// commonProperty: string +//// commonProperty: number; //// commonFunction(): number; ////} //// @@ -16,5 +16,5 @@ goTo.marker(); verify.memberListContains("toString", "(method) toString(): string"); -verify.memberListContains("valueOf", "(method) valueOf(): number | string"); +verify.memberListContains("valueOf", "(method) valueOf(): string | number"); verify.memberListCount(2); \ No newline at end of file diff --git a/tests/cases/fourslash/contextualTypingOfArrayLiterals1.ts b/tests/cases/fourslash/contextualTypingOfArrayLiterals1.ts index fb77ecdce6556..dbd7aeb5f0105 100644 --- a/tests/cases/fourslash/contextualTypingOfArrayLiterals1.ts +++ b/tests/cases/fourslash/contextualTypingOfArrayLiterals1.ts @@ -43,21 +43,13 @@ goTo.marker('4'); verify.quickInfoIs('var r4: C'); goTo.marker('5'); -verify.quickInfoIs('var x5: ({\n\ +verify.quickInfoIs('var x5: {\n\ name: string;\n\ age: number;\n\ -} | {\n\ - name: string;\n\ - age: number;\n\ - dob: Date;\n\ -})[]'); +}[]'); goTo.marker('6'); verify.quickInfoIs('var r5: {\n\ name: string;\n\ age: number;\n\ -} | {\n\ - name: string;\n\ - age: number;\n\ - dob: Date;\n\ }');