mapbox / mapbox/mapbox-gl-language

Wrong typings for ESM module

Open
#65 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
204
Forks
51
PR merge metrics
No merged PRs in 30d

Description

# Problem

TypeScript with ESM modules fails to compile a program importing this `@mapbox/mapbox-gl-language` package.

```typescript
import language from "@mapbox/mapbox-gl-language";

// This `default` property is `undefined`.
console.log(language.default);
// This `language` default export is the actual constructor. But this leads to a compile error.
const control = new language();
```

# References

- [A reproduction package](https://github.com/mapbox/raviqqe/tree/main/mapbox-gl-esm-typing)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction package and its TypeScript ESM import of @mapbox/mapbox-gl-language. Compare the declared default export with the runtime value shown in the issue, then verify that the reproduction compiles while constructing the imported language control without accessing an undefined default property.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.