Skip to content

[WIKI-578] refactor: editor types structure#7536

Merged
pushya22 merged 2 commits intopreviewfrom
refactor/editor-types
Aug 4, 2025
Merged

[WIKI-578] refactor: editor types structure#7536
pushya22 merged 2 commits intopreviewfrom
refactor/editor-types

Conversation

@aaryan610
Copy link
Member

@aaryan610 aaryan610 commented Aug 4, 2025

Description

This PR refactors the editor type structure by-

  1. Replacing all occurrences of interface with type.
  2. Replacing any with unknown wherever possible.

Type of Change

  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring

Summary by CodeRabbit

  • New Features

    • Improved device compatibility by allowing the editor to detect touch devices.
  • Refactor

    • Updated various type and interface declarations for improved type safety and consistency.
    • Replaced several interface-based type definitions with type aliases.
    • Enhanced type imports and centralized some type definitions for maintainability.
  • Style

    • Improved type annotations for better code clarity and reliability.

@makeplane
Copy link

makeplane bot commented Aug 4, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the editor type structure by standardizing TypeScript type definitions and improving type safety. The changes focus on converting interface declarations to type aliases and replacing any types with unknown for better type safety.

  • Replace all interface declarations with type aliases for consistency
  • Replace any type annotations with unknown for improved type safety
  • Consolidate duplicate type definitions by moving them to a centralized location

Reviewed Changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/editor/src/core/types/editor.ts Convert editor interfaces to types and consolidate IMarking import
packages/editor/src/core/helpers/scroll-to-node.ts Remove duplicate IMarking definition and import from centralized types
packages/editor/src/core/helpers/common.ts Convert EditorClassNames interface to type
packages/editor/src/core/extensions/work-item-embed/extension.tsx Replace any with proper NodeViewProps type
packages/editor/src/core/extensions/utility.ts Convert UtilityExtensionStorage interface to type
packages/editor/src/core/extensions/typography/inputRules.ts Convert TypographyOptions interface to type
packages/editor/src/core/extensions/table/table/utilities/helpers.ts Add constant usage for paragraph type
packages/editor/src/core/extensions/table/table/utilities/delete-key-shortcut.ts Convert interfaces to types and add proper imports
packages/editor/src/core/extensions/table/table/utilities/create-cell.ts Replace any with unknown in attrs parameter
packages/editor/src/core/extensions/table/table/table.ts Convert TableOptions interface to type and replace any with unknown
packages/editor/src/core/extensions/table/table-row.ts Convert TableRowOptions interface to type and replace any with unknown
packages/editor/src/core/extensions/table/table-header.ts Convert TableHeaderOptions interface to type and replace any with unknown
packages/editor/src/core/extensions/table/table-cell.ts Convert TableCellOptions interface to type and replace any with unknown
packages/editor/src/core/extensions/horizontal-rule.ts Convert HorizontalRuleOptions interface to type and replace any with unknown
packages/editor/src/core/extensions/headings-list.ts Remove duplicate IMarking definition and import from types
packages/editor/src/core/extensions/emoji/emoji.ts Replace any with unknown in EmojiItem and EmojiOptions
packages/editor/src/core/extensions/emoji/components/emojis-list.tsx Convert interfaces to types and reorganize type definitions
packages/editor/src/core/extensions/custom-link/extension.tsx Convert interfaces to types and replace any with unknown
packages/editor/src/core/extensions/code/code-block.ts Convert CodeBlockOptions interface to type and replace any with unknown
packages/editor/src/core/extensions/code/code-block-node-view.tsx Convert interface to type and rename for clarity
packages/editor/src/core/extensions/code/code-block-lowlight.ts Convert interface to type using intersection
packages/editor/src/core/extensions/code-inline/index.tsx Convert CodeOptions interface to type and rename for clarity
packages/editor/src/core/components/menus/bubble-menu/root.tsx Convert EditorStateType interface to type
packages/editor/src/core/components/menus/block-menu.tsx Convert interface to type and add proper imports
packages/editor/src/core/components/links/link-view.tsx Convert LinkViewProps interface to type
packages/editor/src/core/components/links/link-edit-view.tsx Convert interfaces to types
packages/editor/src/core/components/editors/link-view-container.tsx Convert interface to type
packages/editor/src/core/components/editors/editor-content.tsx Convert interface to type and add proper imports
packages/editor/src/core/components/editors/editor-container.tsx Convert interface to type
Comments suppressed due to low confidence (2)

packages/editor/src/core/extensions/code-inline/index.tsx:5

  • [nitpick] The type name 'InlineCodeOptions' is inconsistent with the original 'CodeOptions'. Consider keeping the original name or ensuring this naming change is intentional and consistent throughout the codebase.
type InlineCodeOptions = {

packages/editor/src/core/extensions/code/code-block-node-view.tsx:18

  • [nitpick] The generic type name 'Props' is less descriptive than the original 'CodeBlockComponentProps'. Consider using a more specific name like 'CodeBlockComponentProps' to maintain clarity.
type Props = {

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 4, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This update refactors numerous TypeScript interface declarations to type aliases across editor components and extensions, standardizes the use of unknown instead of any for HTML attributes, and improves type import clarity. It also introduces a new isTouchDevice prop to the DocumentEditor component, passing it to PageRenderer.

Changes

Cohort / File(s) Change Summary
DocumentEditor isTouchDevice Prop
packages/editor/src/core/components/editors/document/editor.tsx
Adds isTouchDevice prop to DocumentEditor and passes it to PageRenderer.
Type Alias Refactors (Components)
packages/editor/src/core/components/editors/editor-content.tsx, .../editors/link-view-container.tsx, .../links/link-edit-view.tsx, .../links/link-view.tsx, .../menus/block-menu.tsx, .../menus/bubble-menu/root.tsx, .../helpers/common.ts
Refactors various component prop and state interfaces to type aliases; updates component signatures accordingly.
Type Alias Refactors (Extensions)
.../extensions/code-inline/index.tsx, .../extensions/code/code-block-lowlight.ts, .../extensions/code/code-block-node-view.tsx, .../extensions/code/code-block.ts, .../extensions/custom-link/extension.tsx, .../extensions/emoji/components/emojis-list.tsx, .../extensions/emoji/emoji.ts, .../extensions/headings-list.ts, .../extensions/horizontal-rule.ts, .../extensions/table/table-cell.ts, .../extensions/table/table-header.ts, .../extensions/table/table-row.ts, .../extensions/table/table/table.ts, .../extensions/table/table/utilities/create-cell.ts, .../extensions/table/table/utilities/delete-key-shortcut.ts, .../extensions/typography/inputRules.ts, .../extensions/utility.ts, .../extensions/work-item-embed/extension.tsx
Converts interfaces to type aliases, improves type safety by replacing any with unknown for HTML attributes, and updates imports for type-only usage.
Centralized Type Imports
.../extensions/headings-list.ts, .../helpers/scroll-to-node.ts, .../core/types/editor.ts
Removes local interface declarations in favor of shared type imports from a central types module.
Constant Reference Update
.../extensions/table/table/utilities/helpers.ts
Replaces hardcoded string with constant reference for paragraph node type.

Sequence Diagram(s)

sequenceDiagram
    participant ParentComponent
    participant DocumentEditor
    participant PageRenderer

    ParentComponent->>DocumentEditor: Render with isTouchDevice prop
    DocumentEditor->>PageRenderer: Passes isTouchDevice prop
    PageRenderer-->>DocumentEditor: Renders based on isTouchDevice
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

🌟improvement, ready to merge

Suggested reviewers

  • Palanikannan1437
  • VipinDevelops

Poem

A rabbit with a keen type sense,
Hopped through code to make things dense—
Interfaces now type-alias neat,
Touch devices get a special seat!
Unknowns replace the wild old any,
For code that’s safe and bugs not many.
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/editor-types

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.
    • Explain this complex logic.
    • 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 explain this code block.
  • 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 explain its main purpose.
    • @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 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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests 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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 4, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Caution

Review failed

The head commit changed during the review from e2fc67c to dbfa653.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/editor-types

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.
    • Explain this complex logic.
    • 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 explain this code block.
  • 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 explain its main purpose.
    • @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 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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests 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.

3 similar comments
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 4, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Caution

Review failed

The head commit changed during the review from e2fc67c to dbfa653.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/editor-types

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.
    • Explain this complex logic.
    • 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 explain this code block.
  • 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 explain its main purpose.
    • @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 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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests 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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 4, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Caution

Review failed

The head commit changed during the review from e2fc67c to dbfa653.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/editor-types

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.
    • Explain this complex logic.
    • 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 explain this code block.
  • 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 explain its main purpose.
    • @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 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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests 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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 4, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Caution

Review failed

The head commit changed during the review from e2fc67c to dbfa653.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/editor-types

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.
    • Explain this complex logic.
    • 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 explain this code block.
  • 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 explain its main purpose.
    • @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 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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests 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.

Copy link
Contributor

@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

♻️ Duplicate comments (1)
packages/editor/src/core/extensions/code/code-block-lowlight.ts (1)

6-9: Good interface-to-type conversion, but address the any type.

The conversion from interface to type alias aligns with the PR objectives. However, the lowlight property should use a more specific type instead of any, consistent with the PR goal of replacing any with unknown where possible.

🧹 Nitpick comments (8)
packages/editor/src/core/extensions/table/table/utilities/helpers.ts (1)

4-5: Import only what’s needed to maximise tree-shaking benefits

CORE_EXTENSIONS is presumably an object containing several string constants, yet this file only uses the PARAGRAPH entry. Importing the whole object can marginally inflate bundle size and prevents some bundlers from pruning unused keys.


-import { CORE_EXTENSIONS } from "@/constants/extension";
+import { CORE_EXTENSIONS } from "@/constants/extension"; // current approach
+
+// Optional leaner variant:
+// import { PARAGRAPH } from "@/constants/extension";

If the constants module supports named exports, the latter keeps the dependency surface minimal.

packages/editor/src/core/components/menus/bubble-menu/root.tsx (1)

32-50: Consider extracting the repeated color-option shape

color and backgroundColor share the same inline object definition. Extracting a dedicated type ColorOption = { key: string; label: string; textColor: string; backgroundColor: string } would reduce duplication and tighten future refactors.

-type EditorStateType = {
-
-  color: { key: string; label: string; textColor: string; backgroundColor: string } | undefined;
-  backgroundColor:
-    | {
-        key: string;
-        label: string;
-        textColor: string;
-        backgroundColor: string;
-      }
-    | undefined;
-};
+type ColorOption = {
+  key: string;
+  label: string;
+  textColor: string;
+  backgroundColor: string;
+};
+
+export type EditorStateType = {
+
+  color?: ColorOption;
+  backgroundColor?: ColorOption;
+};
packages/editor/src/core/components/menus/block-menu.tsx (1)

8-12: Good refactoring, consider more descriptive naming.

The conversion from interface to type alias aligns with the PR objectives. However, consider using a more descriptive name like BlockMenuProps instead of the generic Props to improve code readability, especially in larger files.

-type Props = {
+type BlockMenuProps = {
   editor: Editor;
 };

-export const BlockMenu = (props: Props) => {
+export const BlockMenu = (props: BlockMenuProps) => {
packages/editor/src/core/components/editors/link-view-container.tsx (2)

7-10: Prefer more descriptive prop alias than generic Props

Using a generic alias like Props makes quick navigation harder when viewing type references in IDEs and during code-search (grep Props yields hundreds of hits). Retaining LinkViewContainerProps (or exporting LinkViewContainer.Props) would improve traceability without affecting the refactor goal.


12-12: Component displayName not set after renaming

When components are exported anonymously (export const LinkViewContainer = …) the runtime display name defaults to the variable name. If you ever minify or wrap this component the display name might be lost, complicating React-DevTools inspection. Consider adding:

 export const LinkViewContainer: FC<Props> = ({ editor, containerRef }) => {
   …
 };
+LinkViewContainer.displayName = "LinkViewContainer";
packages/editor/src/core/extensions/code/code-block-node-view.tsx (1)

18-20: Avoid the overly generic Props alias

As with other files, consider a more specific name such as CodeBlockNodeViewProps to aid discoverability and future grep-based refactors.

packages/editor/src/core/components/editors/editor-content.tsx (1)

4-9: Generic prop alias reduces searchability

The new alias Props is technically fine but not uniquely identifiable. A specific name (EditorContentWrapperProps) keeps type-lookups unambiguous, especially in a large monorepo.

packages/editor/src/core/extensions/code-inline/index.tsx (1)

5-8: Improved safety with unknown is 👍 — consider keeping legacy alias

The move from any to unknown strengthens type-safety. However, renaming CodeOptions to InlineCodeOptions could break external consumers who import the old name. If this extension is part of a public API, exporting a deprecated alias for one release helps downstream teams migrate smoothly.

+/** @deprecated — use InlineCodeOptions */
+export type CodeOptions = InlineCodeOptions;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fa150c2 and dbfa653.

📒 Files selected for processing (29)
  • packages/editor/src/core/components/editors/document/editor.tsx (2 hunks)
  • packages/editor/src/core/components/editors/editor-content.tsx (1 hunks)
  • packages/editor/src/core/components/editors/link-view-container.tsx (1 hunks)
  • packages/editor/src/core/components/links/link-edit-view.tsx (2 hunks)
  • packages/editor/src/core/components/links/link-view.tsx (1 hunks)
  • packages/editor/src/core/components/menus/block-menu.tsx (1 hunks)
  • packages/editor/src/core/components/menus/bubble-menu/root.tsx (2 hunks)
  • packages/editor/src/core/extensions/code-inline/index.tsx (2 hunks)
  • packages/editor/src/core/extensions/code/code-block-lowlight.ts (1 hunks)
  • packages/editor/src/core/extensions/code/code-block-node-view.tsx (2 hunks)
  • packages/editor/src/core/extensions/code/code-block.ts (2 hunks)
  • packages/editor/src/core/extensions/custom-link/extension.tsx (2 hunks)
  • packages/editor/src/core/extensions/emoji/components/emojis-list.tsx (2 hunks)
  • packages/editor/src/core/extensions/emoji/emoji.ts (1 hunks)
  • packages/editor/src/core/extensions/headings-list.ts (1 hunks)
  • packages/editor/src/core/extensions/horizontal-rule.ts (1 hunks)
  • packages/editor/src/core/extensions/table/table-cell.ts (1 hunks)
  • packages/editor/src/core/extensions/table/table-header.ts (1 hunks)
  • packages/editor/src/core/extensions/table/table-row.ts (1 hunks)
  • packages/editor/src/core/extensions/table/table/table.ts (1 hunks)
  • packages/editor/src/core/extensions/table/table/utilities/create-cell.ts (1 hunks)
  • packages/editor/src/core/extensions/table/table/utilities/delete-key-shortcut.ts (1 hunks)
  • packages/editor/src/core/extensions/table/table/utilities/helpers.ts (2 hunks)
  • packages/editor/src/core/extensions/typography/inputRules.ts (2 hunks)
  • packages/editor/src/core/extensions/utility.ts (1 hunks)
  • packages/editor/src/core/extensions/work-item-embed/extension.tsx (2 hunks)
  • packages/editor/src/core/helpers/common.ts (1 hunks)
  • packages/editor/src/core/helpers/scroll-to-node.ts (1 hunks)
  • packages/editor/src/core/types/editor.ts (5 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (6)
packages/editor/src/core/extensions/code/code-block-lowlight.ts (1)
packages/editor/src/core/extensions/code/code-block.ts (1)
  • CodeBlockOptions (6-26)
packages/editor/src/core/components/links/link-edit-view.tsx (1)
packages/editor/src/core/components/links/link-view.tsx (2)
  • LinkViewProps (8-16)
  • LinkViews (6-6)
packages/editor/src/core/extensions/table/table/utilities/delete-key-shortcut.ts (1)
packages/editor/src/core/extensions/table/plugins/insert-handlers/utils.ts (1)
  • TableInfo (14-20)
packages/editor/src/core/extensions/utility.ts (2)
packages/editor/src/core/types/asset.ts (1)
  • TEditorAsset (14-14)
packages/editor/src/core/types/config.ts (1)
  • TFileHandler (4-20)
packages/editor/src/core/extensions/code/code-block-node-view.tsx (1)
packages/ui/src/icons/epic-icon.tsx (1)
  • Props (3-8)
packages/editor/src/core/types/editor.ts (1)
packages/editor/src/core/types/config.ts (1)
  • TUserDetails (35-40)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build and lint web apps
🔇 Additional comments (40)
packages/editor/src/core/extensions/table/table/utilities/helpers.ts (1)

26-33: String literal replaced with constant – 👍 improves maintainability

Switching from the hard-coded "paragraph" to CORE_EXTENSIONS.PARAGRAPH centralises the source of truth and eliminates typo risk. This aligns with the refactor objective and keeps node-type checks consistent across the codebase.

packages/editor/src/core/extensions/work-item-embed/extension.tsx (1)

1-1: Type-safe import & parameter annotation look correct

Nice replacement of any with the explicit NodeViewProps while keeping the import type-only. No other issues spotted in this hunk.

Also applies to: 20-20

packages/editor/src/core/extensions/typography/inputRules.ts (1)

3-23: Interface → type alias change is benign

Switching to a type alias preserves the original shape and causes no functional impact. ✔︎

packages/editor/src/core/extensions/utility.ts (1)

33-39: Storage alias change looks fine

The conversion to a type alias is seamless and does not alter public shape. 👍

packages/editor/src/core/extensions/horizontal-rule.ts (2)

6-8: Good move from anyunknown

Tightening HTMLAttributes to Record<string, unknown> increases type safety without runtime impact.


6-8: No external imports of HorizontalRuleOptions found
A global search for HorizontalRuleOptions only surfaced its definition and its use in Node.create<HorizontalRuleOptions> within packages/editor/src/core/extensions/horizontal-rule.ts. There are no external imports of this type, so switching from an exported interface to an internal type will not break consumers or tests.

packages/editor/src/core/extensions/custom-link/extension.tsx (2)

13-16: LGTM: Interface to type conversion is correct.

The conversion from interface LinkProtocolOptions to type LinkProtocolOptions maintains the same structure and functionality while aligning with the PR's refactoring objectives.


18-50: LGTM: Improved type safety with unknown over any.

The conversion to type alias and the change from Record<string, any> to Record<string, unknown> on Line 43 improves type safety by requiring explicit type checking before using HTMLAttributes values.

packages/editor/src/core/extensions/table/table-cell.ts (1)

12-14: LGTM: Consistent type refactoring with improved safety.

The conversion to type alias and the change from Record<string, any> to Record<string, unknown> follows the established refactoring pattern and improves type safety.

packages/editor/src/core/helpers/common.ts (2)

8-12: LGTM: Interface to type conversion with improved naming.

The conversion from interface to type alias aligns with the refactoring goals, and the rename from EditorClassNames to EditorClassNameArgs provides better semantic clarity about the type's purpose.


14-14: LGTM: Function signature correctly updated.

The function parameter type annotation has been properly updated to use the new type alias name.

packages/editor/src/core/components/editors/document/editor.tsx (2)

33-33: LGTM: New touch device prop added.

The addition of the isTouchDevice prop aligns with improving touch device support in the editor.


100-100: LGTM: Proper boolean conversion for prop passing.

The use of !!isTouchDevice ensures a consistent boolean type is passed to the PageRenderer component, which is good defensive programming practice.

packages/editor/src/core/components/links/link-view.tsx (1)

8-16: LGTM: Consistent interface to type conversion.

The conversion from interface LinkViewProps to type LinkViewProps maintains the identical structure while aligning with the PR's systematic refactoring of type declarations.

packages/editor/src/core/extensions/table/table-row.ts (1)

5-7: Removing the export makes options no longer augmentable

Converting TableRowOptions from an exported interface to an internal type prevents declaration-merging and external consumers from extending the options (e.g. to add custom attributes).
If any downstream code relied on declare module "@tiptap/core" augmentation for this node, this is a silent breaking change.

Please double-check that no public plugin API relied on extending these options, or consider keeping the type exported:

-type TableRowOptions = {
+export type TableRowOptions = {
packages/editor/src/core/extensions/code/code-block.ts (1)

6-26: Switching from interfacetype may be a breaking change for consumers

interface allowed declaration merging so external packages could augment CodeBlockOptions.
With an exported type alias this is no longer possible, potentially breaking third-party extensions that add extra flags (e.g. lineNumbers?: boolean).

If preventing augmentation is intentional, add a CHANGELOG entry.
Otherwise keep it as an interface or provide an explicit extension point.

No other issues with the unknown substitution—good call tightening the type.

packages/editor/src/core/helpers/scroll-to-node.ts (1)

1-3: 👍 Type-only imports are correct here

Using import type avoids bundling/reactivity overhead and aligns with TS 5 “preserve value export” rules.
No concerns.

packages/editor/src/core/extensions/table/table-header.ts (1)

7-9: Validate loss of export on TableHeaderOptions

Same concern as with TableRowOptions: dropping the export eliminates declaration-merging and may break consumers that extend the header-cell options.
Confirm this isn’t publicly relied upon or re-export the type.

packages/editor/src/core/extensions/table/table/utilities/create-cell.ts (1)

6-6: Good move to unknown

attrs?: Record<string, unknown> improves type safety without affecting runtime behaviour.
Looks correct.

packages/editor/src/core/extensions/table/table/table.ts (1)

35-42: LGTM! Excellent type safety improvements.

The conversion from interface to type alias and the change from any to unknown for HTMLAttributes aligns perfectly with the PR objectives and improves type safety.

packages/editor/src/core/components/menus/block-menu.tsx (1)

1-1: LGTM! Type-only import improves clarity.

Converting to a type-only import for Editor is appropriate since it's only used for type annotations.

packages/editor/src/core/components/links/link-edit-view.tsx (2)

9-15: LGTM! Clean interface-to-type conversion.

The conversion from interface to type alias for InputViewProps aligns with the PR objectives and maintains the same structure.


31-34: LGTM! Consistent type refactoring.

The conversion from interface to type alias for LinkEditViewProps is consistent with the broader refactoring pattern across the codebase.

packages/editor/src/core/extensions/table/table/utilities/delete-key-shortcut.ts (2)

1-1: LGTM! Improved import clarity.

Converting to type-only imports for Editor and KeyboardShortcutCommand is appropriate since they're only used for type annotations.


9-20: Dismiss TableInfo duplication suggestion

The TableInfo in insert-handlers/utils.ts (fields: tableElement, tableNode, tablePos, optional button elements) serves a DOM insertion context, while the one in delete-key-shortcut.ts (fields: node, pos, map, totalColumns, totalRows) models ProseMirror table state for deletion handling. They represent different concepts and should remain separate.

Likely an incorrect or invalid review comment.

packages/editor/src/core/extensions/headings-list.ts (1)

5-6: Centralised IMarking import looks good

Switching from a local interface to the shared @/types definition eliminates duplication and keeps the extension in sync with global edits. Nothing else to flag here.

packages/editor/src/core/components/editors/editor-content.tsx (1)

1-1: import { type Editor } – minor tree-shaking win, good job

Switching to a type-only import prevents the Editor object from leaking into the bundle. Nice attention to detail.

packages/editor/src/core/extensions/code-inline/index.tsx (1)

31-31: Generic parameter updated correctly

Mark.create<InlineCodeOptions> reflects the renamed options type; compile-time behaviour remains intact.

packages/editor/src/core/extensions/emoji/emoji.ts (2)

68-68: LGTM: Improved type safety with unknown.

Replacing any with unknown for the index signature provides better type safety by requiring explicit type checking before using values.


72-72: LGTM: Enhanced type safety for HTMLAttributes.

The change from Record<string, any> to Record<string, unknown> improves type safety by ensuring values are properly typed before use.

packages/editor/src/core/types/editor.ts (5)

9-9: LGTM: Consistent type import.

Using type-only import for IMarking aligns with TypeScript best practices and the PR's refactoring objectives.


131-157: LGTM: Interface to type alias conversion.

The conversion of IEditorProps from interface to type alias is consistent with the PR's refactoring goals while maintaining identical functionality.


165-174: LGTM: Consistent refactoring pattern.

Converting ICollaborativeDocumentEditorProps to a type alias maintains the same structure and extends IEditorProps correctly.


176-181: LGTM: Type alias conversion maintained.

The IDocumentEditorProps conversion to type alias preserves all properties and type relationships.


183-193: LGTM: EditorEvents type conversion.

Converting EditorEvents interface to type alias maintains the event mapping structure correctly.

packages/editor/src/core/extensions/emoji/components/emojis-list.tsx (5)

2-2: LGTM: Type-only import optimization.

Using type-only import for Editor improves compilation performance and aligns with the PR's type safety improvements.


8-14: LGTM: Interface to type conversion.

Converting EmojiItem interface to type alias maintains the same structure while following the PR's consistent refactoring pattern.


35-37: LGTM: Ref type conversion.

The EmojiListRef conversion to type alias preserves the method signature correctly.


39-44: LGTM: Props type simplification.

Converting to Props type alias and simplifying the name follows common React component patterns while maintaining all required properties.


46-46: LGTM: Component signature updated correctly.

The component signature properly uses the new Props type alias, maintaining type safety.

@pushya22 pushya22 merged commit 7ead606 into preview Aug 4, 2025
5 of 7 checks passed
@pushya22 pushya22 deleted the refactor/editor-types branch August 4, 2025 12:31
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.

5 participants