Skip to content

Fix assert false type parameter variables#285

Open
dicnunz wants to merge 1 commit into
gajus:masterfrom
dicnunz:issue-180-assert-false-type-params
Open

Fix assert false type parameter variables#285
dicnunz wants to merge 1 commit into
gajus:masterfrom
dicnunz:issue-180-assert-false-type-params

Conversation

@dicnunz
Copy link
Copy Markdown

@dicnunz dicnunz commented May 9, 2026

Fixes #180

IssueHunt bounty: https://issuehunt.io/repos/71611551/issues/180

What changed

  • Stop generating runtime variable type temporaries when both assertions and warnings are disabled.
  • Add a regression fixture for a generic function with let bar: X and plugin option assert: false.

Why

With assert: false, assignment checks are disabled too, so the generated _barType = X temporary is unused. In generic functions it can reference a type parameter outside the runtime scope and produce undefined output.

Tested

  • TEST_FILTER='180-assert-false-type-parameter' yarn --cwd packages/babel-plugin-flow-runtime test
  • yarn --cwd packages/flow-config-parser build
  • yarn --cwd packages/babel-plugin-flow-runtime build
  • yarn --cwd packages/babel-plugin-flow-runtime test (239 passing)
  • yarn --cwd packages/babel-plugin-flow-runtime lint (exits 0; existing repo-wide jsx-a11y rule warnings only)
  • git diff --check

Note: full root yarn install --frozen-lockfile reaches dependency linking but fails while building an unrelated old docs node-sass dependency because node-gyp expects python/python2. I used a temporary GIT_CONFIG_GLOBAL rewrite for the old git://github.com dependency URL during install.


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.

babel-plugin-flow-runtime references undefined type parameter names with assertions disabled

1 participant