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