Skip to content

Fix type parameter references when assertions are disabled#292

Open
sellimenes wants to merge 1 commit into
gajus:masterfrom
sellimenes:fix-assert-false-type-param-vars
Open

Fix type parameter references when assertions are disabled#292
sellimenes wants to merge 1 commit into
gajus:masterfrom
sellimenes:fix-assert-false-type-param-vars

Conversation

@sellimenes
Copy link
Copy Markdown

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

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