babel/babylon

NullLiteralTypeAnnotation has value: true

nicolo-ribaudo opened this issue · 4 comments

Input Code

let foo: null;

https://astexplorer.net/#/gist/897a3813d14de9616a179bd5ef4aacb0/latest

Babylon/Babel Configuration

{
  "plugins": [ "flow" ]
}

Expected Behavior

{
  "type": "NullLiteralTypeAnnotation",
  "start": 9,
  "end": 13,
  "loc": {
    "start": {
      "line": 1,
      "column": 9
    },
    "end": {
      "line": 1,
      "column": 13
    }
  }
}

Current Behavior

{
  "type": "NullLiteralTypeAnnotation",
  "start": 9,
  "end": 13,
  "loc": {
    "start": {
      "line": 1,
      "column": 9
    },
    "end": {
      "line": 1,
      "column": 13
    }
  },
  "value": true // <------
}

Your Environment

software version
Babylon master
hzoo commented

Hey @nicolo-ribaudo! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

Also ThisTypeAnnotation

danez commented

i think we can just simply remove the two lines 1046 and 1051 in plugins/flow.js. I don't see any value in them, as they are always true.

beginner-friendly. Seems my type. I am willing to submit a PR. Thanks Daniel for the hint.