Skip to content

Fix: build fail with some type error#3439

Open
bikalsiwakoti wants to merge 1 commit intodubinc:mainfrom
bikalsiwakoti:fix/type-error
Open

Fix: build fail with some type error#3439
bikalsiwakoti wants to merge 1 commit intodubinc:mainfrom
bikalsiwakoti:fix/type-error

Conversation

@bikalsiwakoti
Copy link

@bikalsiwakoti bikalsiwakoti commented Feb 8, 2026

Fixes: #2546

Description:
Fixes some type errors while building file

Make sure it doesn't run out of memory while building.

Summary by CodeRabbit

  • Refactor
    • Updated type assertions in the rich text editor components for improved type compatibility. No changes to user-facing functionality or behavior.

@vercel
Copy link
Contributor

vercel bot commented Feb 8, 2026

@bikalsiwakoti is attempting to deploy a commit to the Dub Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 8, 2026

📝 Walkthrough

Walkthrough

Two rich-text components receive type assertion modifications: rich-text-provider.tsx casts the extensions array as any, while rich-text-toolbar.tsx adds as any assertions to editor chain method calls for formatting actions. No functional behavior changes.

Changes

Cohort / File(s) Summary
Rich Text Type Assertions
packages/ui/src/rich-text-area/rich-text-provider.tsx, packages/ui/src/rich-text-area/rich-text-toolbar.tsx
Added explicit as any type assertions: one on the extensions array in provider initialization, and five on editor chain calls (bold, italic, strike, and heading level toggles) in toolbar event handlers.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • steven-tey

Poem

🐰 With whiskers and code, I hop through the types,
As any we cast, the compiler just skips.
Bold text, italic grace, the editor flows free,
Type assertions make peace, just let it all be!

🚥 Pre-merge checks | ✅ 1 | ❌ 4
❌ Failed checks (4 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions fixing type errors in general, but the actual changes are in rich-text components (provider and toolbar), not the export route where the build issue occurs. Update the title to specify the actual changes, such as 'Fix: type assertions in rich-text-area components' to accurately reflect what was modified.
Linked Issues check ⚠️ Warning The PR addresses issue #2546 which requires fixing a TypeScript error in ./app/(ee)/api/events/export/route.ts, but the changes only modify rich-text-area components, not the export route file. Ensure changes target the actual issue location in ./app/(ee)/api/events/export/route.ts by fixing the 'domain' property type error on the parsed params object.
Out of Scope Changes check ⚠️ Warning The changes to rich-text-area components (provider and toolbar) are out of scope for issue #2546, which requires fixing a type error in the export API route. Focus on resolving the type error in ./app/(ee)/api/events/export/route.ts where 'domain' property is missing from the parsed params type.
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 (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
packages/ui/src/rich-text-area/rich-text-provider.tsx (2)

58-58: Runtime crash if editor is nullish — as any masks the optional-chain guard.

On lines 58, 66, 74, 84, 92 of the toolbar (and relatedly here on line 78), as any casts discard type information. But specifically on line 78, casting FEATURES as any loses the readonly tuple type. A simple spread [...FEATURES] would satisfy the mutable-array constraint without discarding type safety:

Proposed fix
-      features = FEATURES as any,
+      features = [...FEATURES],

212-212: Two instances of as any reduce type safety; the second is unnecessary and the first may be avoidable with better typing.

Line 78: The default value FEATURES as any is unnecessary. Since FEATURES is a readonly array and the parameter expects a mutable one, use [...FEATURES] instead, or declare FEATURES as const and adjust the features parameter type to accept readonly arrays.

Line 212: The cast on the extensions array suppresses all type errors in extension configuration. While TipTap v3 has known TypeScript typing regressions with extended nodes (particularly when extending built-in extensions like Mention), consider whether individual extension casts or stricter typing of the Mention.extend return type (lines 191–209) could provide more precise type safety than a blanket as any.

packages/ui/src/rich-text-area/rich-text-toolbar.tsx (2)

58-58: as any on chain calls loses type safety for all downstream methods and is applied inconsistently.

These five lines cast editor?.chain().focus() to any, but Lines 108, 162, and 166–171 call the same chain pattern without as any. This inconsistency suggests the type error is specifically on toggleBold, toggleItalic, toggleStrike, and toggleHeading — likely because TipTap v3 changed how extension commands are typed on the chain.

A more targeted fix would be to type-assert only the specific missing methods, or to augment the editor's Commands interface. For example:

Narrower cast alternative
-          onClick={() => (editor?.chain().focus() as any).toggleBold().run()}
+          onClick={() => (editor?.chain().focus() as ReturnType<NonNullable<typeof editor>["chain"]> & { toggleBold(): { run(): void } }).toggleBold().run()}

Or, more practically, declare a module augmentation for the missing commands so no as any is needed at all.

That said, if this is purely a transient compatibility issue with @tiptap/* v3.15.3 types, a TODO comment explaining why the cast exists and linking to a tracking issue would help prevent the cast from persisting indefinitely.

Also applies to: 66-66, 74-74, 84-84, 92-92


104-108: Inconsistency: insertContent chain call has no as any cast.

Line 108 uses editor?.chain().focus().insertContent("@").run() without a cast, while the toggle methods above are all cast. If the build passes without a cast here, this confirms the issue is scoped to specific extension commands. Worth noting in a comment for future maintainers.


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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to build

1 participant