Export types instead of enums #418#419
Open
zbarbuto wants to merge 1 commit intoagencyenterprise:masterfrom
Open
Export types instead of enums #418#419zbarbuto wants to merge 1 commit intoagencyenterprise:masterfrom
zbarbuto wants to merge 1 commit intoagencyenterprise:masterfrom
Conversation
Export what were previously enums as types Update the typings of `Constants` so they are more type-safe. Resolves agencyenterprise#418
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:

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

Further, we can now import and use constants and the typings for it are more complete:
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.
Checklist: