Skip to content

fix: align Map runtime type reference with transform-runtime#298

Open
ncthuc2004 wants to merge 1 commit into
gajus:masterfrom
ncthuc2004:issuehunt-177-map-runtime-ref
Open

fix: align Map runtime type reference with transform-runtime#298
ncthuc2004 wants to merge 1 commit into
gajus:masterfrom
ncthuc2004:issuehunt-177-map-runtime-ref

Conversation

@ncthuc2004
Copy link
Copy Markdown

@ncthuc2004 ncthuc2004 commented May 15, 2026

Summary

  • fix GenericTypeAnnotation conversion for Map so generated runtime refs use t.ref(Map, ...) instead of t.ref("Map", ...)
  • keep runtime value references compatible with Babel transform-runtime rewrites
  • update fixtures that assert transformed output for Map-based alias and generic function cases

Why

Issue #177 reports a runtime mismatch where babel-plugin-transform-runtime rewrites new Map() to a runtime import value while flow-runtime still checks against a string-based Map reference. Using a value reference in generated code keeps both sides aligned.

Validation

  • updated:
    • packages/babel-plugin-flow-runtime/src/convert.js
    • packages/babel-plugin-flow-runtime/src/__tests__/__fixtures__/typeAliases/builtins/map.js
    • packages/babel-plugin-flow-runtime/src/__tests__/__fixtures__/typeAssertions/functions/multipleTypeParameters.js
  • local targeted test run:
    • npm test -- --grep "Map|multipleTypeParameters|typeAliases" (42 passing)
  • note: full package test run has 2 pre-existing formatting-related failures in unrelated fixtures (optInOnly, bugs/14-exportDefaultArrowFunction)

IssueHunt Summary

Referenced issues

This pull request has been submitted to:


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