Skip to content

fix: remove stale @ts-ignore for localIdeographFontFamily across all map modules - #2587

Open
subodhbhyri wants to merge 2 commits into
visgl:masterfrom
subodhbhyri:fix/local-font-family-2537
Open

fix: remove stale @ts-ignore for localIdeographFontFamily across all map modules#2587
subodhbhyri wants to merge 2 commits into
visgl:masterfrom
subodhbhyri:fix/local-font-family-2537

Conversation

@subodhbhyri

@subodhbhyri subodhbhyri commented May 5, 2026

Copy link
Copy Markdown

Problem

Three files contained a // @ts-ignore Mapbox specific prop comment above the
localIdeographFontFamily assignment in _updateStyle:

  • modules/react-maplibre/src/maplibre/maplibre.ts
  • modules/react-mapbox/src/mapbox/mapbox.ts
  • modules/main/src/mapbox-legacy/mapbox/mapbox.ts

The comment was misleading and the @ts-ignore was unnecessary:

  • react-maplibre: localIdeographFontFamily is fully present in
    maplibre-gl v5's MapOptions and StyleOptions types
  • react-mapbox: localIdeographFontFamily is present in mapbox-gl v3's
    MapOptions type (line 15141)
  • mapbox-legacy: mapbox-gl v1 ships no .d.ts files at all, so the prop
    is valid at runtime regardless

In all three cases, TypeScript 4.9+ in-operator narrowing makes the
@ts-ignore unnecessary. Inside if ('localIdeographFontFamily' in nextProps),
TypeScript widens nextProps to ...Props & Record<'localIdeographFontFamily', unknown>,
making the property access legal. Since options is typed any, assigning
unknown → any is permitted without suppression.

Fixes #2537

Changes

  • Removed @ts-ignore from all three files
  • Updated comments to accurately describe the prop and why no suppression is needed

Notes

localIdeographFontFamily already reaches the MapLibre/Mapbox constructor
correctly via the ...props spread in _initialize() — no runtime behavior
is changed by this PR.


Note

Low Risk
Comment-only TypeScript cleanup in style-update paths with no logic changes.

Overview
Removes unnecessary // @ts-ignore above localIdeographFontFamily in _updateStyle in mapbox-legacy, react-mapbox, and react-maplibre. The assignment is already valid with TypeScript 4.9+ in-narrowing and an options: any target.

Comments are updated per stack (mapbox-gl v1 runtime option, mapbox-gl v3 MapOptions, MapLibre StyleOptions) instead of the misleading “Mapbox specific prop” note. No runtime or style-update behavior changes.

Reviewed by Cursor Bugbot for commit af257a6. Bugbot is set up for automated code reviews on this repo. Configure here.

@chrisgervang

chrisgervang commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

I don't believe this fixes #2537, it's just mentioning the same type.

Typescript wouldn't affect a JS runtime

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.

[Bug] maplibre localIdeographFontFamily Not effective

2 participants