TypeScript/tests/baselines/reference/enumPropertyAccess.errors.txt
2014-09-11 16:11:08 -07:00

19 lines
548 B
Plaintext

==== tests/cases/compiler/enumPropertyAccess.ts (2 errors) ====
enum Colors {
Red,
Green
}
var x = Colors.Red; // type of 'x' should be 'Colors'
var p = x.Green; // error
~~~~~
!!! error TS2339: Property 'Green' does not exist on type 'Colors'.
x.toFixed(); // ok
// Now with generics
function fill<B extends Colors>(f: B) {
f.Green; // error
~~~~~
!!! error TS2339: Property 'Green' does not exist on type 'B'.
f.toFixed(); // ok
}