Add support for UnsafeObject to allow using Flow strict in native modules

Summary:
This new type will be valid in Flow strict mode and can be used by native modules and components to replace `Object`, with the same semantics.

This unblocks the migration of the most modules in the React Native package to Flow strict.

Changelog: [Internal] Add UnsafeObject type compatible with Flow strict mode to use in native modules and components

Reviewed By: RSNara

Differential Revision: D25540631

fbshipit-source-id: 60b80bbc84a53aecc747e3a1799cdf551e1859cd
This commit is contained in:
Rubén Norte
2021-01-04 03:56:57 -08:00
committed by Facebook GitHub Bot
parent 89beefaefb
commit e088a4fe9c
14 changed files with 125 additions and 1 deletions
@@ -109,6 +109,16 @@ public class SampleTurboModule extends NativeSampleTurboModuleSpec {
return map;
}
@DoNotStrip
@Override
@SuppressWarnings("unused")
public WritableMap getUnsafeObject(ReadableMap arg) {
WritableNativeMap map = new WritableNativeMap();
map.merge(arg);
log("getUnsafeObject", arg, map);
return map;
}
@DoNotStrip
@SuppressWarnings("unused")
@Override