|
| 1 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(9,47): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. |
| 2 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(10,33): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. |
| 3 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(15,33): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. |
| 4 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(16,1): error TS2346: Supplied parameters do not match any signature of call target. |
| 5 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(19,1): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 6 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(20,1): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 7 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(21,1): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 8 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(24,1): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 9 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(25,1): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 10 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(26,1): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 11 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(29,1): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 12 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(30,1): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 13 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(31,1): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 14 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(36,53): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. |
| 15 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(37,12): error TS2346: Supplied parameters do not match any signature of call target. |
| 16 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(40,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 17 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(41,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 18 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(42,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 19 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(43,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 20 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(46,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 21 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(47,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 22 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(48,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 23 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(49,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 24 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(55,49): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. |
| 25 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(56,12): error TS2346: Supplied parameters do not match any signature of call target. |
| 26 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(59,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 27 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(60,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 28 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(61,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 29 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(62,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 30 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(63,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 31 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(66,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 32 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(67,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 33 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(68,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 34 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(69,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 35 | +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 36 | + |
| 37 | + |
| 38 | +==== tests/cases/conformance/types/union/unionTypeConstructSignatures.ts (35 errors) ==== |
| 39 | + var numOrDate: number | Date; |
| 40 | + var strOrBoolean: string | boolean; |
| 41 | + var strOrNum: string | number; |
| 42 | + |
| 43 | + // If each type in U has construct signatures and the sets of construct signatures are identical ignoring return types, |
| 44 | + // 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. |
| 45 | + var unionOfDifferentReturnType: { new (a: number): number; } | { new (a: number): Date; }; |
| 46 | + numOrDate = new unionOfDifferentReturnType(10); |
| 47 | + strOrBoolean = new unionOfDifferentReturnType("hello"); // error |
| 48 | + ~~~~~~~ |
| 49 | +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. |
| 50 | + new unionOfDifferentReturnType1(true); // error in type of parameter |
| 51 | + ~~~~ |
| 52 | +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. |
| 53 | + |
| 54 | + var unionOfDifferentReturnType1: { new (a: number): number; new (a: string): string; } | { new (a: number): Date; new (a: string): boolean; }; |
| 55 | + numOrDate = new unionOfDifferentReturnType1(10); |
| 56 | + strOrBoolean = new unionOfDifferentReturnType1("hello"); |
| 57 | + new unionOfDifferentReturnType1(true); // error in type of parameter |
| 58 | + ~~~~ |
| 59 | +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. |
| 60 | + new unionOfDifferentReturnType1(); // error missing parameter |
| 61 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 62 | +!!! error TS2346: Supplied parameters do not match any signature of call target. |
| 63 | + |
| 64 | + var unionOfDifferentParameterTypes: { new (a: number): number; } | { new (a: string): Date; }; |
| 65 | + new unionOfDifferentParameterTypes(10);// error - no call signatures |
| 66 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 67 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 68 | + new unionOfDifferentParameterTypes("hello");// error - no call signatures |
| 69 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 70 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 71 | + new unionOfDifferentParameterTypes();// error - no call signatures |
| 72 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 73 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 74 | + |
| 75 | + var unionOfDifferentNumberOfSignatures: { new (a: number): number; } | { new (a: number): Date; new (a: string): boolean; }; |
| 76 | + new unionOfDifferentNumberOfSignatures(); // error - no call signatures |
| 77 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 78 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 79 | + new unionOfDifferentNumberOfSignatures(10); // error - no call signatures |
| 80 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 81 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 82 | + new unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures |
| 83 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 84 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 85 | + |
| 86 | + var unionWithDifferentParameterCount: { new (a: string): string; } | { new (a: string, b: number): number; }; |
| 87 | + new unionWithDifferentParameterCount();// no call signature |
| 88 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 89 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 90 | + new unionWithDifferentParameterCount("hello");// no call signature |
| 91 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 92 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 93 | + new unionWithDifferentParameterCount("hello", 10);// no call signature |
| 94 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 95 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 96 | + |
| 97 | + var unionWithOptionalParameter1: { new (a: string, b?: number): string; } | { new (a: string, b?: number): number; }; |
| 98 | + strOrNum = new unionWithOptionalParameter1('hello'); |
| 99 | + strOrNum = new unionWithOptionalParameter1('hello', 10); |
| 100 | + strOrNum = new unionWithOptionalParameter1('hello', "hello"); // error in parameter type |
| 101 | + ~~~~~~~ |
| 102 | +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. |
| 103 | + strOrNum = new unionWithOptionalParameter1(); // error |
| 104 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 105 | +!!! error TS2346: Supplied parameters do not match any signature of call target. |
| 106 | + |
| 107 | + var unionWithOptionalParameter2: { new (a: string, b?: number): string; } | { new (a: string, b: number): number }; |
| 108 | + strOrNum = new unionWithOptionalParameter2('hello'); // error no call signature |
| 109 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 110 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 111 | + strOrNum = new unionWithOptionalParameter2('hello', 10); // error no call signature |
| 112 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 113 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 114 | + strOrNum = new unionWithOptionalParameter2('hello', "hello"); // error no call signature |
| 115 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 116 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 117 | + strOrNum = new unionWithOptionalParameter2(); // error no call signature |
| 118 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 119 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 120 | + |
| 121 | + var unionWithOptionalParameter3: { new (a: string, b?: number): string; } | { new (a: string): number; }; |
| 122 | + strOrNum = new unionWithOptionalParameter3('hello'); // error no call signature |
| 123 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 124 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 125 | + strOrNum = new unionWithOptionalParameter3('hello', 10); // error no call signature |
| 126 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 127 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 128 | + strOrNum = new unionWithOptionalParameter3('hello', "hello"); // error no call signature |
| 129 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 130 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 131 | + strOrNum = new unionWithOptionalParameter3(); // error no call signature |
| 132 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 133 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 134 | + |
| 135 | + var unionWithRestParameter1: { new (a: string, ...b: number[]): string; } | { new (a: string, ...b: number[]): number }; |
| 136 | + strOrNum = new unionWithRestParameter1('hello'); |
| 137 | + strOrNum = new unionWithRestParameter1('hello', 10); |
| 138 | + strOrNum = new unionWithRestParameter1('hello', 10, 11); |
| 139 | + strOrNum = new unionWithRestParameter1('hello', "hello"); // error in parameter type |
| 140 | + ~~~~~~~ |
| 141 | +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. |
| 142 | + strOrNum = new unionWithRestParameter1(); // error |
| 143 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 144 | +!!! error TS2346: Supplied parameters do not match any signature of call target. |
| 145 | + |
| 146 | + var unionWithRestParameter2: { new (a: string, ...b: number[]): string; } | { new (a: string, b: number): number }; |
| 147 | + strOrNum = new unionWithRestParameter2('hello'); // error no call signature |
| 148 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 149 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 150 | + strOrNum = new unionWithRestParameter2('hello', 10); // error no call signature |
| 151 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 152 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 153 | + strOrNum = new unionWithRestParameter2('hello', 10, 11); // error no call signature |
| 154 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 155 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 156 | + strOrNum = new unionWithRestParameter2('hello', "hello"); // error no call signature |
| 157 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 158 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 159 | + strOrNum = new unionWithRestParameter2(); // error no call signature |
| 160 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 161 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 162 | + |
| 163 | + var unionWithRestParameter3: { new (a: string, ...b: number[]): string; } | { new (a: string): number }; |
| 164 | + strOrNum = new unionWithRestParameter3('hello'); // error no call signature |
| 165 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 166 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 167 | + strOrNum = new unionWithRestParameter3('hello', 10); // error no call signature |
| 168 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 169 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 170 | + strOrNum = new unionWithRestParameter3('hello', 10, 11); // error no call signature |
| 171 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 172 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 173 | + strOrNum = new unionWithRestParameter3('hello', "hello"); // error no call signature |
| 174 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 175 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
| 176 | + strOrNum = new unionWithRestParameter3(); // error no call signature |
| 177 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 178 | +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. |
0 commit comments