react-native-purchases icon indicating copy to clipboard operation
react-native-purchases copied to clipboard

@types/react-native-purchases

Open bithavoc opened this issue 7 years ago • 15 comments

Please export types for TS through definitelytyped.

Thanks.

bithavoc avatar Jul 30 '19 01:07 bithavoc

Hi @bithavoc, more than through definitelytyped, we will be refactoring this react-native wrapper to TypeScript soon, and therefore exporting the types ourselves.

Will leave this issue open until we do.

alfondotnet avatar Jul 30 '19 01:07 alfondotnet

Hey guys, Any update on this?

oaosman84 avatar Oct 30 '19 23:10 oaosman84

They don’t give a fuck, Jacob sent me an email asking why I didn’t finish my integration to AppStore, I laughed.

bithavoc avatar Oct 30 '19 23:10 bithavoc

Hi @oaosman84!, sorry about the delay, been pretty busy building features and have had this in the back on my head but haven't had time to get around to it yet.

I will get to this by this week

alfondotnet avatar Oct 30 '19 23:10 alfondotnet

Hey @bithavoc. We give lots of fucks, just super busy. We have 7 SDKs and only one person working on them full time.

If you know anyone, we're hiring: https://jobs.lever.co/revenuecat

jeiting avatar Oct 30 '19 23:10 jeiting

Should this work for v3 releases, or is it yet to be formally released? I can see an index.d.ts but the types don't seem to work when I import them.

matt-dalton avatar Dec 23 '19 11:12 matt-dalton

@matt-dalton, you are correct, types seem to not been linked, a new release with the fix will be published soon, thanks for the heads up!

alfondotnet avatar Dec 23 '19 16:12 alfondotnet

Haha cool thanks - easy enough for me to export them myself with a patch in the short-term.

The new API is looking great otherwise!

matt-dalton avatar Dec 23 '19 17:12 matt-dalton

The types are correctly linked since they are in the root as index.d.ts and typescript can find them there by default. What was misisng was the export of the interfaces so that you can use them in your typescript code. I just released 3.0.5 that should address that. Sorry about that @matt-dalton !

vegaro avatar Dec 24 '19 09:12 vegaro

Would it also be possible to export the enums, specifically PACKAGE_TYPE? We've found that useful when writing robust code on our end.

matt-dalton avatar Dec 24 '19 09:12 matt-dalton

I didn't export the enums because they are already accessible through the Purchases class. You can do Purchases.PACKAGE_TYPE.

vegaro avatar Dec 24 '19 09:12 vegaro

But then if I try and use it as a type (e.g. for typing args), I get an error. e.g.

type PACKAGE_TYPE = Purchases.PACKAGE_TYPE
// 'Purchases' only refers to a type, but is being used as a namespace here

Most of the answers online around this seem to suggest updating the definition

matt-dalton avatar Dec 24 '19 09:12 matt-dalton

Got it, will update it now then 👍

vegaro avatar Dec 24 '19 10:12 vegaro

Just released https://github.com/RevenueCat/react-native-purchases/releases/tag/3.0.6 @matt-dalton

Let us know if you have any other request. Cheers!

vegaro avatar Dec 24 '19 10:12 vegaro

Amazing! Works - thanks!

matt-dalton avatar Dec 24 '19 10:12 matt-dalton