|
| 1 | +tests/cases/compiler/parseErrorIncorrectReturnToken.ts(2,17): error TS1005: ':' expected. |
| 2 | +tests/cases/compiler/parseErrorIncorrectReturnToken.ts(4,22): error TS1005: '=>' expected. |
| 3 | +tests/cases/compiler/parseErrorIncorrectReturnToken.ts(4,24): error TS2693: 'string' only refers to a type, but is being used as a value here. |
| 4 | +tests/cases/compiler/parseErrorIncorrectReturnToken.ts(9,18): error TS1005: '{' expected. |
| 5 | +tests/cases/compiler/parseErrorIncorrectReturnToken.ts(9,21): error TS2693: 'string' only refers to a type, but is being used as a value here. |
| 6 | +tests/cases/compiler/parseErrorIncorrectReturnToken.ts(9,28): error TS1005: ';' expected. |
| 7 | +tests/cases/compiler/parseErrorIncorrectReturnToken.ts(12,1): error TS1128: Declaration or statement expected. |
| 8 | + |
| 9 | + |
| 10 | +==== tests/cases/compiler/parseErrorIncorrectReturnToken.ts (7 errors) ==== |
| 11 | + type F1 = { |
| 12 | + (n: number) => string; // should be : not => |
| 13 | + ~~ |
| 14 | +!!! error TS1005: ':' expected. |
| 15 | + } |
| 16 | + type F2 = (n: number): string; // should be => not : |
| 17 | + ~ |
| 18 | +!!! error TS1005: '=>' expected. |
| 19 | + ~~~~~~ |
| 20 | +!!! error TS2693: 'string' only refers to a type, but is being used as a value here. |
| 21 | + |
| 22 | + // doesn't work in non-type contexts, where the return type is optional |
| 23 | + let f = (n: number) => string => n.toString(); |
| 24 | + let o = { |
| 25 | + m(n: number) => string { |
| 26 | + ~~ |
| 27 | +!!! error TS1005: '{' expected. |
| 28 | + ~~~~~~ |
| 29 | +!!! error TS2693: 'string' only refers to a type, but is being used as a value here. |
| 30 | + ~ |
| 31 | +!!! error TS1005: ';' expected. |
| 32 | + return n.toString(); |
| 33 | + } |
| 34 | + }; |
| 35 | + ~ |
| 36 | +!!! error TS1128: Declaration or statement expected. |
| 37 | + |
0 commit comments