55 lines
1.1 KiB
Text
55 lines
1.1 KiB
Text
=== tests/cases/compiler/propertyNamesWithStringLiteral.ts ===
|
|
class _Color {
|
|
>_Color : _Color
|
|
|
|
a: number; r: number; g: number; b: number;
|
|
>a : number
|
|
>r : number
|
|
>g : number
|
|
>b : number
|
|
}
|
|
|
|
interface NamedColors {
|
|
>NamedColors : NamedColors
|
|
|
|
azure: _Color;
|
|
>azure : _Color
|
|
>_Color : _Color
|
|
|
|
"blue": _Color;
|
|
>_Color : _Color
|
|
|
|
"pale blue": _Color;
|
|
>_Color : _Color
|
|
}
|
|
module Color {
|
|
>Color : typeof Color
|
|
|
|
export var namedColors: NamedColors;
|
|
>namedColors : NamedColors
|
|
>NamedColors : NamedColors
|
|
}
|
|
var a = Color.namedColors["azure"];
|
|
>a : _Color
|
|
>Color.namedColors["azure"] : _Color
|
|
>Color.namedColors : NamedColors
|
|
>Color : typeof Color
|
|
>namedColors : NamedColors
|
|
>"azure" : string
|
|
|
|
var a = Color.namedColors.blue; // Should not error
|
|
>a : _Color
|
|
>Color.namedColors.blue : _Color
|
|
>Color.namedColors : NamedColors
|
|
>Color : typeof Color
|
|
>namedColors : NamedColors
|
|
>blue : _Color
|
|
|
|
var a = Color.namedColors["pale blue"]; // should not error
|
|
>a : _Color
|
|
>Color.namedColors["pale blue"] : _Color
|
|
>Color.namedColors : NamedColors
|
|
>Color : typeof Color
|
|
>namedColors : NamedColors
|
|
>"pale blue" : string
|
|
|