Skip to content

Conversation

@mscno
Copy link
Contributor

@mscno mscno commented Feb 2, 2026

Description

Complete migration of the leaflet-geoman codebase from JavaScript to TypeScript. This includes all source files in src/js/ and adds proper type definitions.

Type of Change

  • Refactoring (no functional changes)

Changes

  • Convert all JavaScript files to TypeScript (.js.ts)
  • Add TypeScript type definitions for events, options, and core interfaces
  • Add explicit type annotations throughout the codebase
  • Update build configuration for TypeScript compilation

Checklist

  • My code follows the code style of this project (run npm run lint)
  • I have tested my changes locally
  • New and existing tests pass locally with my changes (npm run test:all)

Test Results

All 333 Cypress tests pass.

mscno added 3 commits February 2, 2026 14:24
- Convert 40 source files from .js to .ts
- Keep L.Class.extend() pattern for Leaflet compatibility
- Add proper type annotations throughout
- Use type assertions for complex runtime types
- All unit tests passing (73 tests)
- Build compiles successfully
Auto-formatted by oxfmt after migration to match project style
Fix 11 failing tests that were introduced during the TypeScript migration:

- Remove stub _isRelevantForRemoval() from Mode.Rotate.ts that was overriding the real implementation from Mode.Removal.ts. This was the root cause of removal mode not working - the mixin system applies mixins in order and Rotate comes after Removal, so the stub method that always returned false was preventing layers from being marked as removable.

- Remove stub event fire methods from Mode.Edit, Mode.Drag, and Mode.Rotate that were potentially interfering with the EventMixin implementations.

- Add explicit remove() method to L.PM.Edit.Text.ts for the removeIfEmpty functionality which was previously relying on inheritance.

All 333 Cypress tests now pass.
@mscno mscno changed the title Fix failing tests after TypeScript migration Migrate codebase from JavaScript to TypeScript Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant