ReactMeteorData: How to use with typescript

How can one use the ReactMeteorData mixin inside a Meteor-React application if typescript is used?

Could someone please explain what would need to be added to the react.d.ts file and how it would look like beeing used in the class which needs to react to the data change?

Any help would be appreciated.

It should work just fine, just like it does in normal JavaScript, right?

React.createClass({
  mixins: [ReactMeteorData],

  render: function() { /* ... */ }
})

Thank you for the quick answer.

Unfortunately it doesn’t work as the meteor and react definition files of typescript haven’t defined the ReacrMeteorData type and it therefore doesn’t compile.

Any advice on how to provide the definition for this?

I actually don’t use typescript myself, but I know this: ReactMeteorData is just a global variable, and I don’t see any reason why it can’t be put into an array literal like in the example. Got some code? What are you trying and what error does it give? If you have a repo, that’s the easiest way to see what’s going on.

The problem is that getMeteorData add a data member to the Class, which Typescript doesn’t know about.

So there is no possibility to run meteor-react with typescript?

You can’t run it, but you will have to disregard errors about this.data inexisting.

So that means no one has ever managed to successfully run meteor with typescript while using react as the rendering component?

Thats really sad…

Just because you are disregarding some errors doesn’t make you unsucessful !
I’m quite sure there must be a way to write some definition file to get the compiler to be aware of this.data, but my definition-fu and decorator-fu is not on par with the problem at hand.

Ok I finally managed to get it working, but it requires Webpack to work successfully (due to meteors limitation of require and imports)

If anyone is interested you can check out here:

Of course I got inspired by other projects which are mentioned in the readme