Skip to content

Export types instead of enums #418#419

Open
zbarbuto wants to merge 1 commit intoagencyenterprise:masterfrom
NextFaze:master
Open

Export types instead of enums #418#419
zbarbuto wants to merge 1 commit intoagencyenterprise:masterfrom
NextFaze:master

Conversation

@zbarbuto
Copy link

Description

The enums are now private to the package, meaning they can not be used directly by consumers.

The result is as follows:

What were previously enums are now only types:
image

This results in a typing error when trying to use it as a value:
image

Further, we can now import and use constants and the typings for it are more complete:

image

Note, the previous enums can still technically be imported from react-native-health/enums - I couldn't work out how to make them fully private. However, it's much harder to accidentally use as a value now.

Fixes #418

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have checked my code and corrected any misspellings

Export what were previously enums as types

Update the typings of `Constants` so they are more type-safe.

Resolves agencyenterprise#418
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.

Typings do not match exported values

1 participant