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
feat: publishing AppRouter without hassle #5004
Comments
#4709 does this - implemented in next major (which you can use today) |
According to the description of the linked PR, context object is still included in the router type(although context is no longer present in procedure types). Is it possible to remove context from .d.ts altogether? |
Off the top of my head, the
The rest could technically be omitted with regards to the client. However, in order to call Feel free to hack on this, know it's quite time consuming though, but you have pretty free reign to challenge how we do things seeing that it's a major change upcoming anyway |
Describe the feature you'd like to request
I am using trpc in bunch of projects that are spread across npm packages. E.g., I have a server
my-server
and a clientmy-client
. Inmy-client
code I am importingAppRouter
like this:I want to be able to publish
AppRouter
types on NPM without exposing any sensitive information like my server source code orContext
of theAppRouter
.Describe the solution you'd like to see
When generating .d.ts files via
tsc
orvite
, .d.ts files contain all imported type definitions. SinceAppRouter
depends onContext
, andContext
usually contains all backend services (e.g.,UsersService
,PaymentService
, etc), all the backend type declarations are also included in .d.ts files.I see at least two solutions:
Context
object withunknown
when generating .d.ts filesappRouter
is defined insrc/router.ts
, only includedist/router.d.ts
in package.jsonfiles
field.I hope trpc provides a recommended way to publish
AppRouter
, so developers do not need to think about it themselves.Describe alternate solutions
Don't provide a recommended way of publishing
AppRouter
and leave it to devs.Additional information
No response
👨👧👦 Contributing
Funding
The text was updated successfully, but these errors were encountered: