mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Pre-suppress unsafe string key access errors in xplat/js (#44221)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44221 This diff pre-suppresses errors of the following pattern, to prepare for the next Flow release. ``` declare const obj: {foo: string}; declare const key: string; obj[key]; // error: invalid-computed-prop ``` Changelog: [Internal] Reviewed By: alexmckenley Differential Revision: D56477899 fbshipit-source-id: 5676b8685bd3157a519fe433cfce0fa28e003502
This commit is contained in:
committed by
Facebook GitHub Bot
parent
4928f44f70
commit
41f525ccae
@@ -55,6 +55,7 @@ function stringify(obj: mixed): string {
|
||||
return Object.keys(value ?? {})
|
||||
.sort()
|
||||
.reduce((sorted: {[key: string]: mixed}, key: string) => {
|
||||
// $FlowFixMe[invalid-computed-prop]
|
||||
sorted[key] = (value ?? {})[key];
|
||||
return sorted;
|
||||
}, {});
|
||||
|
||||
Reference in New Issue
Block a user