quoted property names in interface declarations


Lots of JSON that I want to create an interface declaration for uses hyphens in the name. Unfortunately, this is not allowed in an identifier.

An example is mapping to the JSON returned from the Spotify Metadata API. I can't seem to map "artist-id". I've tried a couple of things:


export interface Album {
//artist-id: string;
//artist\u002did: string;
//"artist-id": string;
name: string;
artist: string;
//external-ids: ExternalId[];
released: string;
tracks: Track[];
href: string;
availability: Availability;

This was also brought up on stackoverflow here:
Closed May 31, 2013 at 2:09 AM by danquirk
This works in the latest bits. There is a bug where we are not resolving the type correctly (i.e. when you access albumInstance['artist-id'] you get a value of type any instead of string) but quoted property names are supported in type declarations now.


nogece2 wrote Sep 1, 2013 at 5:38 PM

I tried this by typing the following into the playground. It shows errors. Doesnt seem to work.
interface X {

var x:X = {

paulb wrote Sep 6, 2013 at 11:32 PM

This is fixed in the develop branch.