You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the above conversation, there was a discussion about an issue with erasing B from the context and a runtime error. The code provided in the example compiled successfully, even though A was missing one of B's properties. It was pointed out that this behavior is due to the way TypeScript's Exclude works, which respects type assignability.
There was a debate about whether this behavior is a bug or a design choice. Some participants argued that it is a bug because it can lead to unexpected runtime errors. Others argued that it is a design choice based on type assignability rules.
The conversation also touched on different approaches to uniquely identifying services, such as using unique symbols or separate identifiers and shapes. It was suggested that the documentation should highlight the potential pitfalls and provide guidance on how to work around them.
Key takeaways from the conversation:
Erasing one service with another in the context can lead to unexpected runtime errors.
TypeScript's type assignability rules can allow assigning a subtype to a supertype, which may not be desirable in certain cases.
Unique symbols or separate identifiers and shapes can help ensure uniqueness and prevent issues with service assignment.
The documentation should clearly explain the potential pitfalls and provide guidance on how to use the API correctly.
Summary
In the above conversation, there was a discussion about an issue with erasing
B
from the context and a runtime error. The code provided in the example compiled successfully, even thoughA
was missing one ofB
's properties. It was pointed out that this behavior is due to the way TypeScript'sExclude
works, which respects type assignability.There was a debate about whether this behavior is a bug or a design choice. Some participants argued that it is a bug because it can lead to unexpected runtime errors. Others argued that it is a design choice based on type assignability rules.
The conversation also touched on different approaches to uniquely identifying services, such as using unique symbols or separate identifiers and shapes. It was suggested that the documentation should highlight the potential pitfalls and provide guidance on how to work around them.
Key takeaways from the conversation:
Discord thread
https://discord.com/channels/795981131316985866/1187898774387957780
The text was updated successfully, but these errors were encountered: