Friday 15 January 2010

javascript - Using an existing AMD js module in a new typescript file (0.9) -


I use a current AMD written in pure javascript with a new typecript file using TypeScript v0.9 I am trying. I have broken it in very simple AMD to display this issue.

First of all, my current AMD (activityProperty.js):

  defined ([], function () {var activityProperty = function (key, value) {var self = This; self.key = key; self.value = value; return self;}; return activity property;});   

Second, I have created the Property D.ts with an interface definition of the current AMD:

  Export Interface IActivityProperty {key: string; Value: string; }   

Finally, I have created a new typecript class (PropertyBag.T.T), where I want to use my old activity property AMD:

  Import PropertyModule = Required ("activityProperty"); Class Property Bag {Private Properties: Array & lt; PropertyModel. ActivityProTy; Constructor () {this.properties = new Array & lt; PropertyModule.IActivityProperty & gt; (); // This is where my problem is ... // thes.properties.push (new) activity (property) ???); }}   

I can not understand how to use the old AMD definition to create a new example of the activityProperty class for my life. Missing trivial or obvious?

Thanks for any and all help!

Currently there is only one interface in your declaration, declare it class as to be renewed Can be expanded and / or expanded ...

  class protection installed {constructor (public key: string, public value: string); }   

You can decide whether to keep your interface or not.

No comments:

Post a Comment