Skip to content

fix(core): avoid TS2367 in isAndroid by matching isiOS.ts's includes(…#8089

Closed
the-one-ayush wants to merge 1 commit into
ueberdosis:mainfrom
the-one-ayush:fix/isandroid-type-error
Closed

fix(core): avoid TS2367 in isAndroid by matching isiOS.ts's includes(…#8089
the-one-ayush wants to merge 1 commit into
ueberdosis:mainfrom
the-one-ayush:fix/isandroid-type-error

Conversation

@the-one-ayush

Copy link
Copy Markdown
Contributor

Fixes #6560

Fixes

Fixes #6560

Changes and Review

isAndroid() compared navigator.platform directly against the literal 'Android' with ===. In TypeScript setups where navigator.platform's type gets narrowed to a literal union (e.g. "MacIntel" | "Win32" | "Linux x86_64"), this direct comparison has no overlap and fails the build with TS2367.

  • Changed the comparison to ['Android'].includes(navigator.platform), matching the existing pattern already used by isiOS.ts in the same file - no behavior change, since .includes() produces the same boolean result but doesn't trigger the literal-overlap check.

Checklist

  • I have added a changeset if necessary.
  • I have added tests if possible.
  • I have made sure to test my changes myself.

Responsibility

  • I have reviewed and understand these changes, and I take responsibility for this PR, even if an AI agent created it.

@the-one-ayush
the-one-ayush requested a review from a team as a code owner July 16, 2026 11:39
@netlify

netlify Bot commented Jul 16, 2026

Copy link
Copy Markdown

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit 9808d40
🔍 Latest deploy log https://app.netlify.com/projects/tiptap-embed/deploys/6a58c2eaf5ab52000703d7db
😎 Deploy Preview https://deploy-preview-8089--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@changeset-bot

changeset-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9808d40

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 72 packages
Name Type
@tiptap/core Patch
@tiptap/extension-audio Patch
@tiptap/extension-blockquote Patch
@tiptap/extension-bold Patch
@tiptap/extension-bubble-menu Patch
@tiptap/extension-code-block-lowlight Patch
@tiptap/extension-code-block Patch
@tiptap/extension-code Patch
@tiptap/extension-collaboration-caret Patch
@tiptap/extension-collaboration Patch
@tiptap/extension-details Patch
@tiptap/extension-document Patch
@tiptap/extension-drag-handle Patch
@tiptap/extension-emoji Patch
@tiptap/extension-file-handler Patch
@tiptap/extension-floating-menu Patch
@tiptap/extension-hard-break Patch
@tiptap/extension-heading Patch
@tiptap/extension-highlight Patch
@tiptap/extension-horizontal-rule Patch
@tiptap/extension-image Patch
@tiptap/extension-invisible-characters Patch
@tiptap/extension-italic Patch
@tiptap/extension-link Patch
@tiptap/extension-list Patch
@tiptap/extension-mathematics Patch
@tiptap/extension-mention Patch
@tiptap/extension-node-range Patch
@tiptap/extension-paragraph Patch
@tiptap/extension-strike Patch
@tiptap/extension-subscript Patch
@tiptap/extension-superscript Patch
@tiptap/extension-table-of-contents Patch
@tiptap/extension-table Patch
@tiptap/extension-text-align Patch
@tiptap/extension-text-style Patch
@tiptap/extension-text Patch
@tiptap/extension-twitch Patch
@tiptap/extension-typography Patch
@tiptap/extension-underline Patch
@tiptap/extension-unique-id Patch
@tiptap/extension-youtube Patch
@tiptap/extensions Patch
@tiptap/html Patch
@tiptap/markdown Patch
@tiptap/react Patch
@tiptap/static-renderer Patch
@tiptap/suggestion Patch
@tiptap/vue-2 Patch
@tiptap/vue-3 Patch
@tiptap/extension-drag-handle-react Patch
@tiptap/extension-drag-handle-vue-2 Patch
@tiptap/extension-drag-handle-vue-3 Patch
@tiptap/extension-bullet-list Patch
@tiptap/extension-ordered-list Patch
@tiptap/extension-list-item Patch
@tiptap/extension-list-keymap Patch
@tiptap/extension-task-item Patch
@tiptap/extension-task-list Patch
@tiptap/extension-table-cell Patch
@tiptap/extension-table-header Patch
@tiptap/extension-table-row Patch
@tiptap/extension-color Patch
@tiptap/extension-font-family Patch
@tiptap/extension-character-count Patch
@tiptap/extension-dropcursor Patch
@tiptap/extension-focus Patch
@tiptap/extension-gapcursor Patch
@tiptap/extension-history Patch
@tiptap/extension-placeholder Patch
@tiptap/pm Patch
@tiptap/starter-kit Patch

Not sure what this means? Click here to learn what changesets are.

[Click here if you're a maintainer who wants to add another changeset to this PR](https://github.com/the-one-ayush/tiptap/new/fix/isandroid-type-error?filename=.changeset/neat-ants-check.md&value=---%0A%22%40tiptap%2Fcore%22%3A%20patch%0A---%0A%0Afix(core)%3A%20avoid%20TS2367%20in%20isAndroid%20by%20matching%20isiOS.ts's%20includes(%E2%80%A6%0A)

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary

  • Updated Android detection to avoid TypeScript TS2367 errors.
  • Added a patch changeset for @tiptap/core.
  • Android detection behavior remains unchanged.

Walkthrough

The Android platform check now uses an inclusion test to avoid a TypeScript TS2367 error. A changeset records a patch release for @tiptap/core.

Changes

Android detection fix

Layer / File(s) Summary
Update Android detection and release metadata
packages/core/src/utilities/isAndroid.ts, .changeset/orange-apricots-hug.md
isAndroid() checks navigator.platform with includes(['Android']) while retaining the user-agent check. A patch changeset documents the fix.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: fixing TS2367 in isAndroid by using the isiOS-style includes pattern.
Description check ✅ Passed The description includes the issue link, the change summary, and the checklist items required by the template.
Linked Issues check ✅ Passed The code change fixes the reported TS2367 platform comparison error in isAndroid and matches issue #6560.
Out of Scope Changes check ✅ Passed The changeset and code edits are both directly related to the reported TypeScript fix, with no unrelated changes visible.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/core/src/utilities/isAndroid.ts (1)

2-2: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add unit coverage for the Android detection paths.

Please cover both navigator.platform === 'Android' and the Android user-agent fallback. This boolean gates Android-specific editor behavior, so the regression fix should include deterministic tests.

As per coding guidelines, “Add or update unit tests for deterministic user-visible behavior.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/utilities/isAndroid.ts` at line 2, Add deterministic unit
tests for the Android detection utility, covering both the exact
navigator.platform value “Android” path and the Android user-agent fallback when
the platform does not match. Ensure each test configures navigator independently
and verifies the returned boolean used by the utility.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/core/src/utilities/isAndroid.ts`:
- Line 2: Add deterministic unit tests for the Android detection utility,
covering both the exact navigator.platform value “Android” path and the Android
user-agent fallback when the platform does not match. Ensure each test
configures navigator independently and verifies the returned boolean used by the
utility.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3b395e73-7358-4093-bbd3-d56a4904fecb

📥 Commits

Reviewing files that changed from the base of the PR and between 9acaa65 and 9808d40.

📒 Files selected for processing (2)
  • .changeset/orange-apricots-hug.md
  • packages/core/src/utilities/isAndroid.ts

@bdbch

bdbch commented Jul 16, 2026

Copy link
Copy Markdown
Member

Closed in favor of #8088

@bdbch bdbch closed this Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type error in isAndroid.ts: navigator.platform comparison causes build failure in TypeScript

2 participants