Skip to content

#11900 - rewrite packagesketcher coresrcdomainserializersmolutilsjs from javascript to typescript - #11910

Open
armankarapetyan-svg wants to merge 2 commits into
masterfrom
11900-lets-rewrite-packagesketcher-coresrcdomainserializersmolutilsjs-from-javascript-to-typescript
Open

armankarapetyan-svg wants to merge 2 commits into
masterfrom
11900-lets-rewrite-packagesketcher-coresrcdomainserializersmolutilsjs-from-javascript-to-typescript

Conversation

@armankarapetyan-svg

@armankarapetyan-svg armankarapetyan-svg commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

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

(Screenshots, videos, or GIFs, if applicable)

Converted packages/ketcher-core/src/domain/serializers/mol/utils.js from JavaScript to TypeScript with comprehensive type definitions, eliminating all implicit any types.

Changes

  • File Migration: Converted utils.js to utils.ts with full TypeScript support

  • Type Definitions: Introduced 3 new interfaces to replace implicit types:

  • BoundingBox - coordinate container for molecule fragments
  • FmtInfo - MOL file serialization format metadata
  • CategorizedMolecules - categorized molecule groups by fragment type
  • Enum Usage: Added FragmentType enum for clear fragment classification (Reactant, Product, Agent)

  • Function Signatures: All 18 utility functions now have explicit parameter and return types:

  • Primitive types: number, string, boolean, void
  • Complex types: Struct[], Record<number, ...>, Array
  • Proper nullability: BoundingBox | null
  • Import Safety: Updated imports to use RxnArrowMode enum instead of string literals
  • Documentation: Added comprehensive JSDoc comments for all functions with parameter descriptions

Type Safety Improvements

  • Eliminated all any types
  • Used specific union types (number | null) instead of generic patterns
  • Array types now specify element types (Struct[] instead of Array)
  • Proper type guards for nullable values (Vec2 | null with non-null assertions where safe)
  • Intentionally unused parameters marked with underscore prefix (_nAgents)

Breaking Changes

  • None. The module's exported API remains unchanged. All dependent imports continue to work without modification.

Testing
All type checks pass without errors
Existing imports in common.ts, molfile.ts, parseSGroup.ts, and v2000.ts verified and working
No functional changes to exported utilities

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

@armankarapetyan-svg armankarapetyan-svg changed the title 11900 lets rewrite packagesketcher coresrcdomainserializersmolutilsjs from javascript to typescript #11900 - rewrite packagesketcher coresrcdomainserializersmolutilsjs from javascript to typescript Sep 17, 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.

Let's rewrite packages\ketcher-core\src\domain\serializers\mol\utils.js from JavaScript to TypeScript

1 participant