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

[Bug]: weird typescript error when mapping SearchSelectItems in SearchSelect component #686

Closed
sudhamjayanthi opened this issue Sep 17, 2023 · 7 comments · Fixed by #792 or #812
Closed

Comments

@sudhamjayanthi
Copy link
Contributor

sudhamjayanthi commented Sep 17, 2023

Tremor Version

@tremor/[email protected]

Link to minimal reproduction

https://codesandbox.io/p/sandbox/still-voice-q9sxfn?file=%2Fpages%2F_app.tsx%3A7%2C1

Steps to reproduce

  • Setup a NextJS + Tailwind project in Typescript
  • (Ofc) Install tremor labs
  • Use SearchSelect component anywhere you like
  • Add a SearchSelectItem component inside it
  • Now, map over a list of strings to generate some more SearchSelectItem components below the previously created SearchSelectItem component
  • And then you'll see a type error like this for the line where you use map
Type error: Type 'Element[]' is missing the following properties from type 'ReactElement<any, string | JSXElementConstructor<any>>': type, props, key

OR

Just checkout the above reproduction link and run npm run build

What is expected?

It works without any errors

What is actually happening?

It throws the error during build process (npm run build)

What browsers are you seeing the problem on?

No response

Any additional comments?

Also, I figured this error only happens when you have the first single SearchSelectItem seperately along AND the rest of the SearchSelectItems through map. Commenting out either one of those fixes the bug — quite weird — but I need to have both of them since currently there is no way to clear the input otherwise.

If this would take time to figure out and fix... I hope that atleast #681, where I extended the enableClear functionality for SearchSelect, could be merged so that I get away by just using the map. Thanks! :)

@severinlandolt
Copy link
Member

Interesting, will take a look at this next week

Copy link

github-actions bot commented Nov 9, 2023

🎉 This issue has been resolved in version 3.11.1-beta.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@severinlandolt
Copy link
Member

severinlandolt commented Nov 9, 2023

Hi @sudhamjayanthi, may you try the latest beta and tell me if the mapping is now working for you?

npm i @tremor/[email protected]

Copy link

🎉 This issue has been resolved in version 3.11.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

github-actions bot commented Dec 2, 2023

🎉 This issue has been resolved in version 3.12.0-beta.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

github-actions bot commented Dec 2, 2023

🎉 This issue has been resolved in version 3.12.0-beta-package-updates.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This issue has been resolved in version 3.12.0-beta-customcolors.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants