react-native-health
react-native-health copied to clipboard
Casting permissions object to HealthKitPermissions in .js causing troubles
Describe the bug
Might be something simple, but in a fresh project, I get an error using the sample code from the Readme. In particular, the issue is the as HealthKitPermissions
below:
/* Permission options */
const permissions = {
permissions: {
read: [AppleHealthKit.Constants.Permissions.HeartRate],
write: [AppleHealthKit.Constants.Permissions.Steps],
},
} as HealthKitPermissions;
I use plain Javascript RN build, and added this code to App.js (naturally, the whole sample with the imports), and got the following error in the VS Code:
any(implicit)
(alias) interface HealthKitPermissions
import HealthKitPermissions
Unexpected identifier, expected the end of an expression statement (`;`)Flow(ParseError)
Installing Flow didn't help, Prettier does not like it either, and the build displays a runtime error too ('Parsing error: Missing semicolon.' one)
Any help is more than welcome!
To Reproduce Steps to reproduce the behavior:
- Fresh build of React Native
- Install react-native-health lib
- Add sample code from the 'Usage' section into App.js
- See the following error (VS Code)
Screenshots
Expected behavior No errors
If you tsx your js file, the problem will be fixed.