feat(server): enhance ts error for .use#277
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.
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
IntersectPickwhich appears to be a new addition that supports the enhanced TS error handling for the.usemethod 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
.usemethod might returnneverif the required conditions are not met;NOW: it throw a TypeScript error to indicate the issue.
Summary by CodeRabbit
Refactor
IntersectPickto facilitate type intersections.Tests
Chores