developit / preact-redux

:loop: Preact integration for Redux (no shim needed!)
https://npm.im/preact-redux
MIT License
288 stars 27 forks source link

Fix #6: DONOTMERGE: Add react-redux typescript definition #7

Closed mseddon closed 5 years ago

mseddon commented 7 years ago

This is a pretty cheesy solution. But hey!

Seems to have trouble with stateless functional components, need to parity check the support against react before it's ready, but at least it gives everyone a chance to have a look at what I'm doing.

screendriver commented 7 years ago

Would be great if this could be merged @developit :+1:

By the way: why did you change the title to DONOTMERGE @mseddon ? Because of stateless functions? Do you have found a solution for that?

developit commented 7 years ago

That's the only reason I held off, otherwise this looks good to me (though I know little about TS)

tobico commented 7 years ago

I can confirm that this PR does not work with functional components. I played around a bit with pulling the latest definitions for react-redux, but they're quite complex and I couldn't understand them well enough to adapt them to preact.

Might be worth asking the authors of the react-redux bindings, @tkqubo @seansfkelley - would either of you be able to help get this working? Thanks!

mseddon commented 7 years ago

@screendriver yeah, stateless functions was the big one, various attempts to fix it triggered bazillions of errors. I think I'd need a bit more Typescript-fu (and free time!) to get that working. Any help appreciated!

seansfkelley commented 7 years ago

I am not familiar with preact or preact-redux, but compared to the current react-redux typings there are more differences than I would expect. What kinds of errors do you get when you introduce stateless component types? Also, note that Typescript cannot properly express the types of connect when used as a decorator, so watch out for that.

screendriver commented 7 years ago

Any updates on this?

rand0me commented 7 years ago

Check out #20, I'm using this typings and doesn't have any problems with functional components. And I'm forced to use "preact-redux": "https://github.com/rand0me/preact-redux" in my dependencies, until someone will merge it :sob: