2014-09-12 22:35:07 +02:00
|
|
|
tests/cases/compiler/enumPropertyAccess.ts(7,11): error TS2339: Property 'Green' does not exist on type 'Colors'.
|
|
|
|
tests/cases/compiler/enumPropertyAccess.ts(12,7): error TS2339: Property 'Green' does not exist on type 'B'.
|
|
|
|
|
|
|
|
|
2014-07-13 01:04:16 +02:00
|
|
|
==== 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
|
|
|
|
~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2339: Property 'Green' does not exist on type 'Colors'.
|
2014-07-13 01:04:16 +02:00
|
|
|
x.toFixed(); // ok
|
|
|
|
|
|
|
|
// Now with generics
|
|
|
|
function fill<B extends Colors>(f: B) {
|
|
|
|
f.Green; // error
|
|
|
|
~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2339: Property 'Green' does not exist on type 'B'.
|
2014-07-13 01:04:16 +02:00
|
|
|
f.toFixed(); // ok
|
|
|
|
}
|