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
{{ message }}
Repository navigation
feat(trpc): migrate to tRPC v11 with improved type inference - #1826
This PR migrates the @analogjs/trpc package to tRPC v11, implementing a robust type inference system based on the successful ngx-trpc approach. The migration ensures full TypeScript support and proper type checking for tRPC clients in Angular applications.
This migration to tRPC v11 represents a significant breaking change that requires careful testing and validation before a stable release. The alpha release provides the perfect opportunity to:
Validate Type System Changes: The enhanced type inference system needs real-world testing to ensure it works correctly across different Angular applications and tRPC router configurations.
Test Migration Path: Users need time to test the migration from tRPC v10 to v11, identify potential issues, and provide feedback on the migration experience.
Dependency Compatibility: tRPC v11 is relatively new and may have compatibility issues with other packages in the Angular ecosystem that we haven't discovered yet.
API Stability: The internal type system changes (ProcedureOptions → ProcedureCallOptions<unknown>) need validation to ensure they don't break existing applications.
Community Feedback: Alpha releases allow the community to test the changes and provide feedback before the breaking changes are locked into a stable release.
Breaking Changes Summary
Dependency Update: Applications must upgrade to tRPC v11 (@trpc/client and @trpc/server v11+)
Type System: Enhanced type inference may expose existing type issues in applications
Internal APIs: Internal type definitions have been updated to match tRPC v11's architecture
Migration Guide
Users should follow the migration guide in packages/trpc/MIGRATION-v11.md which covers:
Updating dependencies
Potential code changes needed
Common migration issues and solutions
Example Usage
// Client setup remains the sameexportconst{ provideTrpcClient, TrpcClient }=createTrpcClient<AppRouter>({url: '/api/trpc',transformer: superjson,});// Type inference now works correctlyconstclient=inject(TrpcClient);constnotes=awaitclient.note.list.query();// ✅ Fully typed
@brandonroberts retargeted to alpha because of major upgrade and so we can be more sure about stability. Updated BREAKING CHANGES section of PR description.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR migrates the
@analogjs/trpcpackage to tRPC v11, implementing a robust type inference system based on the successful ngx-trpc approach. The migration ensures full TypeScript support and proper type checking for tRPC clients in Angular applications.Support tRPC 11 #1676
Changes
🔄 Migration to tRPC v11
🛠️ Type System Improvements
@trpc/server/unstable-core-do-not-importCreateTrpcProxyClienttype to properly infer router proceduresProcedureOptionstoProcedureCallOptions<unknown>per tRPC v11 API changesResolverDefResolverDecorateProcedureDecoratedProcedureRecordinferRouterClient🔧 Implementation Details
createFlatProxyandcreateRecursiveProxyfrom tRPC's unstable core✅ Testing
nx run trpc-app:build:productionBreaking Changes
@analogjs/trpcmust upgrade to tRPC v11.Dependencies Update
Applications must update their tRPC dependencies:
{ "dependencies": { "@trpc/client": "^11.0.0", "@trpc/server": "^11.0.0" } }Why This Belongs in Alpha Release
This migration to tRPC v11 represents a significant breaking change that requires careful testing and validation before a stable release. The alpha release provides the perfect opportunity to:
Validate Type System Changes: The enhanced type inference system needs real-world testing to ensure it works correctly across different Angular applications and tRPC router configurations.
Test Migration Path: Users need time to test the migration from tRPC v10 to v11, identify potential issues, and provide feedback on the migration experience.
Dependency Compatibility: tRPC v11 is relatively new and may have compatibility issues with other packages in the Angular ecosystem that we haven't discovered yet.
API Stability: The internal type system changes (
ProcedureOptions→ProcedureCallOptions<unknown>) need validation to ensure they don't break existing applications.Community Feedback: Alpha releases allow the community to test the changes and provide feedback before the breaking changes are locked into a stable release.
Breaking Changes Summary
@trpc/clientand@trpc/serverv11+)Migration Guide
Users should follow the migration guide in
packages/trpc/MIGRATION-v11.mdwhich covers:Example Usage
References
Checklist