19 lines
No EOL
520 B
Text
19 lines
No EOL
520 B
Text
==== 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
|
|
~~~~~
|
|
!!! Property 'Green' does not exist on type 'Colors'.
|
|
x.toFixed(); // ok
|
|
|
|
// Now with generics
|
|
function fill<B extends Colors>(f: B) {
|
|
f.Green; // error
|
|
~~~~~
|
|
!!! Property 'Green' does not exist on type 'B'.
|
|
f.toFixed(); // ok
|
|
} |