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

Add TypeScript definitions #3

Merged
merged 29 commits into from
Mar 2, 2021
Merged

Add TypeScript definitions #3

merged 29 commits into from
Mar 2, 2021

Conversation

mdingena
Copy link
Member

@mdingena mdingena commented Jun 3, 2020

Context

We've added types to envato/react-breakpoints#8. Because its dependency on this package, we need to add types here as well for the exported code. An issue was raised for this: envato/react-breakpoints#11

Changes

  • Adds type definitions.
  • Adds ResizeObserver interfaces by copying type definitions from @juggle/resize-observer. This polyfill is considered up-to-spec but I want to avoid adding it as a real dependency to this package for consumers. As an intermediate solution, I'm copying its type definitions until ResizeObserver API declarations missing microsoft/TypeScript#37861 is merged.

@mdingena mdingena added enhancement New feature or request help wanted Extra attention is needed labels Jun 3, 2020
This reverts commit d4d08e2.
This should be a temporary solution until TypeScript officially supports ResizeObserver.
@mdingena mdingena marked this pull request as ready for review October 5, 2020 05:51
@mdingena mdingena requested review from luke-j and doylem October 5, 2020 05:56
Copy link

@miinx miinx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments.

As an aside, it is possible to just add the tsconfig.js & get that to output TS type defs without converting everything to TS, just fyi. There's a guide here on how to do that, if you're interested.

package.json Outdated Show resolved Hide resolved
@mdingena
Copy link
Member Author

mdingena commented Jan 14, 2021

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

Scheduled for 23 February: microsoft/TypeScript#41601

@mdingena mdingena merged commit 1dcac3c into master Mar 2, 2021
@mdingena mdingena deleted the typescript branch March 2, 2021 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants