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

fix(server + client): add noImplicitOverride & add explicit overrides in TRPCError / TRPCClientError #5195

Merged
merged 9 commits into from
Dec 22, 2023

Conversation

me-imfhd
Copy link
Contributor

@me-imfhd me-imfhd commented Dec 20, 2023

…for typescript above v4.3

Closes #5194

Please let me know, if i am doing something i should not, or there is any better way to fix this i would do so on being asked, i am just trying to fix this issue, so users can use this on config where noImplicitOverride is set to true in thier codebase

🎯 Changes

added override keyword which is supposed to fix this issue
developer can now add noImplicitOverride compiler option on and it should not throw the error the issue is talking about
What changes are made in this PR? Is it a feature or a bug fix?
it is a feature/bug for typescript versions above 4.3, if user has enabled the noimplicitOverride keyword, he might get to face this error

✅ Checklist

  • I have followed the steps listed in the Contributing guide.
  • If necessary, I have added documentation related to the changes made.
  • I have added or updated the tests related to the changes made.

@me-imfhd me-imfhd requested a review from a team as a code owner December 20, 2023 16:57
Copy link

vercel bot commented Dec 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
trpc-next-app-dir ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 22, 2023 11:06pm
www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 22, 2023 11:06pm

Copy link

vercel bot commented Dec 20, 2023

@me-imfhd is attempting to deploy a commit to the trpc Team on Vercel.

A member of the Team first needs to authorize it.

@kamilogorek
Copy link
Member

Tests are failing due to This member cannot have an 'override' modifier because it is not declared in the base class 'Error'., because for some reason, our tests tsconfig.json differs from the ones we use for client or server.
Packages use either esnext or es2023, yet tests override lib to use es2020`.

@trpc/trpc-core does anyone know the historical reason for this? If we decide to change it to align with the build config, we also need to remove 2 ts-expect-error from packages/tests/server/TRPCError.test.ts on lines 37 and 66.

@me-imfhd
Copy link
Contributor Author

@kamilogorek any solution you propose i should get tests passing?

@KATT KATT changed the title fix: overriding cause field in TRPCClientError and TRPCError classes … fix(server + client): add noImplicitOverride and add explicit overrides in TRPCError / TRPCClientError Dec 22, 2023
@KATT KATT changed the title fix(server + client): add noImplicitOverride and add explicit overrides in TRPCError / TRPCClientError fix(server + client): add noImplicitOverride & add explicit overrides in TRPCError / TRPCClientError Dec 22, 2023
@KATT
Copy link
Member

KATT commented Dec 22, 2023

Tests are failing due to This member cannot have an 'override' modifier because it is not declared in the base class 'Error'., because for some reason, our tests tsconfig.json differs from the ones we use for client or server. Packages use either esnext or es2023, yet tests override lib to use es2020`.

@trpc/trpc-core does anyone know the historical reason for this? If we decide to change it to align with the build config, we also need to remove 2 ts-expect-error from packages/tests/server/TRPCError.test.ts on lines 37 and 66.

cc @kamilogorek I added a @ts-ignore for now and I want to get it merged - if you have an idea how to update the config so it doesn't appear, please submit a PR 🙏 🙏

Copy link

This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: TRPCError class, public readonly cause?: Error; this line should have override keyword according to error
3 participants