Skip to content

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

Description

@jedwards1211

Issuehunt badges

This is a:

  • Bug Report
  • Feature Request
  • Question
  • Other

Which concerns:

  • flow-runtime
  • babel-plugin-flow-runtime
  • flow-runtime-validators
  • flow-runtime-mobx
  • flow-config-parser
  • The documentation website

Code

// @flow

function foo<X>() {
  let bar: X
}

.babelrc

{
  "presets": ["es2015"],
  "plugins": [
    "transform-decorators-legacy",
    ["flow-runtime", {"assert": false}]
  ]
}

What is the current behaviour?


X is undefined in the output code below at let _barType = X:

import t from "flow-runtime";
function foo() {
  let _barType = X,
      bar;
}
t.annotate(foo, t.function(_fn => {
  const X = _fn.typeParameter("X");

  return [];
}));

What is the expected behaviour?


Either babel-plugin-flow-runtime doesn't create _barType, or it inserts const X = t.typeParameter("X") above let _barType it despite the "assert": false in the plugin options.

Which package versions are you using?

├── babel-core@6.26.0 
├── babel-plugin-flow-runtime@0.15.0 
├── babel-preset-es2015@6.24.0 

IssueHunt Summary

Backers (Total: $40.00)

Submitted pull Requests


Become a backer now!

Or submit a pull request to get the deposits!

Tips

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions