interfaces with literal property names

Topics: Language Specification
Nov 14, 2012 at 12:00 AM

I have this object initialization..

var foo = {    "[[Value]]": 10}

I'd really rather do:

var foo: bar = {    "[[Value]]": 10}

but this doesn't seem legal:

interface bar { 

  "[[Value]]": Number;


Apparently typescript doesn't believe that "[[Value]]" represents a valid identifier.  However, in this case javascript allows it as a property name.

Any workarounds?

Nov 14, 2012 at 3:31 PM

We don't support this, yet, though it has come up before.  Copying to a work item so we can track more easily.

Nov 14, 2012 at 3:31 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.