Skip to content

flow-runtime ParameterType remember doesn't work with arrays #237

Description

@vlsergeyatsbt

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

What is the current behaviour?

class TestClass<ValueType>  {

  do(  ) {
    const items : ValueType[] = JSON.parse( '[{ "a": null, "b": "b" }, { "a": "a", "b": null }]' );
    console.log(items);
  }

}

const testClass : TestClass = new TestClass();
testClass.do();
RuntimeTypeError: [1].a must be null
Expected: null
Actual Value: "a"
Actual Type: string
-------------------------------------------------
[1].b must be a string
Expected: string
Actual Value: null
Actual Type: null

What is the expected behaviour?

Shall not throw an exception.


Which package versions are you using?

    "@babel/cli": "^7.5.5",
    "@babel/core": "^7.5.5",
    "@babel/plugin-proposal-class-properties": "^7.5.5",
    "@babel/plugin-proposal-decorators": "^7.4.4",
    "@babel/preset-env": "^7.5.5",
    "@babel/preset-flow": "^7.0.0",
    "babel-plugin-flow-runtime": "^0.19.0",
    "flow-runtime": "^0.17.0"
{
  "plugins": [
    [ "flow-runtime", {
      "assert": true,
      "annotate": true
      } ],
    [ "@babel/plugin-proposal-decorators", { "decoratorsBeforeExport": true}],
    "@babel/plugin-proposal-class-properties",
  ],
  "presets": [
    "@babel/preset-flow",
    "@babel/preset-env",
  ]
}

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