Repository navigation
fix(types): restore missing type exports (#4139) - #4346
RobJacobson wants to merge 1 commit into
Conversation
- Restore the four reported source type imports through explicit declaration exports - Expose expression, style, symbol layer, map payload, and press event types publicly - Verify built and packed outputs with generated package metadata and dependency types - Cover private internal paths and Node runtime export rejection
|
Thanks for the thorough investigation and the packaged test. We'd like to take this in a narrower form though. As mentioned on #4139, the |
Description
Fixes #4139.
Restore the four reported source-path type imports and expose the missing types directly from
@rnmapbox/maps:Existing style aliases remain available.
Root cause
The packaging update for 10.2 introduced a
package.jsonexport map without entries for the previously accessible source paths. TypeScript’s bundler resolution respects that map, so the imports fail even though the source files are packaged.The public entry point also omitted types such as
Expression,FilterExpression, symbol-layer props, map payloads, andOnPressEvent, leaving consumers without equivalent public imports.This change adds explicit declaration exports for only:
src/utils/MapboxStylessrc/components/SymbolLayersrc/components/MapViewsrc/types/OnPressEventIt also re-exports the missing types through the native public entry point.
No runtime export targets are added. Node rejects runtime imports through these four paths. Metro retains its warning and source-file fallback behavior; this was verified separately.
Before and after verification
The strengthened regression suite was run against the unfixed base (
42758736) and the fixed implementation. It builds JavaScript and declarations with the repository’s real build targets, packs them with Yarn, and checks the extracted package.The suite checks:
moduleSuffixes: [""]and[".native", ""].Additional verification:
yarn test: 26 suites and 173 tests passed; lint completed with warnings and no errors.lib/output excluded.yarn generatepassed; no generated-file changes.SymbolLayer.tsxwith its expected fallback warning.Checklist
CONTRIBUTING.mdyarn generatein the root folder/exampleapp./example)Device checks were not run. This is a TypeScript package-resolution fix verified through compiler reproductions, packaged regression checks, and example source type checking. A new feature sample is not applicable.
Screenshot OR Video
Not applicable: the failure occurs during TypeScript compilation.
Component to reproduce the issue you're fixing
Standalone TypeScript consumer reproducer
In a consumer project with
@rnmapbox/mapsand TypeScript installed, create these files without apathsalias.index.ts:public.ts:tsconfig.json:{ "compilerOptions": { "strict": true, "skipLibCheck": true, "noEmit": true, "module": "ESNext", "moduleResolution": "bundler", "target": "ESNext", "types": [] }, "include": ["*.ts"] }Run:
The unfixed base produces four
TS2307errors, fiveTS2614errors, and oneTS2724error. The fixed package resolves these imports.The committed package regression can be run with:
It requires no map rendering or device.