react-native-cli: 1.0.0
react-native: 0.58.3
Version package: 2.0.0
SyntaxError: /Users/someUser/www/xxx/app/node_modules/react-native-permissions/src/index.ts: Unexpected token (11:59)
9 |
10 | const ANDROID = Object.freeze({
> 11 | ACCEPT_HANDOVER: 'android.permission.ACCEPT_HANDOVER' as const,
| ^
12 | ACCESS_BACKGROUND_LOCATION: 'android.permission.ACCESS_BACKGROUND_LOCATION' as const,
13 | ACCESS_COARSE_LOCATION: 'android.permission.ACCESS_COARSE_LOCATION' as const,
14 | ACCESS_FINE_LOCATION: 'android.permission.ACCESS_FINE_LOCATION' as const,
SyntaxError: /Users/someUser/www/app/app/node_modules/react-native-permissions/src/index.ts: Unexpected token (11:59)
9 |
10 | const ANDROID = Object.freeze({
> 11 | ACCEPT_HANDOVER: 'android.permission.ACCEPT_HANDOVER' as const,
| ^
12 | ACCESS_BACKGROUND_LOCATION: 'android.permission.ACCESS_BACKGROUND_LOCATION' as const,
13 | ACCESS_COARSE_LOCATION: 'android.permission.ACCESS_COARSE_LOCATION' as const,
14 | ACCESS_FINE_LOCATION: 'android.permission.ACCESS_FINE_LOCATION' as const,
at Object.raise (/Users/someUser/www/app/app/node_modules/@babel/parser/lib/index.js:3834:17)
at Object.unexpected (/Users/someUser/www/app/app/node_modules/@babel/parser/lib/index.js:5142:16)
at Object.tsParseNonArrayType (/Users/someUser/www/app/app/node_modules/@babel/parser/lib/index.js:9174:16)
at Object.tsParseArrayTypeOrHigher (/Users/someUser/www/app/app/node_modules/@babel/parser/lib/index.js:9178:21)
at Object.tsParseTypeOperatorOrHigher (/Users/someUser/www/app/app/node_modules/@babel/parser/lib/index.js:9217:120)
at Object.tsParseUnionOrIntersectionType (/Users/someUser/www/app/app/node_modules/@babel/parser/lib/index.js:9222:16)
at Object.tsParseIntersectionTypeOrHigher (/Users/someUser/www/app/app/node_modules/@babel/parser/lib/index.js:9240:17)
at Object.tsParseUnionOrIntersectionType (/Users/someUser/www/app/app/node_modules/@babel/parser/lib/index.js:9222:16)
at Object.tsParseUnionTypeOrHigher (/Users/someUser/www/app/app/node_modules/@babel/parser/lib/index.js:9244:17)
at Object.tsParseNonConditionalType (/Users/someUser/www/app/app/node_modules/@babel/parser/lib/index.js:9380:17)
@roysG Which version of metro-react-native-babel-preset or typescript do you use? Try to update them.
I'm closing this since you didn't follow the issue template.
I double check again the things you asked,
I wrote the:
I do not have problem with code, the build is fail in android and in ios the app is crash with the error i paste.
About your question,
metro-react-native-babel-preset : "0.51.1" i try to update "0.56.0"
The problem is still exists.
About the typescript version, i have many other packages that wrote in typescript without any problem.
If you have any questions, i will be happy to answer and solve this problem.
@roysG const assertions needs TS 3.4: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions
I am using react-native version 0.58.3 with cli 1.0.0
i get build error:
/Users/someUser/www/app/app/node_modules/react-native-permissions/android/src/main/java/com/reactnativecommunity/rnpermissions/RNPermissionsModule.java:10: error: package androidx.core.app does not exist
import androidx.core.app.NotificationManagerCompat;
^
/Users/someUser/www/app/app/node_modules/react-native-permissions/android/src/main/java/com/reactnativecommunity/rnpermissions/RNPermissionsModule.java:91: error: cannot find symbol
final boolean enabled = NotificationManagerCompat.from(reactContext).areNotificationsEnabled();
^
symbol: variable NotificationManagerCompat
location: class RNPermissionsModule
2 errors
3 warnings
@roysG In your package.json.
For RN 0.60 (no Android X), you need jetifier https://github.com/react-native-community/react-native-permissions/blob/master/README.md#support
Ok i will check it, thanks
@roysG I got the same issue, did you solve it?
@JavierT7 Do you use TypeScript 3.4+?
why this issue closed ?
@squalvj See this duplicate issue https://github.com/react-native-community/react-native-permissions/issues/347
Most helpful comment
I double check again the things you asked,
I wrote the:
I describe the error and paste it
The one thing that i did not write is the "fresh code section"
I do not have problem with code, the build is fail in android and in ios the app is crash with the error i paste.
About your question,
metro-react-native-babel-preset : "0.51.1" i try to update "0.56.0"
The problem is still exists.
About the typescript version, i have many other packages that wrote in typescript without any problem.
If you have any questions, i will be happy to answer and solve this problem.