Skip to content

#10546 - Refactor: Explicit/implicit Any type clean up from packages\ketcher-react\src\script\editor\tool\bond.ts file#10604

Open
AlexeyGirin with Copilot wants to merge 6 commits into
masterfrom
copilot/refactor-explicit-implicit-any-cleanup-34b08964-2737-483f-9710-a2d8d31c0c49
Open

#10546 - Refactor: Explicit/implicit Any type clean up from packages\ketcher-react\src\script\editor\tool\bond.ts file#10604
AlexeyGirin with Copilot wants to merge 6 commits into
masterfrom
copilot/refactor-explicit-implicit-any-cleanup-34b08964-2737-483f-9710-a2d8d31c0c49

Conversation

Copilot AI commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Removes all explicit and implicit any types from packages/ketcher-react/src/script/editor/tool/bond.ts, replacing them with precise TypeScript types.

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

New types file bond.types.ts:

  • BondItemRef{ map: string; id: number } for item references
  • BondToolDragContext — typed drag state (replaces dragCtx: any)
  • BondActionParams — parameters for applyBondAction

bond.ts changes:

  • bondProps: anyPartial<BondAttributes>
  • dragCtx: anydragCtx?: BondToolDragContext
  • All event handlers typed as PointerEvent; all private method parameters fully typed
  • Imported BondAttributes, AtomAttributes, Render, Pool, SGroup, FunctionalGroup, Bond from ketcher-core
  • Replaced multiple ! non-null assertions with proper guards and narrowing:
    • resolveAtomDragTarget now accepts item: BondItemRef directly (caller narrows via dragCtx.item?.map === 'atoms' guard)
    • restoreBondWhenHoveringOnCanvas split into sequential guards so TypeScript narrows existedBond, item, and action without assertions
    • resolveEndAtomPosition has typeof beginAtom !== 'number' type guard and null check for atom before property access

Also fixed: pre-existing unused import (takeElementScreenshot) in ketcher-autotests/tests/specs/Bugs/ketcher-2.28.0-bugs.spec.ts that was blocking the pre-push hook.

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 in bond.ts #10546 – Refactor: Explicit/implicit Any type clean up from bond.ts Jul 18, 2026
Copilot AI requested a review from AlexeyGirin July 18, 2026 19:05
…plicit-implicit-any-cleanup-34b08964-2737-483f-9710-a2d8d31c0c49
@AlexeyGirin
AlexeyGirin marked this pull request as ready for review July 18, 2026 20:51
@AlexeyGirin AlexeyGirin changed the title #10546 – Refactor: Explicit/implicit Any type clean up from bond.ts #10546 - Refactor: Explicit/implicit Any type clean up from packages\ketcher-react\src\script\editor\tool\bond.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-react\src\script\editor\tool\bond.ts file

2 participants