// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`unionTypeCallSignatures.ts 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
﻿var numOrDate: number | Date;
var strOrBoolean: string | boolean;
var strOrNum: string | number;

// If each type in U has call signatures and the sets of call signatures are identical ignoring return types, 
// U has the same set of call signatures, but with return types that are unions of the return types of the respective call signatures from each type in U.
var unionOfDifferentReturnType: { (a: number): number; } | { (a: number): Date; };
numOrDate = unionOfDifferentReturnType(10);
strOrBoolean = unionOfDifferentReturnType("hello"); // error 
unionOfDifferentReturnType1(true); // error in type of parameter

var unionOfDifferentReturnType1: { (a: number): number; (a: string): string; } | { (a: number): Date; (a: string): boolean; };
numOrDate = unionOfDifferentReturnType1(10);
strOrBoolean = unionOfDifferentReturnType1("hello");
unionOfDifferentReturnType1(true); // error in type of parameter
unionOfDifferentReturnType1(); // error missing parameter

var unionOfDifferentParameterTypes: { (a: number): number; } | { (a: string): Date; };
unionOfDifferentParameterTypes(10);// error - no call signatures
unionOfDifferentParameterTypes("hello");// error - no call signatures
unionOfDifferentParameterTypes();// error - no call signatures

var unionOfDifferentNumberOfSignatures: { (a: number): number; } | { (a: number): Date; (a: string): boolean; };
unionOfDifferentNumberOfSignatures(); // error - no call signatures
unionOfDifferentNumberOfSignatures(10); // error - no call signatures
unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures

var unionWithDifferentParameterCount: { (a: string): string; } | { (a: string, b: number): number; } ;
unionWithDifferentParameterCount();// no  call signature
unionWithDifferentParameterCount("hello");// no  call signature
unionWithDifferentParameterCount("hello", 10);// no  call signature

var unionWithOptionalParameter1: { (a: string, b?: number): string; } | { (a: string, b?: number): number; };
strOrNum = unionWithOptionalParameter1('hello');
strOrNum = unionWithOptionalParameter1('hello', 10);
strOrNum = unionWithOptionalParameter1('hello', "hello"); // error in parameter type
strOrNum = unionWithOptionalParameter1(); // error

var unionWithOptionalParameter2: { (a: string, b?: number): string; } | { (a: string, b: number): number };
strOrNum = unionWithOptionalParameter2('hello'); // error no call signature
strOrNum = unionWithOptionalParameter2('hello', 10); // error no call signature
strOrNum = unionWithOptionalParameter2('hello', "hello"); // error no call signature
strOrNum = unionWithOptionalParameter2(); // error no call signature

var unionWithOptionalParameter3: { (a: string, b?: number): string; } | { (a: string): number; };
strOrNum = unionWithOptionalParameter3('hello');
strOrNum = unionWithOptionalParameter3('hello', 10); // error no call signature
strOrNum = unionWithOptionalParameter3('hello', "hello"); // error no call signature
strOrNum = unionWithOptionalParameter3(); // error no call signature

var unionWithRestParameter1: { (a: string, ...b: number[]): string; } | { (a: string, ...b: number[]): number };
strOrNum = unionWithRestParameter1('hello');
strOrNum = unionWithRestParameter1('hello', 10);
strOrNum = unionWithRestParameter1('hello', 10, 11);
strOrNum = unionWithRestParameter1('hello', "hello"); // error in parameter type
strOrNum = unionWithRestParameter1(); // error

var unionWithRestParameter2: { (a: string, ...b: number[]): string; } | { (a: string, b: number): number };
strOrNum = unionWithRestParameter2('hello'); // error no call signature
strOrNum = unionWithRestParameter2('hello', 10); // error no call signature
strOrNum = unionWithRestParameter2('hello', 10, 11); // error no call signature
strOrNum = unionWithRestParameter2('hello', "hello"); // error no call signature
strOrNum = unionWithRestParameter2(); // error no call signature

var unionWithRestParameter3: { (a: string, ...b: number[]): string; } | { (a: string): number };
strOrNum = unionWithRestParameter3('hello');
strOrNum = unionWithRestParameter3('hello', 10); // error no call signature
strOrNum = unionWithRestParameter3('hello', 10, 11); // error no call signature
strOrNum = unionWithRestParameter3('hello', "hello"); // error no call signature
strOrNum = unionWithRestParameter3(); // error no call signature

var unionWithRestParameter4: { (...a: string[]): string; } | { (a: string, b: string): number; };
strOrNum = unionWithRestParameter4("hello"); // error supplied parameters do not match any call signature
strOrNum = unionWithRestParameter4("hello", "world");

=====================================output=====================================
﻿var numOrDate: number | Date;
var strOrBoolean: string | boolean;
var strOrNum: string | number;

// If each type in U has call signatures and the sets of call signatures are identical ignoring return types,
// U has the same set of call signatures, but with return types that are unions of the return types of the respective call signatures from each type in U.
var unionOfDifferentReturnType: { (a: number): number } | { (a: number): Date };
numOrDate = unionOfDifferentReturnType(10);
strOrBoolean = unionOfDifferentReturnType("hello"); // error
unionOfDifferentReturnType1(true); // error in type of parameter

var unionOfDifferentReturnType1:
  | { (a: number): number; (a: string): string }
  | { (a: number): Date; (a: string): boolean };
numOrDate = unionOfDifferentReturnType1(10);
strOrBoolean = unionOfDifferentReturnType1("hello");
unionOfDifferentReturnType1(true); // error in type of parameter
unionOfDifferentReturnType1(); // error missing parameter

var unionOfDifferentParameterTypes:
  | { (a: number): number }
  | { (a: string): Date };
unionOfDifferentParameterTypes(10); // error - no call signatures
unionOfDifferentParameterTypes("hello"); // error - no call signatures
unionOfDifferentParameterTypes(); // error - no call signatures

var unionOfDifferentNumberOfSignatures:
  | { (a: number): number }
  | { (a: number): Date; (a: string): boolean };
unionOfDifferentNumberOfSignatures(); // error - no call signatures
unionOfDifferentNumberOfSignatures(10); // error - no call signatures
unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures

var unionWithDifferentParameterCount:
  | { (a: string): string }
  | { (a: string, b: number): number };
unionWithDifferentParameterCount(); // no  call signature
unionWithDifferentParameterCount("hello"); // no  call signature
unionWithDifferentParameterCount("hello", 10); // no  call signature

var unionWithOptionalParameter1:
  | { (a: string, b?: number): string }
  | { (a: string, b?: number): number };
strOrNum = unionWithOptionalParameter1("hello");
strOrNum = unionWithOptionalParameter1("hello", 10);
strOrNum = unionWithOptionalParameter1("hello", "hello"); // error in parameter type
strOrNum = unionWithOptionalParameter1(); // error

var unionWithOptionalParameter2:
  | { (a: string, b?: number): string }
  | { (a: string, b: number): number };
strOrNum = unionWithOptionalParameter2("hello"); // error no call signature
strOrNum = unionWithOptionalParameter2("hello", 10); // error no call signature
strOrNum = unionWithOptionalParameter2("hello", "hello"); // error no call signature
strOrNum = unionWithOptionalParameter2(); // error no call signature

var unionWithOptionalParameter3:
  | { (a: string, b?: number): string }
  | { (a: string): number };
strOrNum = unionWithOptionalParameter3("hello");
strOrNum = unionWithOptionalParameter3("hello", 10); // error no call signature
strOrNum = unionWithOptionalParameter3("hello", "hello"); // error no call signature
strOrNum = unionWithOptionalParameter3(); // error no call signature

var unionWithRestParameter1:
  | { (a: string, ...b: number[]): string }
  | { (a: string, ...b: number[]): number };
strOrNum = unionWithRestParameter1("hello");
strOrNum = unionWithRestParameter1("hello", 10);
strOrNum = unionWithRestParameter1("hello", 10, 11);
strOrNum = unionWithRestParameter1("hello", "hello"); // error in parameter type
strOrNum = unionWithRestParameter1(); // error

var unionWithRestParameter2:
  | { (a: string, ...b: number[]): string }
  | { (a: string, b: number): number };
strOrNum = unionWithRestParameter2("hello"); // error no call signature
strOrNum = unionWithRestParameter2("hello", 10); // error no call signature
strOrNum = unionWithRestParameter2("hello", 10, 11); // error no call signature
strOrNum = unionWithRestParameter2("hello", "hello"); // error no call signature
strOrNum = unionWithRestParameter2(); // error no call signature

var unionWithRestParameter3:
  | { (a: string, ...b: number[]): string }
  | { (a: string): number };
strOrNum = unionWithRestParameter3("hello");
strOrNum = unionWithRestParameter3("hello", 10); // error no call signature
strOrNum = unionWithRestParameter3("hello", 10, 11); // error no call signature
strOrNum = unionWithRestParameter3("hello", "hello"); // error no call signature
strOrNum = unionWithRestParameter3(); // error no call signature

var unionWithRestParameter4:
  | { (...a: string[]): string }
  | { (a: string, b: string): number };
strOrNum = unionWithRestParameter4("hello"); // error supplied parameters do not match any call signature
strOrNum = unionWithRestParameter4("hello", "world");

================================================================================
`;

exports[`unionTypeCallSignatures3.ts 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
﻿function f1(s: string) { }
function f2(s?: string) { }
function f3(...s: string[]) { }
function f4(s: string, s2?: string) { }
function f5(s?: string, n?: number) { }
function f6(s?: string, ...n: number[]) { }
function f7(s: string, ...sRest: string[]) { }

var fUnion: typeof f1 | typeof f2 | typeof f3 | typeof f4 | typeof f5 | typeof f6 | typeof f7;

fUnion(""); // All constituents can be called by passing a single string.

=====================================output=====================================
﻿function f1(s: string) {}
function f2(s?: string) {}
function f3(...s: string[]) {}
function f4(s: string, s2?: string) {}
function f5(s?: string, n?: number) {}
function f6(s?: string, ...n: number[]) {}
function f7(s: string, ...sRest: string[]) {}

var fUnion:
  | typeof f1
  | typeof f2
  | typeof f3
  | typeof f4
  | typeof f5
  | typeof f6
  | typeof f7;

fUnion(""); // All constituents can be called by passing a single string.

================================================================================
`;

exports[`unionTypeCallSignatures4.ts 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
﻿type F1 = (a: string, b?: string) => void;
type F2 = (a: string, b?: string, c?: string) => void;
type F3 = (a: string, ...rest: string[]) => void;
type F4 = (a: string, b?: string, ...rest: string[]) => void;
type F5 = (a: string, b: string) => void;

var f12: F1 | F2;
f12("a");
f12("a", "b");
f12("a", "b", "c");  // error

var f34: F3 | F4;
f34("a");
f34("a", "b");
f34("a", "b", "c");

var f1234: F1 | F2 | F3 | F4;
f1234("a");
f1234("a", "b");
f1234("a", "b", "c");  // error

var f12345: F1 | F2 | F3 | F4 | F5;
f12345("a");  // error
f12345("a", "b");
f12345("a", "b", "c");  // error

=====================================output=====================================
﻿type F1 = (a: string, b?: string) => void;
type F2 = (a: string, b?: string, c?: string) => void;
type F3 = (a: string, ...rest: string[]) => void;
type F4 = (a: string, b?: string, ...rest: string[]) => void;
type F5 = (a: string, b: string) => void;

var f12: F1 | F2;
f12("a");
f12("a", "b");
f12("a", "b", "c"); // error

var f34: F3 | F4;
f34("a");
f34("a", "b");
f34("a", "b", "c");

var f1234: F1 | F2 | F3 | F4;
f1234("a");
f1234("a", "b");
f1234("a", "b", "c"); // error

var f12345: F1 | F2 | F3 | F4 | F5;
f12345("a"); // error
f12345("a", "b");
f12345("a", "b", "c"); // error

================================================================================
`;

exports[`unionTypeConstructSignatures.ts 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
﻿var numOrDate: number | Date;
var strOrBoolean: string | boolean;
var strOrNum: string | number;

// If each type in U has construct signatures and the sets of construct signatures are identical ignoring return types, 
// U has the same set of construct signatures, but with return types that are unions of the return types of the respective construct signatures from each type in U.
var unionOfDifferentReturnType: { new (a: number): number; } | { new (a: number): Date; };
numOrDate = new unionOfDifferentReturnType(10);
strOrBoolean = new unionOfDifferentReturnType("hello"); // error 
new unionOfDifferentReturnType1(true); // error in type of parameter

var unionOfDifferentReturnType1: { new (a: number): number; new (a: string): string; } | { new (a: number): Date; new (a: string): boolean; };
numOrDate = new unionOfDifferentReturnType1(10);
strOrBoolean = new unionOfDifferentReturnType1("hello");
new unionOfDifferentReturnType1(true); // error in type of parameter
new unionOfDifferentReturnType1(); // error missing parameter

var unionOfDifferentParameterTypes: { new (a: number): number; } | { new (a: string): Date; };
new unionOfDifferentParameterTypes(10);// error - no call signatures
new unionOfDifferentParameterTypes("hello");// error - no call signatures
new unionOfDifferentParameterTypes();// error - no call signatures

var unionOfDifferentNumberOfSignatures: { new (a: number): number; } | { new (a: number): Date; new (a: string): boolean; };
new unionOfDifferentNumberOfSignatures(); // error - no call signatures
new unionOfDifferentNumberOfSignatures(10); // error - no call signatures
new unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures

var unionWithDifferentParameterCount: { new (a: string): string; } | { new (a: string, b: number): number; };
new unionWithDifferentParameterCount();// no  call signature
new unionWithDifferentParameterCount("hello");// no  call signature
new unionWithDifferentParameterCount("hello", 10);// no  call signature

var unionWithOptionalParameter1: { new (a: string, b?: number): string; } | { new (a: string, b?: number): number; };
strOrNum = new unionWithOptionalParameter1('hello');
strOrNum = new unionWithOptionalParameter1('hello', 10);
strOrNum = new unionWithOptionalParameter1('hello', "hello"); // error in parameter type
strOrNum = new unionWithOptionalParameter1(); // error

var unionWithOptionalParameter2: { new (a: string, b?: number): string; } | { new (a: string, b: number): number };
strOrNum = new unionWithOptionalParameter2('hello'); // error no call signature
strOrNum = new unionWithOptionalParameter2('hello', 10); // error no call signature
strOrNum = new unionWithOptionalParameter2('hello', "hello"); // error no call signature
strOrNum = new unionWithOptionalParameter2(); // error no call signature

var unionWithOptionalParameter3: { new (a: string, b?: number): string; } | { new (a: string): number; };
strOrNum = new unionWithOptionalParameter3('hello'); // error no call signature
strOrNum = new unionWithOptionalParameter3('hello', 10); // error no call signature
strOrNum = new unionWithOptionalParameter3('hello', "hello"); // error no call signature
strOrNum = new unionWithOptionalParameter3(); // error no call signature

var unionWithRestParameter1: { new (a: string, ...b: number[]): string; } | { new (a: string, ...b: number[]): number };
strOrNum = new unionWithRestParameter1('hello');
strOrNum = new unionWithRestParameter1('hello', 10);
strOrNum = new unionWithRestParameter1('hello', 10, 11);
strOrNum = new unionWithRestParameter1('hello', "hello"); // error in parameter type
strOrNum = new unionWithRestParameter1(); // error

var unionWithRestParameter2: { new (a: string, ...b: number[]): string; } | { new (a: string, b: number): number };
strOrNum = new unionWithRestParameter2('hello'); // error no call signature
strOrNum = new unionWithRestParameter2('hello', 10); // error no call signature
strOrNum = new unionWithRestParameter2('hello', 10, 11); // error no call signature
strOrNum = new unionWithRestParameter2('hello', "hello"); // error no call signature
strOrNum = new unionWithRestParameter2(); // error no call signature

var unionWithRestParameter3: { new (a: string, ...b: number[]): string; } | { new (a: string): number };
strOrNum = new unionWithRestParameter3('hello'); // error no call signature
strOrNum = new unionWithRestParameter3('hello', 10); // error no call signature
strOrNum = new unionWithRestParameter3('hello', 10, 11); // error no call signature
strOrNum = new unionWithRestParameter3('hello', "hello"); // error no call signature
strOrNum = new unionWithRestParameter3(); // error no call signature

=====================================output=====================================
﻿var numOrDate: number | Date;
var strOrBoolean: string | boolean;
var strOrNum: string | number;

// If each type in U has construct signatures and the sets of construct signatures are identical ignoring return types,
// U has the same set of construct signatures, but with return types that are unions of the return types of the respective construct signatures from each type in U.
var unionOfDifferentReturnType:
  | { new (a: number): number }
  | { new (a: number): Date };
numOrDate = new unionOfDifferentReturnType(10);
strOrBoolean = new unionOfDifferentReturnType("hello"); // error
new unionOfDifferentReturnType1(true); // error in type of parameter

var unionOfDifferentReturnType1:
  | { new (a: number): number; new (a: string): string }
  | { new (a: number): Date; new (a: string): boolean };
numOrDate = new unionOfDifferentReturnType1(10);
strOrBoolean = new unionOfDifferentReturnType1("hello");
new unionOfDifferentReturnType1(true); // error in type of parameter
new unionOfDifferentReturnType1(); // error missing parameter

var unionOfDifferentParameterTypes:
  | { new (a: number): number }
  | { new (a: string): Date };
new unionOfDifferentParameterTypes(10); // error - no call signatures
new unionOfDifferentParameterTypes("hello"); // error - no call signatures
new unionOfDifferentParameterTypes(); // error - no call signatures

var unionOfDifferentNumberOfSignatures:
  | { new (a: number): number }
  | { new (a: number): Date; new (a: string): boolean };
new unionOfDifferentNumberOfSignatures(); // error - no call signatures
new unionOfDifferentNumberOfSignatures(10); // error - no call signatures
new unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures

var unionWithDifferentParameterCount:
  | { new (a: string): string }
  | { new (a: string, b: number): number };
new unionWithDifferentParameterCount(); // no  call signature
new unionWithDifferentParameterCount("hello"); // no  call signature
new unionWithDifferentParameterCount("hello", 10); // no  call signature

var unionWithOptionalParameter1:
  | { new (a: string, b?: number): string }
  | { new (a: string, b?: number): number };
strOrNum = new unionWithOptionalParameter1("hello");
strOrNum = new unionWithOptionalParameter1("hello", 10);
strOrNum = new unionWithOptionalParameter1("hello", "hello"); // error in parameter type
strOrNum = new unionWithOptionalParameter1(); // error

var unionWithOptionalParameter2:
  | { new (a: string, b?: number): string }
  | { new (a: string, b: number): number };
strOrNum = new unionWithOptionalParameter2("hello"); // error no call signature
strOrNum = new unionWithOptionalParameter2("hello", 10); // error no call signature
strOrNum = new unionWithOptionalParameter2("hello", "hello"); // error no call signature
strOrNum = new unionWithOptionalParameter2(); // error no call signature

var unionWithOptionalParameter3:
  | { new (a: string, b?: number): string }
  | { new (a: string): number };
strOrNum = new unionWithOptionalParameter3("hello"); // error no call signature
strOrNum = new unionWithOptionalParameter3("hello", 10); // error no call signature
strOrNum = new unionWithOptionalParameter3("hello", "hello"); // error no call signature
strOrNum = new unionWithOptionalParameter3(); // error no call signature

var unionWithRestParameter1:
  | { new (a: string, ...b: number[]): string }
  | { new (a: string, ...b: number[]): number };
strOrNum = new unionWithRestParameter1("hello");
strOrNum = new unionWithRestParameter1("hello", 10);
strOrNum = new unionWithRestParameter1("hello", 10, 11);
strOrNum = new unionWithRestParameter1("hello", "hello"); // error in parameter type
strOrNum = new unionWithRestParameter1(); // error

var unionWithRestParameter2:
  | { new (a: string, ...b: number[]): string }
  | { new (a: string, b: number): number };
strOrNum = new unionWithRestParameter2("hello"); // error no call signature
strOrNum = new unionWithRestParameter2("hello", 10); // error no call signature
strOrNum = new unionWithRestParameter2("hello", 10, 11); // error no call signature
strOrNum = new unionWithRestParameter2("hello", "hello"); // error no call signature
strOrNum = new unionWithRestParameter2(); // error no call signature

var unionWithRestParameter3:
  | { new (a: string, ...b: number[]): string }
  | { new (a: string): number };
strOrNum = new unionWithRestParameter3("hello"); // error no call signature
strOrNum = new unionWithRestParameter3("hello", 10); // error no call signature
strOrNum = new unionWithRestParameter3("hello", 10, 11); // error no call signature
strOrNum = new unionWithRestParameter3("hello", "hello"); // error no call signature
strOrNum = new unionWithRestParameter3(); // error no call signature

================================================================================
`;

exports[`unionTypeEquivalence.ts 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
﻿// A | B is equivalent to A if B is a subtype of A
class C { }
class D extends C { foo() { } }
var x: C;
var x : C | D;

// A | B is equivalent to B | A.
var y: string | number;
var y : number | string;

// AB | C is equivalent to A | BC, where AB is A | B and BC is B | C.
var z : string | number | boolean;
var z : (string | number) | boolean;
var z : string | (number | boolean);
var AB : string | number;
var BC : number | boolean;
var z1: typeof AB | boolean;
var z1: string | typeof BC;

=====================================output=====================================
﻿// A | B is equivalent to A if B is a subtype of A
class C {}
class D extends C {
  foo() {}
}
var x: C;
var x: C | D;

// A | B is equivalent to B | A.
var y: string | number;
var y: number | string;

// AB | C is equivalent to A | BC, where AB is A | B and BC is B | C.
var z: string | number | boolean;
var z: (string | number) | boolean;
var z: string | (number | boolean);
var AB: string | number;
var BC: number | boolean;
var z1: typeof AB | boolean;
var z1: string | typeof BC;

================================================================================
`;

exports[`unionTypeFromArrayLiteral.ts 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
﻿// The resulting type an array literal expression is determined as follows:
// If the array literal is empty, the resulting type is an array type with the element type Undefined.
// Otherwise, if the array literal is contextually typed by a type that has a property with the numeric name ‘0’, the resulting type is a tuple type constructed from the types of the element expressions.
// Otherwise, the resulting type is an array type with an element type that is the union of the types of the element expressions.

var arr1 = [1, 2]; // number[]
var arr2 = ["hello", true]; // (string | number)[]
var arr3Tuple: [number, string] = [3, "three"]; // [number, string]
var arr4Tuple: [number, string] = [3, "three", "hello"]; // [number, string, string]
var arrEmpty = [];
var arr5Tuple: {
    0: string;
    5: number;
} = ["hello", true, false, " hello", true, 10, "any"]; // Tuple
class C { foo() { } }
class D { foo2() { } }
class E extends C { foo3() { } }
class F extends C { foo4() { } }
var c: C, d: D, e: E, f: F;
var arr6 = [c, d];  // (C | D)[]
var arr7 = [c, d, e]; // (C | D)[]
var arr8 = [c, e]; // C[]
var arr9 = [e, f]; // (E|F)[]

=====================================output=====================================
﻿// The resulting type an array literal expression is determined as follows:
// If the array literal is empty, the resulting type is an array type with the element type Undefined.
// Otherwise, if the array literal is contextually typed by a type that has a property with the numeric name ‘0’, the resulting type is a tuple type constructed from the types of the element expressions.
// Otherwise, the resulting type is an array type with an element type that is the union of the types of the element expressions.

var arr1 = [1, 2]; // number[]
var arr2 = ["hello", true]; // (string | number)[]
var arr3Tuple: [number, string] = [3, "three"]; // [number, string]
var arr4Tuple: [number, string] = [3, "three", "hello"]; // [number, string, string]
var arrEmpty = [];
var arr5Tuple: {
  0: string;
  5: number;
} = ["hello", true, false, " hello", true, 10, "any"]; // Tuple
class C {
  foo() {}
}
class D {
  foo2() {}
}
class E extends C {
  foo3() {}
}
class F extends C {
  foo4() {}
}
var c: C, d: D, e: E, f: F;
var arr6 = [c, d]; // (C | D)[]
var arr7 = [c, d, e]; // (C | D)[]
var arr8 = [c, e]; // C[]
var arr9 = [e, f]; // (E|F)[]

================================================================================
`;

exports[`unionTypeIndexSignature.ts 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
﻿var numOrDate: number | Date;
var anyVar: number;

// If each type in U has a string index signature, 
// U has a string index signature of a union type of the types of the string index signatures from each type in U.

var unionOfDifferentReturnType: { [a: string]: number; } | { [a: string]: Date; };
numOrDate = unionOfDifferentReturnType["hello"]; // number | Date
numOrDate = unionOfDifferentReturnType[10]; // number | Date

var unionOfTypesWithAndWithoutStringSignature: { [a: string]: number; } | boolean;
anyVar = unionOfTypesWithAndWithoutStringSignature["hello"]; // any
anyVar = unionOfTypesWithAndWithoutStringSignature[10]; // any

// If each type in U has a numeric index signature, 
// U has a numeric index signature of a union type of the types of the numeric index signatures from each type in U.
var unionOfDifferentReturnType1: { [a: number]: number; } | { [a: number]: Date; };
numOrDate = unionOfDifferentReturnType1["hello"]; // any
numOrDate = unionOfDifferentReturnType1[10]; // number | Date

var unionOfTypesWithAndWithoutStringSignature1: { [a: number]: number; } | boolean;
anyVar = unionOfTypesWithAndWithoutStringSignature1["hello"]; // any
anyVar = unionOfTypesWithAndWithoutStringSignature1[10]; // any

=====================================output=====================================
﻿var numOrDate: number | Date;
var anyVar: number;

// If each type in U has a string index signature,
// U has a string index signature of a union type of the types of the string index signatures from each type in U.

var unionOfDifferentReturnType: { [a: string]: number } | { [a: string]: Date };
numOrDate = unionOfDifferentReturnType["hello"]; // number | Date
numOrDate = unionOfDifferentReturnType[10]; // number | Date

var unionOfTypesWithAndWithoutStringSignature:
  | { [a: string]: number }
  | boolean;
anyVar = unionOfTypesWithAndWithoutStringSignature["hello"]; // any
anyVar = unionOfTypesWithAndWithoutStringSignature[10]; // any

// If each type in U has a numeric index signature,
// U has a numeric index signature of a union type of the types of the numeric index signatures from each type in U.
var unionOfDifferentReturnType1:
  | { [a: number]: number }
  | { [a: number]: Date };
numOrDate = unionOfDifferentReturnType1["hello"]; // any
numOrDate = unionOfDifferentReturnType1[10]; // number | Date

var unionOfTypesWithAndWithoutStringSignature1:
  | { [a: number]: number }
  | boolean;
anyVar = unionOfTypesWithAndWithoutStringSignature1["hello"]; // any
anyVar = unionOfTypesWithAndWithoutStringSignature1[10]; // any

================================================================================
`;

exports[`unionTypePropertyAccessibility.ts 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
class Default {
    member: string;
}

class Public {
    public member: string;
}

class Protected {
    protected member: string;
}

class Private {
    private member: number;
}

var v1: Default;
var v2: Public;
var v3: Protected;
var v4: Private;
var v5: Default | Public;
var v6: Default | Protected;
var v7: Default | Private;
var v8: Public | Protected;
var v9: Public | Private;
var v10: Protected | Private;
var v11: Default | Public | Protected;
var v12: Default | Public | Private;
var v13: Default | Protected | Private;
var v14: Public | Private | Protected;
var v15: Default | Public | Private | Protected;

v1.member;
v2.member;
v3.member;
v4.member;
v5.member;
v6.member;
v7.member;
v8.member;
v9.member;
v10.member;
v11.member;
v12.member;
v13.member;
v14.member;
v15.member;

=====================================output=====================================
class Default {
  member: string;
}

class Public {
  public member: string;
}

class Protected {
  protected member: string;
}

class Private {
  private member: number;
}

var v1: Default;
var v2: Public;
var v3: Protected;
var v4: Private;
var v5: Default | Public;
var v6: Default | Protected;
var v7: Default | Private;
var v8: Public | Protected;
var v9: Public | Private;
var v10: Protected | Private;
var v11: Default | Public | Protected;
var v12: Default | Public | Private;
var v13: Default | Protected | Private;
var v14: Public | Private | Protected;
var v15: Default | Public | Private | Protected;

v1.member;
v2.member;
v3.member;
v4.member;
v5.member;
v6.member;
v7.member;
v8.member;
v9.member;
v10.member;
v11.member;
v12.member;
v13.member;
v14.member;
v15.member;

================================================================================
`;
