-
-
Notifications
You must be signed in to change notification settings - Fork 65
feat(server): enhance ts error for .use
#277
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
More templates
@orpc/arktype
@orpc/client
@orpc/openapi
@orpc/openapi-client
@orpc/contract
@orpc/react-query
@orpc/server
@orpc/shared
@orpc/solid-query
@orpc/standard-server
@orpc/standard-server-fetch
@orpc/standard-server-node
@orpc/svelte-query
@orpc/valibot
@orpc/vue-colada
@orpc/vue-query
@orpc/zod
commit: |
Caution Review failedThe pull request is closed. WalkthroughThis pull request makes extensive changes to the TypeScript type assertions and method signatures across several server and shared packages. It replaces runtime type equality checks (using Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant B as Builder
participant MW as Middleware
Dev->>B: Call use(middleware)
alt Valid Middleware
B->>MW: Process middleware with (UInContext | TCurrentContext)
B-->>Dev: Return updated Builder instance
else Invalid Middleware
B-->>Dev: Compiler error (@ts-expect-error expected)
end
sequenceDiagram
participant Dev as Developer
participant I as Implementer/Procedure
participant MW as Middleware
Dev->>I: Invoke use(middleware)
I->>I: Validate context (using IntersectPick & union types)
I->>MW: Process middleware accordingly
I-->>Dev: Return updated implementation instance
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/shared/src/types.test-d.ts (1)
29-29
: Consider using a type alias instead of an empty interface.An empty interface is equivalent to
{}
. Using a type alias would be more idiomatic and clearer.-interface Empty {} +type Empty = {};🧰 Tools
🪛 Biome (1.9.4)
[error] 28-29: An empty interface is equivalent to {}.
Safe fix: Use a type alias instead.
(lint/suspicious/noEmptyInterface)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/shared/src/types.test-d.ts
(1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
packages/shared/src/types.test-d.ts
[error] 28-29: An empty interface is equivalent to {}.
Safe fix: Use a type alias instead.
(lint/suspicious/noEmptyInterface)
🔇 Additional comments (1)
packages/shared/src/types.test-d.ts (1)
1-36
: Well-structured tests for utility types.The tests are comprehensive and validate the behavior of the utility types effectively. This is especially important for
IntersectPick
which appears to be a new addition that supports the enhanced TS error handling for the.use
method as mentioned in the PR objectives.🧰 Tools
🪛 Biome (1.9.4)
[error] 28-29: An empty interface is equivalent to {}.
Safe fix: Use a type alias instead.
(lint/suspicious/noEmptyInterface)
BEFORE: The
.use
method might returnnever
if the required conditions are not met;NOW: it throw a TypeScript error to indicate the issue.
Summary by CodeRabbit
Refactor
IntersectPick
to facilitate type intersections.Tests
Chores