mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Make DropManualMemoization error message more accurate
This was probably a leftover from a previous time, but since this error message throws when the dependency list is not an array literal, and not just when its a rest spread, this PR updates the message to match. ghstack-source-id: 28f2338212e56a67d3d477cea5abb6e9f3826488 Pull Request resolved: https://github.com/facebook/react-forget/pull/2902
This commit is contained in:
@@ -301,7 +301,7 @@ function extractManualMemoizationArgs(
|
||||
);
|
||||
if (maybeDepsList == null) {
|
||||
CompilerError.throwInvalidReact({
|
||||
reason: `Expected the dependency list to be an array literal without rest spreads`,
|
||||
reason: `Expected the dependency list for ${kind} to be an array literal`,
|
||||
suggestions: null,
|
||||
loc: depsListPlace.loc,
|
||||
});
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ export const FIXTURE_ENTRYPOINT = {
|
||||
8 | return text.toUpperCase();
|
||||
9 | },
|
||||
> 10 | hasDeps ? null : [text] // should be DCE'd
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: Expected the dependency list to be an array literal without rest spreads (10:10)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: Expected the dependency list for useMemo to be an array literal (10:10)
|
||||
11 | );
|
||||
12 | return resolvedText;
|
||||
13 | }
|
||||
|
||||
Reference in New Issue
Block a user