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

Avoid instanceof and remove the "node" export condition #713

Closed
timostamm opened this issue Feb 12, 2024 · 0 comments · Fixed by #744
Closed

Avoid instanceof and remove the "node" export condition #713

timostamm opened this issue Feb 12, 2024 · 0 comments · Fixed by #744

Comments

@timostamm
Copy link
Member

In connectrpc/connect-es#974, we override ConnectError's implementation of instanceof to avoid the dual package hazard, which allows us to remove the "node" export condition, which causes problems with some bundlers.

We need to take a similar approach here: Avoid the dual package hazard with instanceof, and remove the "node" export condition.

There are many more uses of instanceof here that in Connect-ES, and we will need to take a more cautious approach, and also make sure that we do not regress on performance.

smaye81 added a commit that referenced this issue Mar 11, 2024
This adds a type guard function for `PluginOptionError` so that
`instanceof` is no longer used. For additional details, see #713
smaye81 added a commit that referenced this issue Mar 13, 2024
Fixes #713

In #728, #729, and #742, we made changes that remove a common failure
point for the dual package hazard -- usage of `instanceof` with custom
types . As a result, the `node` exports condition for our packages
should not be necessary and is actually problematic for some bundlers.
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

Successfully merging a pull request may close this issue.

1 participant