-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Open
Labels
Description
Description
While working on the react-native-strict-api
support in Reanimated I noticed that the type of the transforms array element changed. Before it could be an object with a single transform property and value. In new types it can be also undefined
which doesn't seem to be valid because the transforms array should not contain undefined
values.
Steps to reproduce
- Enable react-native-strict-api in
tsconfig.json
- Copy the following code to the app:
const transforms: ViewStyle['transform'] = [];
transforms.forEach(transform => {
console.log(Object.keys(transform));
});
- Observe that TS is complaining about the
Object.keys(transform)
call and says thattransform
can beundefined
React Native Version
0.81.4
Affected Platforms
Build - Linux, Build - Windows, Build - MacOS, Runtime - Desktop, Runtime - Web, Runtime - iOS, Runtime - Android
Output of npx @react-native-community/cli info
System:
OS: macOS 15.6
CPU: (11) arm64 Apple M3 Pro
Memory: 152.89 MB / 18.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 22.14.0
path: ~/.nvm/versions/node/v22.14.0/bin/node
Yarn:
version: 1.22.22
path: ~/.nvm/versions/node/v22.14.0/bin/yarn
npm:
version: 10.9.2
path: ~/.nvm/versions/node/v22.14.0/bin/npm
Watchman:
version: 2025.06.30.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.14.3
path: /Users/mateu/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 25.0
- iOS 26.0
- macOS 26.0
- tvOS 26.0
- visionOS 26.0
- watchOS 26.0
Android SDK:
API Levels:
- "30"
- "33"
- "34"
- "35"
- "36"
Build Tools:
- 30.0.3
- 33.0.1
- 34.0.0
- 35.0.0
- 36.0.0
System Images:
- android-34 | Android TV ARM 64 v8a
- android-35 | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2025.1 AI-251.26094.121.2513.14007798
Xcode:
version: 26.0/17A324
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.15
path: /opt/homebrew/opt/openjdk@17/bin/javac
Ruby:
version: 3.2.2
path: /Users/mateu/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli":
installed: 20.0.0
wanted: 20.0.0
react:
installed: 19.1.0
wanted: 19.1.0
react-native:
installed: 0.81.4
wanted: 0.81.4
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: false
Stacktrace or Logs
No overload matches this call.
Overload 1 of 2, '(o: {}): string[]', gave the following error.
Argument of type 'Readonly<MaximumOneOf<MergeUnion<{ readonly perspective: number | AnimatedNode; } | { readonly rotate: string | AnimatedNode; } | { readonly rotateX: string | AnimatedNode; } | ... 10 more ... | { ...; }>>>' is not assignable to parameter of type '{}'.
Type 'undefined' is not assignable to type '{}'.
Overload 2 of 2, '(o: object): string[]', gave the following error.
Argument of type 'Readonly<MaximumOneOf<MergeUnion<{ readonly perspective: number | AnimatedNode; } | { readonly rotate: string | AnimatedNode; } | { readonly rotateX: string | AnimatedNode; } | ... 10 more ... | { ...; }>>>' is not assignable to parameter of type 'object'.
Type 'undefined' is not assignable to type 'object'.
MANDATORY Reproducer
https://github.com/MatiPl01/react-native-strict-api-reproducer/tree/undefined-transforms
Screenshots and Videos
