Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excessive stack depth comparing types 'FlatArray<Arr, ?>' and 'FlatArray<Arr, ?>'. ts(2321) #43258

Closed
simonsinclair opened this issue Mar 15, 2021 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@simonsinclair
Copy link

simonsinclair commented Mar 15, 2021

Bug Report

🔎 Search Terms

  • Excessive stack depth comparing types
  • FlatArray
  • 2321
  • JSX

🕗 Version & Regression Information

  • This changed between versions 4.2.3 and 4.3.0-dev.20210314.

💻 Code

const Component = (): JSX.Element => {
  const categories = ['Fruit', 'Vegetables'];

  return (
    <ul>
      <li>All</li>
      {categories.map((category) => (
        <li key={category}>{category}</li>
      ))}
    </ul>
  );
};

export default Component;

🙁 Actual behavior

The following TypeScript error:

Excessive stack depth comparing types 'FlatArray<Arr, ?>' and 'FlatArray<Arr, ?>'. ts(2321)

no-ok

🙂 Expected behavior

I expect this code not to produce an error.

To work around:

  • Remove the preceding list item (li) OR
  • Switch VSCode's TS version from 4.3.0-dev.20210314 to the workspace's (4.2.3).

ok

Possible related issue:

@andrewbranch
Copy link
Member

Duplicate of #43249—different trigger, same bug.

@KarelHrkal
Copy link

Found another workaround - just add an extra fragment:

<ul>
  <li>Hello</li>
  <>
    {[1, 2, 3].map((n) => (
      <li key={n}>{n}</li>
    ))}
  </>
</ul>

@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@sinanyaman95
Copy link

Found another workaround - just add an extra fragment:

<ul>
  <li>Hello</li>
  <>
    {[1, 2, 3].map((n) => (
      <li key={n}>{n}</li>
    ))}
  </>
</ul>

Thanks, a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

5 participants