Reanimated 2.5.0 breaks type checks
See original GitHub issueDescription
Using the latest version, typescript checks are failing with a bunch of errors.
node_modules/react-native-reanimated/src/reanimated2/animation/index.ts(2,3): error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
node_modules/react-native-reanimated/src/reanimated2/animation/index.ts(3,3): error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
node_modules/react-native-reanimated/src/reanimated2/animation/index.ts(4,3): error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
node_modules/react-native-reanimated/src/reanimated2/animation/index.ts(5,3): error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
node_modules/react-native-reanimated/src/reanimated2/animation/index.ts(6,3): error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
node_modules/react-native-reanimated/src/reanimated2/animation/index.ts(7,3): error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
node_modules/react-native-reanimated/src/reanimated2/animation/index.ts(10,22): error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
node_modules/react-native-reanimated/src/reanimated2/animation/index.ts(11,22): error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
node_modules/react-native-reanimated/src/reanimated2/animation/index.ts(12,21): error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
node_modules/react-native-reanimated/src/reanimated2/core.ts(17,8): error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.
node_modules/react-native-reanimated/src/reanimated2/core.ts(21,12): error TS2339: Property '_setGlobalConsole' does not exist on type 'typeof globalThis'.
node_modules/react-native-reanimated/src/reanimated2/core.ts(23,10): error TS2339: Property '_setGlobalConsole' does not exist on type 'typeof globalThis'.
node_modules/react-native-reanimated/src/reanimated2/core.ts(102,8): error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.
node_modules/react-native-reanimated/src/reanimated2/core.ts(132,8): error TS2339: Property '_WORKLET' does not exist on type 'typeof globalThis'.
node_modules/react-native-reanimated/src/reanimated2/core.ts(133,8): error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.
node_modules/react-native-reanimated/src/reanimated2/core.ts(383,16): error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.
node_modules/react-native-reanimated/src/reanimated2/core.ts(384,14): error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.
node_modules/react-native-reanimated/src/reanimated2/core.ts(385,21): error TS2339: Property '_chronoNow' does not exist on type 'typeof globalThis'.
node_modules/react-native-reanimated/src/reanimated2/js-reanimated/index.ts(17,10): error TS2339: Property '_frameTimestamp' does not exist on type 'typeof globalThis'.
node_modules/react-native-reanimated/src/reanimated2/js-reanimated/index.ts(18,10): error TS2339: Property '_setGlobalConsole' does not exist on type 'typeof globalThis'.
node_modules/react-native-reanimated/src/reanimated2/js-reanimated/index.ts(18,31): error TS7006: Parameter '_val' implicitly has an 'any' type.
node_modules/react-native-reanimated/src/reanimated2/js-reanimated/index.ts(21,10): error TS2339: Property '_measure' does not exist on type 'typeof globalThis'.
node_modules/react-native-reanimated/src/reanimated2/js-reanimated/index.ts(34,10): error TS2339: Property '_scrollTo' does not exist on type 'typeof globalThis'.
node_modules/react-native-reanimated/src/reanimated2/js-reanimated/index.ts(39,10): error TS2339: Property '_setGestureState' does not exist on type 'typeof globalThis'.
node_modules/react-native-reanimated/src/reanimated2/js-reanimated/JSReanimated.ts(19,47): error TS2339: Property 'ReanimatedDataMock' does not exist on type 'typeof globalThis'.
node_modules/react-native-reanimated/src/reanimated2/js-reanimated/JSReanimated.ts(21,40): error TS2304: Cannot find name 'window'.
node_modules/react-native-reanimated/src/reanimated2/NativeReanimated/NativeReanimated.ts(14,16): error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.
node_modules/react-native-reanimated/src/reanimated2/NativeReanimated/NativeReanimated.ts(18,37): error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.
Expected behavior
Lib is working the same way as before.
Actual behavior & steps to reproduce
Type errors which are blocking me from using that newer release. Is should be quite well reproducable by using the latest version and a standard RN project. My tsconfig options are using the recommended values provided by expo and RN.
Snack or minimal code example
I am using the following tsconfig in my project:
{
"compilerOptions": {
/* Basic Options */
"target": "esnext",
"module": "commonjs",
"lib": ["es2017"],
"allowJs": true,
"jsx": "react-native",
"noEmit": true,
"isolatedModules": true,
/* Strict Type-Checking Options */
"strict": true,
/* Module Resolution Options */
"moduleResolution": "node",
"baseUrl": "./src",
"paths": { "@/*": ["./*"] },
"typeRoots": ["./@types", "./node_modules/@types"],
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"skipLibCheck": true,
"resolveJsonModule": true
},
"exclude": [
"node_modules", "babel.config.js", "metro.config.js", "jest.config.js"
]
}
Package versions
| name | version |
|---|---|
| react-native | 0.67.4 |
| react-native-reanimated | 2.5.0 |
| NodeJS | 16.14.0 |
| Xcode | 13.3 |
| Java | 11 |
| Gradle | |
| expo | 44 |
Affected platforms
- Android
- iOS
- Web
Issue Analytics
- State:
- Created 2 years ago
- Reactions:42
- Comments:18 (4 by maintainers)
Top Results From Across the Web
react-native-reanimated - npm
React Native's Animated library reimplemented. Reanimated 2 is here! Check out our documentation page for more information. React Native ...
Read more >Installation | React Native Reanimated - Software Mansion
Some libraries break when turbo modules are enabled so we decided to change our approach and we no longer use the standard way...
Read more >react native layoutanimation config easeInout not working (IOS)
... you can check this article that explains how to do it step by step from here ... View from react-native-reanimated like this...
Read more >:react-native-reanimated:compiledebugjavawithjavac - You.com
Task :react-native-community_datetimepicker:compileDebugJavaWithJavac FAILED react native. This worked for me: Add this in android\build.gradle. In file check ...
Read more >react-native-reanimated - Bountysource
Description. After upgrading to react-native version 0.65.0 with reanimated 2.2.0 I got the following error: Execution failed for task ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@haveneersrobin thanks!
I hope this issue will be resolved soon by reanimated team
I have just released the new version 2.6.0 with the fix.