mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
23 lines
732 B
Plaintext
23 lines
732 B
Plaintext
enumPropertyAccess.ts(7,11): error TS2339: Property 'Green' does not exist on type 'Colors.Red'.
|
|
enumPropertyAccess.ts(12,7): error TS2339: Property 'Green' does not exist on type 'Colors'.
|
|
|
|
|
|
==== 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.Red'.
|
|
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 'Colors'.
|
|
f.toFixed(); // ok
|
|
} |