mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
60 lines
1.8 KiB
Plaintext
60 lines
1.8 KiB
Plaintext
//// [tests/cases/compiler/classPropertyErrorOnNameOnly.ts] ////
|
|
|
|
=== 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
|
|
}
|
|
}
|