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

Housekeeping & improvements, part 2 #24

Merged
merged 9 commits into from
Nov 3, 2021

Conversation

akx
Copy link
Contributor

@akx akx commented Nov 3, 2021

This PR builds on #23:

  • It makes the TypeScript configuration a bit stricter, for cleaner code. 🧹
  • It gets rid of the separate e.ts/e.native.ts modules; it didn't feel necessary to have a different .native.ts file when you can detect ReactNativeness just as easily. At the same, e was renamed to useIsomorphicLayoutEffect (which is a common name for the idiom), for readability.
  • Speaking of readability, this PR humanizes some of the names used by the external interface, so they're easier to understand for end-users of the library.
  • It slightly improves the types for less repetition; for instance, React.SetStateAction is a dead ringer for the interface used for the setter in this library.
  • It removes an apparently (?) unused ac parameter that didn't match the actually returned type anyway.
  • It switches to optional chaining wherever suitable.

All things considered, the files in dist/ are still smaller than in main (448e745); 2023 bytes there, 1590 bytes here. 😇

@akx akx marked this pull request as draft November 3, 2021 20:53
@akx akx marked this pull request as ready for review November 3, 2021 21:07
@RichardLindhout
Copy link
Member

Thanks, looks good!

@RichardLindhout RichardLindhout merged commit 856d8af into web-ridge:main Nov 3, 2021
@akx akx deleted the housekeep2 branch November 4, 2021 06:29
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.

2 participants