dimanche 28 août 2016

Creating JSON-like data in Typescript

So in normal Javascript you can execute this block of code fine:

var myObj = {};
myObj['one'] = {};

console.log(myObj);
console.log(myObj.one);

But you get this error in TypeScript Property 'one' does not exist on type '{}'

Is this just by design? (e.g. I'm expected to make my own classes for this)

Aucun commentaire:

Enregistrer un commentaire