Skip to content

#10530 - Refactor: Explicit/implicit Any type clean up from packages\ketcher-core\src\application\render\renderers\sequence\SequenceRenderer.ts file#10637

Open
AlexeyGirin with Copilot wants to merge 3 commits into
masterfrom
copilot/refactor-explicit-implicit-any-cleanup-4513c04b-31c3-4cf3-b44c-b45772ecaf67
Open

#10530 - Refactor: Explicit/implicit Any type clean up from packages\ketcher-core\src\application\render\renderers\sequence\SequenceRenderer.ts file#10637
AlexeyGirin with Copilot wants to merge 3 commits into
masterfrom
copilot/refactor-explicit-implicit-any-cleanup-4513c04b-31c3-4cf3-b44c-b45772ecaf67

Conversation

Copilot AI commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

How the feature works? / How did you fix the issue?

SequenceRenderer.ts had implicit/unspecified any in method params and local variables, weakening type safety in sequence editing/rendering flows. This change replaces those with explicit domain-safe types and keeps runtime behavior unchanged.

  • Typed API surface

    • Added explicit parameter/return types for previously untyped methods (addNewEmptyChainIfNeeded, shiftArrowSelectionInEditMode).
  • Typed local state in critical paths

    • Replaced untyped locals with explicit unions where needed (number | undefined, SequenceNode | undefined, SequenceBondRenderer, BaseSequenceItemRenderer | undefined).
  • Safer narrowing for renderer resolution

    • Kept getRendererByMonomer strict by narrowing with instanceof BaseSequenceItemRenderer before assignment.
  • BBox invariant made explicit

    • Consolidated bbox guards into a single assertion before width/height calculation.
private static addNewEmptyChainIfNeeded(
  chainBeforeNewEmptyChainIndex?: number,
): SequenceViewModelChain | undefined { ... }

public static shiftArrowSelectionInEditMode(event: KeyboardEvent) { ... }

let nodeIndexInRow: number | undefined;
let previousNode: SequenceNode | undefined;
let bondRenderer: SequenceBondRenderer;

Check list

  • unit-tests written
  • e2e-tests written
  • documentation updated
  • PR name follows the pattern #1234 – issue name
  • branch name doesn't contain '#'
  • PR is linked with the issue
  • base branch (master or release/xx) is correct
  • task status changed to "Code review"
  • reviewers are notified about the pull request

Copilot AI changed the title [WIP] Refactor explicit/implicit any type cleanup in SequenceRenderer.ts #10530 – Refactor explicit/implicit Any cleanup in SequenceRenderer Jul 19, 2026
Copilot AI requested a review from AlexeyGirin July 19, 2026 07:49
@AlexeyGirin
AlexeyGirin marked this pull request as ready for review July 19, 2026 07:51
@AlexeyGirin AlexeyGirin changed the title #10530 – Refactor explicit/implicit Any cleanup in SequenceRenderer #10530 - Refactor: Explicit/implicit Any type clean up from packages\ketcher-core\src\application\render\renderers\sequence\SequenceRenderer.ts file Jul 19, 2026
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.

Refactor: Explicit/implicit Any type clean up from packages\ketcher-core\src\application\render\renderers\sequence\SequenceRenderer.ts file

2 participants