Describe the bug
As an example, HealthActivity is exported as an enum (rather than just a type) when no such value exists.
To Reproduce
This gives no TypeScript errors, since HealthActivity is reported as an exported enum.
import AppleHealthKit, {HealthActivity} from 'HealthActivity';
AppleHealthKit.saveWorkout({
type: HealthActivity.Boxing,
// other options
});
Instead you get a runtime error "Cannot read property 'Boxing' of undefined" (since the actual value that needs to be referenced is exported under Constants at Constants.Activities.Boxing
Expected behavior
Either HealthActivity (and similar values HealthUnits, HealthObserver and HealthPermission should be converted to Types so that using them as values gives the appropriate TypeSCript error "'HealthActivity' only refers to a type, but is being used as a value here."
Or, the typings should be updated to expose the correct export Constants showing that the actual value to be used is e.g. Constants.Acitivities.Boxing
import AppleHealthKit, {Constants} from 'HealthActivity';
AppleHealthKit.saveWorkout({
type: Constants.Activities.Boxing,
});
Describe the bug
As an example,
HealthActivityis exported as an enum (rather than just atype) when no such value exists.To Reproduce
This gives no TypeScript errors, since
HealthActivityis reported as an exported enum.Instead you get a runtime error
"Cannot read property 'Boxing' of undefined"(since the actual value that needs to be referenced is exported underConstantsatConstants.Activities.BoxingExpected behavior
Either
HealthActivity(and similar valuesHealthUnits,HealthObserverandHealthPermissionshould be converted toTypes so that using them as values gives the appropriate TypeSCript error"'HealthActivity' only refers to a type, but is being used as a value here."Or, the typings should be updated to expose the correct export
Constantsshowing that the actual value to be used is e.g.Constants.Acitivities.Boxing