Skip to content

fix: Make signal in EventPublisherSubscribeIteratorOptions AbortSignal | undefined#928

Merged
dinwwwh merged 1 commit intomiddleapi:mainfrom
boredland:patch-1
Aug 25, 2025
Merged

fix: Make signal in EventPublisherSubscribeIteratorOptions AbortSignal | undefined#928
dinwwwh merged 1 commit intomiddleapi:mainfrom
boredland:patch-1

Conversation

@boredland
Copy link
Copy Markdown
Contributor

@boredland boredland commented Aug 25, 2025

If it isn't, while using the signal prop from the handler function, my typescript complains with exactOptionalPropertyTypes enabled:

Argument of type '{ signal: AbortSignal | undefined; }' is not assignable to parameter of type 'EventPublisherSubscribeIteratorOptions' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
      Types of property 'signal' are incompatible.
        Type 'AbortSignal | undefined' is not assignable to type 'AbortSignal'.
          Type 'undefined' is not assignable to type 'AbortSignal'.

Ref.: https://orpc.unnoq.com/docs/event-iterator#event-publisher

Summary by CodeRabbit

  • Chores
    • Adjusted public API option to be more permissive with cancellation signals, aligning types with existing behavior.
    • No changes to runtime behavior or user-facing functionality.

…undefined`

If it isn't, while using the `signal` prop from the handler function, my typescript complains:

```
Argument of type '{ signal: AbortSignal | undefined; }' is not assignable to parameter of type 'EventPublisherSubscribeIteratorOptions' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
      Types of property 'signal' are incompatible.
        Type 'AbortSignal | undefined' is not assignable to type 'AbortSignal'.
          Type 'undefined' is not assignable to type 'AbortSignal'.
```

Ref.: https://orpc.unnoq.com/docs/event-iterator#event-publisher
@vercel
Copy link
Copy Markdown

vercel bot commented Aug 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
orpc Ready Ready Preview Comment Aug 25, 2025 8:33am

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Aug 25, 2025

Walkthrough

Type-level update in EventPublisherSubscribeIteratorOptions: the signal property’s type changed from optional AbortSignal to optional AbortSignal | undefined. No runtime logic or control flow changes.

Changes

Cohort / File(s) Summary
Public API type tweak
packages/shared/src/event-publisher.ts
Updated interface EventPublisherSubscribeIteratorOptions: signal?: AbortSignalsignal?: AbortSignal | undefined; no runtime impact noted.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

I twitch my whiskers, tap-tap, delight—
A tiny type hops into sight.
AbortSignal? Undefined? All fine!
The fields align, the tests will shine.
I thump approval—small change, light bite.

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @boredland, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a TypeScript type incompatibility by explicitly allowing undefined for the signal property within the EventPublisherSubscribeIteratorOptions interface. This change addresses an error encountered when exactOptionalPropertyTypes is enabled, ensuring correct type inference and preventing compilation issues.

Highlights

  • Type Definition Correction: Updated the signal property in EventPublisherSubscribeIteratorOptions to AbortSignal | undefined to resolve a TypeScript error related to exactOptionalPropertyTypes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 25, 2025
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly addresses a TypeScript typing issue that arises when the exactOptionalPropertyTypes compiler option is enabled. By changing the type of the signal property in the EventPublisherSubscribeIteratorOptions interface to AbortSignal | undefined, you've resolved the type incompatibility error described in the pull request. The change is minimal, targeted, and correct. I have no further feedback.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/shared/src/event-publisher.ts (2)

21-24: Document the exactOptionalPropertyTypes nuance in JSDoc

Minor doc tweak so consumers understand why undefined is allowed explicitly.

 export interface EventPublisherSubscribeIteratorOptions extends EventPublisherOptions {
   /**
-   * Aborts the async iterator. Throws if aborted before or during pulling.
+   * Aborts the async iterator. Throws if aborted before or during pulling.
+   *
+   * Accepts `AbortSignal | undefined` to interoperate with TypeScript's
+   * `exactOptionalPropertyTypes` (allows passing `{ signal: undefined }` explicitly).
    */
   signal?: AbortSignal | undefined
 }

20-25: Unify signal?: AbortSignal declarations across the repo

I ran a repository-wide search and found multiple occurrences of optional signal properties with slightly different typings:

  • packages/shared/src/event-publisher.ts (line 24): signal?: AbortSignal | undefined
  • packages/shared/src/otel.ts (line 53): signal?: AbortSignal
  • packages/client/src/types.ts (line 9): signal?: AbortSignal
  • packages/server/src/middleware.ts (line 35): signal?: AbortSignal
  • packages/server/src/procedure.ts (line 18): signal?: AbortSignal
  • packages/server/src/procedure-client.ts (line 39): signal?: AbortSignal

(Additional matches exist in tests, .d.ts stubs, and documentation, which you can ignore for the type consistency refactor.)

To ensure consistent behavior under the exactOptionalPropertyTypes compiler flag, I recommend standardizing all of these to the same form. We have two main options:

  • Omit the explicit | undefined everywhere (i.e. use signal?: AbortSignal) since TypeScript already includes undefined in optional properties.
  • Add | undefined everywhere for explicitness, if that better fits your style guide.

Most code here already uses the first style, so the simplest change is to remove the | undefined union in event-publisher.ts. If you’d prefer the explicit form, we can add | undefined to the other four shared/client/server declarations instead.

Let me know which approach you prefer—or I can prepare a small codemod to apply the change across all of them in this PR or a follow-up.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b953b88 and 1b97aa0.

📒 Files selected for processing (1)
  • packages/shared/src/event-publisher.ts (1 hunks)
🔇 Additional comments (1)
packages/shared/src/event-publisher.ts (1)

24-24: LGTM: type widening to support exactOptionalPropertyTypes

Changing signal?: AbortSignal to signal?: AbortSignal | undefined is the correct, backward-compatible fix for exactOptionalPropertyTypes. No runtime impact; aligns with how the option treats explicit undefined.

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Aug 25, 2025

More templates

@orpc/arktype

npm i https://pkg.pr.new/@orpc/arktype@928

@orpc/client

npm i https://pkg.pr.new/@orpc/client@928

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@928

@orpc/experimental-durable-event-iterator

npm i https://pkg.pr.new/@orpc/experimental-durable-event-iterator@928

@orpc/hey-api

npm i https://pkg.pr.new/@orpc/hey-api@928

@orpc/interop

npm i https://pkg.pr.new/@orpc/interop@928

@orpc/json-schema

npm i https://pkg.pr.new/@orpc/json-schema@928

@orpc/nest

npm i https://pkg.pr.new/@orpc/nest@928

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@928

@orpc/openapi-client

npm i https://pkg.pr.new/@orpc/openapi-client@928

@orpc/otel

npm i https://pkg.pr.new/@orpc/otel@928

@orpc/react

npm i https://pkg.pr.new/@orpc/react@928

@orpc/react-query

npm i https://pkg.pr.new/@orpc/react-query@928

@orpc/experimental-react-swr

npm i https://pkg.pr.new/@orpc/experimental-react-swr@928

@orpc/server

npm i https://pkg.pr.new/@orpc/server@928

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@928

@orpc/solid-query

npm i https://pkg.pr.new/@orpc/solid-query@928

@orpc/standard-server

npm i https://pkg.pr.new/@orpc/standard-server@928

@orpc/standard-server-aws-lambda

npm i https://pkg.pr.new/@orpc/standard-server-aws-lambda@928

@orpc/standard-server-fetch

npm i https://pkg.pr.new/@orpc/standard-server-fetch@928

@orpc/standard-server-node

npm i https://pkg.pr.new/@orpc/standard-server-node@928

@orpc/standard-server-peer

npm i https://pkg.pr.new/@orpc/standard-server-peer@928

@orpc/svelte-query

npm i https://pkg.pr.new/@orpc/svelte-query@928

@orpc/tanstack-query

npm i https://pkg.pr.new/@orpc/tanstack-query@928

@orpc/trpc

npm i https://pkg.pr.new/@orpc/trpc@928

@orpc/valibot

npm i https://pkg.pr.new/@orpc/valibot@928

@orpc/vue-colada

npm i https://pkg.pr.new/@orpc/vue-colada@928

@orpc/vue-query

npm i https://pkg.pr.new/@orpc/vue-query@928

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@928

commit: 1b97aa0

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 25, 2025
@dinwwwh dinwwwh merged commit a764ee3 into middleapi:main Aug 25, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants