Skip to content

PublishOptions type issue fix#1988

Merged
SimonWoolf merged 1 commit intomainfrom
type-correction-publishoptions
Mar 24, 2025
Merged

PublishOptions type issue fix#1988
SimonWoolf merged 1 commit intomainfrom
type-correction-publishoptions

Conversation

@mattheworiordan
Copy link
Copy Markdown
Member

@mattheworiordan mattheworiordan commented Mar 23, 2025

When using Ably with TypeScript, I cannot build because I am told that quickAck cannot be undefined based on the definition below, yet quickAck has a ? which I assume means it does allow boolean or undefined as a value. This is an incompatible change introduced in 02de82b and is breaking TypeScript builds.

MO screenshot 2025-03-23 at 20 45 52

Summary by CodeRabbit

  • Chores
    • Enhanced the flexibility of publishing configurations by allowing certain options to be optionally unset. This update enables more adaptable setups without imposing strict value requirements.

When using Ably with TypeScript, I cannot build because I am told that quickAck cannot be undefined based on the definition below, yet quickAck has a `?` which I assume means it does allow  boolean or undefined as a value. This is an incompatible change introduced in 02de82b and is breaking TypeScript builds.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 2025

Walkthrough

The pull request updates the type definition of PublishOptions in the ably.d.ts file. The index signature is modified to allow properties to explicitly have an undefined value, in addition to string, number, and boolean. This change enhances the flexibility of the type by expanding the set of allowable value types.

Changes

File Change Summary
ably.d.ts Updated PublishOptions index signature to allow values of type string, number, boolean, or undefined.

Poem

I'm a nimble bunny, code hops high,
Adding undefined for values, oh my!
Flexibility shines with every line,
In typed fields, our updates now align.
Hoppy coding leaps and bounds—let's fly!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d02000d and 8f94f9c.

📒 Files selected for processing (1)
  • ably.d.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: test-node (20.x)
  • GitHub Check: test-browser (webkit)
  • GitHub Check: test-browser (firefox)
  • GitHub Check: test-node (18.x)
  • GitHub Check: test-node (16.x)
  • GitHub Check: test-browser (chromium)
🔇 Additional comments (1)
ably.d.ts (1)

2290-2290:

Details

✅ Verification successful

Fixing TypeScript compatibility with optional properties.

The change adds undefined to the index signature in the PublishOptions type. This resolves the issue where the TypeScript compiler would incorrectly flag errors for optional properties (like quickAck?) being potentially undefined, despite them being marked with the optional ? modifier.


🏁 Script executed:

#!/bin/bash
# Identify any usages of PublishOptions in the codebase to confirm compatibility

echo "Checking for usages of PublishOptions type..."
rg -A 2 -B 2 "PublishOptions" --type ts

echo "Checking for any functions that use the quickAck parameter..."
rg -A 2 -B 2 "quickAck" --type ts

Length of output: 4250


Approval: TypeScript Optional Property Compatibility Fixed

The updated index signature in ably.d.ts now explicitly includes undefined (i.e. [k: string]: string | number | boolean | undefined;), which resolves the TypeScript errors flagged for optional properties such as quickAck. Verification shows that references to PublishOptions and declarations of quickAck across the codebase now correctly handle the optional nature of these properties.

  • Verified usage of the PublishOptions type in ably.d.ts and in src/platform/react-hooks/src/fakes/ably.ts
  • Confirmed that quickAck? is declared and referenced appropriately as an optional property
✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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.

@mattheworiordan
Copy link
Copy Markdown
Member Author

Thanks for approving @SimonWoolf. I need a new release of ably-js with this fix before I can release my work as it's an NPM package, which cannot reference this branch I am afraid. Hoping we can get a release and bump shortly so I can push out my NPM package. 🤞

Copy link
Copy Markdown
Collaborator

@ttypic ttypic left a comment

Choose a reason for hiding this comment

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

LGTM, @VeskeR could you cut a release today?

@VeskeR
Copy link
Copy Markdown
Contributor

VeskeR commented Mar 24, 2025

could you cut a release today?

Sure.

@mattheworiordan are you ok with me merging this PR?

@SimonWoolf SimonWoolf merged commit 9831588 into main Mar 24, 2025
11 of 14 checks passed
@SimonWoolf SimonWoolf deleted the type-correction-publishoptions branch March 24, 2025 09:37
@coderabbitai coderabbitai bot mentioned this pull request Mar 24, 2025
@VeskeR
Copy link
Copy Markdown
Contributor

VeskeR commented Mar 24, 2025

@mattheworiordan fix is published in 2.6.5 ably-js release. Can now install the latest version from npm.

mattheworiordan added a commit to ably/ably-cli that referenced this pull request Mar 25, 2025
VeskeR added a commit that referenced this pull request Apr 16, 2025
VeskeR added a commit that referenced this pull request Apr 16, 2025
This commit merges changes from the next PRs:
- #2001
- #2002
- #2000
- #1953
- #1989
- #1988
- #1984
- #1949
- #1980
- #1979
- #1978
- #1976
- #1962
- #1959
- #1955
- #1957
- #1940
- #1925
- #1947
- #1946
- #1945
- #1944

into the integration/liveobjects branch. No significant changes made
during merge conflict resolution.
VeskeR added a commit that referenced this pull request Apr 16, 2025
This commit merges changes from the next PRs:
- #2001
- #2002
- #2000
- #1953
- #1989
- #1988
- #1984
- #1949
- #1980
- #1979
- #1978
- #1976
- #1962
- #1959
- #1955
- #1957
- #1940
- #1925
- #1947
- #1946
- #1945
- #1944

into the integration/liveobjects branch. No significant changes made
during merge conflict resolution.
VeskeR added a commit that referenced this pull request Apr 16, 2025
This commit merges changes from the next PRs:
- #2001
- #2002
- #2000
- #1953
- #1989
- #1988
- #1984
- #1949
- #1980
- #1979
- #1978
- #1976
- #1962
- #1959
- #1955
- #1957
- #1940
- #1925
- #1947
- #1946
- #1945
- #1944

into the integration/liveobjects branch. No significant changes made
during merge conflict resolution.
mattheworiordan added a commit to ably/ably-cli that referenced this pull request Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants