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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
=== tests/cases/compiler/classPropertyErrorOnNameOnly.ts ===
type Values = 1 | 2 | 3 | 4 | 5 | 6
>Values : Symbol(Values, Decl(classPropertyErrorOnNameOnly.ts, 0, 0))
type FuncType = (arg: Values) => string
>FuncType : Symbol(FuncType, Decl(classPropertyErrorOnNameOnly.ts, 0, 35))
>arg : Symbol(arg, Decl(classPropertyErrorOnNameOnly.ts, 2, 17))
>Values : Symbol(Values, Decl(classPropertyErrorOnNameOnly.ts, 0, 0))
// turn on strictNullChecks
class Example {
>Example : Symbol(Example, Decl(classPropertyErrorOnNameOnly.ts, 2, 39))
insideClass: FuncType = function(val) { // error span goes from here
>insideClass : Symbol(Example.insideClass, Decl(classPropertyErrorOnNameOnly.ts, 5, 15))
>FuncType : Symbol(FuncType, Decl(classPropertyErrorOnNameOnly.ts, 0, 35))
>val : Symbol(val, Decl(classPropertyErrorOnNameOnly.ts, 6, 35))
switch (val) {
>val : Symbol(val, Decl(classPropertyErrorOnNameOnly.ts, 6, 35))
case 1:
return "1";
case 2:
return "2";
case 3:
return "3"
case 4:
return "4"
case 5:
return "5"
// forgot case 6
}
} // all the way to here
}
const outsideClass: FuncType = function(val) { // compare to errors only on this line in this case
>outsideClass : Symbol(outsideClass, Decl(classPropertyErrorOnNameOnly.ts, 23, 5))
>FuncType : Symbol(FuncType, Decl(classPropertyErrorOnNameOnly.ts, 0, 35))
>val : Symbol(val, Decl(classPropertyErrorOnNameOnly.ts, 23, 40))
switch (val) {
>val : Symbol(val, Decl(classPropertyErrorOnNameOnly.ts, 23, 40))
case 1:
return "1";
case 2:
return "2";
case 3:
return "3"
case 4:
return "4"
case 5:
return "5"
// forgot case 6
}
}
|