leebyron / rollup-plugin-flow

Rollup plugin for removing Flow type annotations.
Other
80 stars 11 forks source link

Stripping types from polymorphic lambda functions #3

Closed alsiola closed 1 year ago

alsiola commented 7 years ago

If I have a typed object with a lambda function as a value, such as:

{
    propertyName: <T>(input : T[], reducer : (a : T) => number) : number => {
        // do something
    }
}

Then I get a failure of "Unexpected token" at the first line of code outside the object literal. If I remove the , as below, then all runs fine, but the typing no longer works.

{
    propertyName: (input : T[], reducer : (a : T) => number) : number => {
        // do something
    }
}

I think this is because the is being interpreted as an opening JSX tag, but I'm not certain.

amsul commented 5 years ago

@leebyron this is still an issue. Any ideas on how we'd get around this?

@alsiola were you able to find a solution?

alsiola commented 5 years ago

@amsul Sorry I don't recall ever solving this, and I don't work with the flow ecosystem currently.