Skip to content

Commit dbb9252

Browse files
SamChou19815facebook-github-bot
authored andcommitted
Annotate Array.map returns when the implicit return type is widened
Summary: Changelog: [Internal] Differential Revision: D40840078 fbshipit-source-id: 0104444060d8d6a1a22066d63579ac06ff715226
1 parent cfe811a commit dbb9252

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

Libraries/LogBox/Data/__tests__/LogBoxLog-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function getLogBoxSymbolication(): {|
5050
}
5151

5252
const createStack = (methodNames: Array<string>) =>
53-
methodNames.map(methodName => ({
53+
methodNames.map((methodName): StackFrame => ({
5454
column: null,
5555
file: 'file://path/to/file.js',
5656
lineNumber: 1,

Libraries/LogBox/Data/__tests__/LogBoxSymbolication-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const symbolicateStackTrace: JestMockFn<
2424
> = (require('../../../Core/Devtools/symbolicateStackTrace'): any);
2525

2626
const createStack = (methodNames: Array<string>) =>
27-
methodNames.map(methodName => ({
27+
methodNames.map((methodName): StackFrame => ({
2828
column: null,
2929
file: 'file://path/to/file.js',
3030
lineNumber: 1,

Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrames-test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* @oncall react_native
1010
*/
1111

12+
import type {StackFrame} from '../../../Core/NativeExceptionsManager';
13+
1214
import LogBoxInspectorStackFrames, {
1315
getCollapseMessage,
1416
} from '../LogBoxInspectorStackFrames';
@@ -33,7 +35,7 @@ const createLogWithFrames = (collapsedOptions: Array<?boolean>) => {
3335
};
3436

3537
const createCollapsedFrames = (collapsedOptions: Array<?boolean>) => {
36-
return collapsedOptions.map(option => ({
38+
return collapsedOptions.map((option): StackFrame => ({
3739
column: 1,
3840
file: 'dependency.js',
3941
lineNumber: 1,

packages/rn-tester/js/utils/testerStateUtils.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ export const getExamplesListWithBookmarksAndRecentlyUsed = ({
6262
return null;
6363
}
6464

65-
const components = RNTesterList.Components.map(componentExample => ({
66-
...componentExample,
67-
isBookmarked: bookmarks.components.includes(componentExample.key),
68-
exampleType: Screens.COMPONENTS,
69-
}));
65+
const components = RNTesterList.Components.map(
66+
(componentExample): RNTesterModuleInfo => ({
67+
...componentExample,
68+
isBookmarked: bookmarks.components.includes(componentExample.key),
69+
exampleType: Screens.COMPONENTS,
70+
}),
71+
);
7072

7173
const recentlyUsedComponents = recentlyUsed.components
7274
.map(recentComponentKey =>
@@ -78,7 +80,7 @@ export const getExamplesListWithBookmarksAndRecentlyUsed = ({
7880
component => component.isBookmarked,
7981
);
8082

81-
const apis = RNTesterList.APIs.map(apiExample => ({
83+
const apis = RNTesterList.APIs.map((apiExample): RNTesterModuleInfo => ({
8284
...apiExample,
8385
isBookmarked: bookmarks.apis.includes(apiExample.key),
8486
exampleType: Screens.APIS,

0 commit comments

Comments
 (0)