fix(core): avoid TS2367 in isAndroid by matching isiOS.ts's includes(…#8089
fix(core): avoid TS2367 in isAndroid by matching isiOS.ts's includes(…#8089the-one-ayush wants to merge 1 commit into
Conversation
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: 9808d40 The changes in this PR will be included in the next version bump. This PR includes changesets to release 72 packages
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) |
📝 WalkthroughSummary
WalkthroughThe Android platform check now uses an inclusion test to avoid a TypeScript ChangesAndroid detection fix
Estimated code review effort: 1 (Trivial) | ~3 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/core/src/utilities/isAndroid.ts (1)
2-2: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd 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
📒 Files selected for processing (2)
.changeset/orange-apricots-hug.mdpackages/core/src/utilities/isAndroid.ts
|
Closed in favor of #8088 |
Fixes #6560
Fixes
Fixes #6560
Changes and Review
isAndroid()comparednavigator.platformdirectly against the literal'Android'with===. In TypeScript setups wherenavigator.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 withTS2367.['Android'].includes(navigator.platform), matching the existing pattern already used byisiOS.tsin the same file - no behavior change, since.includes()produces the same boolean result but doesn't trigger the literal-overlap check.Checklist
Responsibility