Skip to content

Commit

Permalink
Annotate Array.map returns when the implicit return type is widened
Browse files Browse the repository at this point in the history
Summary: Changelog: [Internal]

Differential Revision: D40840078

fbshipit-source-id: 0104444060d8d6a1a22066d63579ac06ff715226
  • Loading branch information
SamChou19815 authored and facebook-github-bot committed Nov 1, 2022
1 parent cfe811a commit dbb9252
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Libraries/LogBox/Data/__tests__/LogBoxLog-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function getLogBoxSymbolication(): {|
}

const createStack = (methodNames: Array<string>) =>
methodNames.map(methodName => ({
methodNames.map((methodName): StackFrame => ({
column: null,
file: 'file://path/to/file.js',
lineNumber: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const symbolicateStackTrace: JestMockFn<
> = (require('../../../Core/Devtools/symbolicateStackTrace'): any);

const createStack = (methodNames: Array<string>) =>
methodNames.map(methodName => ({
methodNames.map((methodName): StackFrame => ({
column: null,
file: 'file://path/to/file.js',
lineNumber: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* @oncall react_native
*/

import type {StackFrame} from '../../../Core/NativeExceptionsManager';

import LogBoxInspectorStackFrames, {
getCollapseMessage,
} from '../LogBoxInspectorStackFrames';
Expand All @@ -33,7 +35,7 @@ const createLogWithFrames = (collapsedOptions: Array<?boolean>) => {
};

const createCollapsedFrames = (collapsedOptions: Array<?boolean>) => {
return collapsedOptions.map(option => ({
return collapsedOptions.map((option): StackFrame => ({
column: 1,
file: 'dependency.js',
lineNumber: 1,
Expand Down
14 changes: 8 additions & 6 deletions packages/rn-tester/js/utils/testerStateUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ export const getExamplesListWithBookmarksAndRecentlyUsed = ({
return null;
}

const components = RNTesterList.Components.map(componentExample => ({
...componentExample,
isBookmarked: bookmarks.components.includes(componentExample.key),
exampleType: Screens.COMPONENTS,
}));
const components = RNTesterList.Components.map(
(componentExample): RNTesterModuleInfo => ({
...componentExample,
isBookmarked: bookmarks.components.includes(componentExample.key),
exampleType: Screens.COMPONENTS,
}),
);

const recentlyUsedComponents = recentlyUsed.components
.map(recentComponentKey =>
Expand All @@ -78,7 +80,7 @@ export const getExamplesListWithBookmarksAndRecentlyUsed = ({
component => component.isBookmarked,
);

const apis = RNTesterList.APIs.map(apiExample => ({
const apis = RNTesterList.APIs.map((apiExample): RNTesterModuleInfo => ({
...apiExample,
isBookmarked: bookmarks.apis.includes(apiExample.key),
exampleType: Screens.APIS,
Expand Down

0 comments on commit dbb9252

Please sign in to comment.