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 conversation, danielo515 reports an issue encountered when attempting to override the toString method of schema classes in the Effect TypeScript library. The error occurs only in the browser and is described as a TypeError, indicating that toString is a read-only property that cannot be reassigned.
gcanti suggests that the issue might be because the toString property on schema classes is not writable, as seen in the library's source code. They provide a link to the relevant code snippet on GitHub, which shows that toString is indeed set with writable: false.
danielo515 questions why this issue is only present in the browser environment and seeks a way to make the toString property configurable, so it can be overridden conveniently.
gcanti implies that setting writable: true in the property definition might solve the issue.
Key Takeaways:
Overriding built-in methods like toString can lead to errors if the property is not writable.
This issue might appear differently across environments (Node.js vs. Browser).
Making properties writable can provide flexibility but should be done with caution to avoid unintended side effects.
Reviewing the library's source code can provide insights into why certain behaviors occur.
Summary
In the conversation, danielo515 reports an issue encountered when attempting to override the
toString
method of schema classes in the Effect TypeScript library. The error occurs only in the browser and is described as aTypeError
, indicating thattoString
is a read-only property that cannot be reassigned.gcanti suggests that the issue might be because the
toString
property on schema classes is not writable, as seen in the library's source code. They provide a link to the relevant code snippet on GitHub, which shows thattoString
is indeed set withwritable: false
.danielo515 questions why this issue is only present in the browser environment and seeks a way to make the
toString
property configurable, so it can be overridden conveniently.gcanti implies that setting
writable: true
in the property definition might solve the issue.Key Takeaways:
toString
can lead to errors if the property is not writable.Discord thread
https://discord.com/channels/795981131316985866/1348711386527826061
The text was updated successfully, but these errors were encountered: