TypeScript/tests/baselines/reference/propertyNamesWithStringLiteral.types

56 lines
1.1 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/propertyNamesWithStringLiteral.ts ===
class _Color {
>_Color : _Color
2014-08-15 23:33:16 +02:00
a: number; r: number; g: number; b: number;
>a : number
>r : number
>g : number
>b : number
2014-08-15 23:33:16 +02:00
}
interface NamedColors {
>NamedColors : NamedColors
2014-08-15 23:33:16 +02:00
azure: _Color;
>azure : _Color
>_Color : _Color
2014-08-15 23:33:16 +02:00
"blue": _Color;
>_Color : _Color
2014-08-15 23:33:16 +02:00
"pale blue": _Color;
>_Color : _Color
2014-08-15 23:33:16 +02:00
}
module Color {
>Color : typeof Color
2014-08-15 23:33:16 +02:00
export var namedColors: NamedColors;
>namedColors : NamedColors
>NamedColors : NamedColors
2014-08-15 23:33:16 +02:00
}
var a = Color.namedColors["azure"];
>a : _Color
2014-08-15 23:33:16 +02:00
>Color.namedColors["azure"] : _Color
>Color.namedColors : NamedColors
>Color : typeof Color
>namedColors : NamedColors
>"azure" : string
2014-08-15 23:33:16 +02:00
var a = Color.namedColors.blue; // Should not error
>a : _Color
>Color.namedColors.blue : _Color
>Color.namedColors : NamedColors
>Color : typeof Color
>namedColors : NamedColors
>blue : _Color
2014-08-15 23:33:16 +02:00
var a = Color.namedColors["pale blue"]; // should not error
>a : _Color
2014-08-15 23:33:16 +02:00
>Color.namedColors["pale blue"] : _Color
>Color.namedColors : NamedColors
>Color : typeof Color
>namedColors : NamedColors
>"pale blue" : string
2014-08-15 23:33:16 +02:00