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

Rewrite code in TypeScript #13

Merged
merged 33 commits into from
Mar 5, 2021
Merged

Rewrite code in TypeScript #13

merged 33 commits into from
Mar 5, 2021

Conversation

mdingena
Copy link
Member

@mdingena mdingena commented Mar 5, 2021

Context

PR #8 introduced some type definitions, but because this package relies on @envato/react-resize-observer-hook with missing type definitions, there were types missing for some of the things that this package exposes (like <Provider> and useResizeObserver()).

Types were introduced in envato/react-resize-observer-hook#3 to address that.

This PR updates the codebase to be written in TypeScript, rather than JavaScript with a type definition file. Some other optimisations, API changes, and documentation updates have been added.

Changes

  • Rewritten code in TypeScript.
  • API changes (non-breaking):
    • <Observe> now supports render functions through children (in addition to using the render prop), giving you the option to use your preferred syntax.
    • useBreakpoints() now also supports object destructuring:
      const { widthMatch, heightMatch } = useBreakpoints(options);
  • Resolves Provider declaration missing in index.d.ts #11.

@mdingena mdingena requested a review from luke-j March 5, 2021 03:50
@mdingena mdingena marked this pull request as ready for review March 5, 2021 03:50
@mdingena mdingena merged commit 7dc39df into main Mar 5, 2021
@mdingena mdingena deleted the typescript branch March 5, 2021 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provider declaration missing in index.d.ts
1 participant