Skip to content

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

Open
subodhbhyri wants to merge 1 commit intovisgl:masterfrom
subodhbhyri:fix/local-font-family-2537
Open

fix: remove stale @ts-ignore for localIdeographFontFamily across all map modules#2587
subodhbhyri wants to merge 1 commit intovisgl:masterfrom
subodhbhyri:fix/local-font-family-2537

Conversation

@subodhbhyri
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.

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

1 participant