Skip to content

Fix type errors with maplibre-gl 6.0–6.2 - #27

Merged
db9795 merged 2 commits into
mainfrom
fix/type-error-6.0-6.2
Oct 6, 2026
Merged

db9795 merged 2 commits into
mainfrom
fix/type-error-6.0-6.2

Conversation

@db9795

@db9795 db9795 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Problem

The peer dependency allows maplibre-gl >=6.0.0, but the published typings only compile from 6.3.0 on. StyleControlEventType used Event<"style.set">, and maplibre's Event class only became generic in 6.3.0. TypeScript projects on 6.0–6.2 without skipLibCheck fail to build with:

error TS2315: Type 'Event$1' is not generic.

Runtime behavior was never affected. CI didn't catch it because it only runs against the locked version (6.9.1).

Changes

  • Drop the type argument from Event in the style.set event type. Evented<…> is already generic in 6.0.0, so control.on("style.set", e => e.style) stays fully typed. The only difference is that e.type is now typed as string instead of the literal "style.set".
  • README: note that the control is built and tested against maplibre-gl v6.
  • Patch changeset.

Fixing the typings instead of raising the peer range to >=6.3.0 keeps users on 6.0–6.2 installable without --legacy-peer-deps.

Testing

Typecheck and tests pass against maplibre-gl 6.0.0, 6.2.0, 6.3.0, 6.9.1 (locked) and 6.12.0 (latest). Before this change, typecheck failed on 6.0.0–6.2.0.

@db9795
db9795 merged commit 24590a3 into main Oct 6, 2026
1 check passed
@db9795
db9795 deleted the fix/type-error-6.0-6.2 branch October 6, 2026 15:15
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