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

From Discord: Potential Bug in Match.tags with Undefined Input #4303

Open
effect-bot opened this issue Jan 20, 2025 · 0 comments
Open

From Discord: Potential Bug in Match.tags with Undefined Input #4303

effect-bot opened this issue Jan 20, 2025 · 0 comments

Comments

@effect-bot
Copy link

Summary

The discussion is about a potential bug in the Match.tags feature of the Effect TypeScript library when handling undefined inputs. The user _adrian_g expects the Match.tags function to properly handle an undefined input by falling back to the orElse case and returning null, as it does in the Match.when case. Instead, it throws a TypeError because it tries to read a property of undefined.

Another user, patroza, suggests that Match.tags should adopt the same semantics as Match.when, where non-object inputs are skipped to avoid such errors. patroza also provides an example showing that the code works with defined types other than undefined.

Key takeaways:

  1. There is an inconsistency in how Match.when and Match.tags handle undefined inputs.
  2. The issue causes a runtime error when using Match.tags with an undefined value.
  3. It is suggested that Match.tags be modified to handle these cases similarly to Match.when.
  4. _adrian_g is inquiring about the process for creating a GitHub issue to report the bug. patroza hints at using a command to initiate issue creation.

Discord thread

https://discord.com/channels/795981131316985866/1330857990076628992

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

No branches or pull requests

1 participant