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:
Lauren Tan
2024-04-25 10:19:29 -04:00
parent 08b777d6dc
commit 89f2f7fcef
2 changed files with 2 additions and 2 deletions
@@ -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,
});
@@ -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 | }