Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provider declaration missing in index.d.ts #11

Closed
ngnathan opened this issue May 20, 2020 · 8 comments · Fixed by #13
Closed

Provider declaration missing in index.d.ts #11

ngnathan opened this issue May 20, 2020 · 8 comments · Fixed by #13
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@ngnathan
Copy link

Using React with TypeScript, I can't seem to import Provider.

Looking at the index.d.ts file, it looks like the interface to this is missing.

@gwitteveen
Copy link

Same goes for the re-export of useResizeObserver.
Basically the exports from @envato/react-resize-observer-hook lack type definitions.

@mdingena
Copy link
Member

mdingena commented Jun 3, 2020

I feared this would happen. I'm not too well versed in TS but I added it as a courtesy to the many developers out there who love TS.

I could use your help with adding interfaces to @envato/react-resize-observer-hook. I've been working on a branch to add types but it's been on hold because I'm unsure whether I need to manually implement an interface for ResizeObserver or not, now that Safari has implemented it and the TypeScript PR seemed to re-opened.

Please see #8 and microsoft/TypeScript#37861 for context.

I will push up a branch with my stale WIP shortly.

@mdingena mdingena added bug Something isn't working help wanted Extra attention is needed labels Jun 3, 2020
@mdingena
Copy link
Member

mdingena commented Jun 3, 2020

@ngnathan @gwitteveen I'm inviting you to contribute to envato/react-resize-observer-hook#3

@artmsilva
Copy link

Any updates on this? I noticed this issue while trying to build using Rollup.js.

@mdingena
Copy link
Member

mdingena commented Oct 2, 2020

@artmsilva I'm not sure what the correct way forward is. On one hand I'd like to help TS users use this package (I'm not a TS user myself). On the other hand it feels redundant to write the entire ResizeObserver interface when official TypeScript support is being worked on.

I suppose I could export it with an explicit any to at least suppress errors in consuming packages, then adopt the official interface when it's released later.

What do you think?

@artmsilva
Copy link

@mdingena I think the latter is best in the interim. Thanks for being so responsive!

@mdingena
Copy link
Member

mdingena commented Oct 5, 2020

I've marked envato/react-resize-observer-hook#3 as Ready For Review. It rewrites the JavaScript to TypeScript rather than just providing an index.d.ts file.

Once that PR is merged, we can update this package's dependencies to resolve the issue.

@artmsilva @ngnathan @gwitteveen I invite you all to please have a look at the linked PR. There is a lot going but could you please focus on the .ts / .tsx files and the type definitions therein?

@mdingena
Copy link
Member

I'm waiting for TypeScript 4.2 to be released, which includes interfaces for ResizeObserver.

It's currently scheduled for 23 February: microsoft/TypeScript#41601

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants