flow-runtime icon indicating copy to clipboard operation
flow-runtime copied to clipboard

Fix type parameter references when assertions are disabled

Open selimeneserd opened this issue 6 months ago • 0 comments

Fixes #180.

Summary

  • Avoid emitting local variable type cache declarations when neither assertions nor warnings are enabled.
  • This prevents annotated-only output from referencing generic type parameters outside the t.annotate(... t.function(...)) callback where those parameters are defined.
  • Add a regression fixture for a generic function containing let bar: X with assertions disabled.

Tests

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

selimeneserd avatar May 11 '26 08:05 selimeneserd