Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flowtype class generic types are not stripped away #8332

Closed
bpatram opened this issue Jul 16, 2018 · 3 comments
Closed

Flowtype class generic types are not stripped away #8332

bpatram opened this issue Jul 16, 2018 · 3 comments
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@bpatram
Copy link

bpatram commented Jul 16, 2018

Bug Report

Current Behavior
It seems using generics for classes does not correctly get striped away when compiled when using the flow preset.

Input Code

// @flow

class MyClass<T> {
  foo: T;

  constructor(foo: T) {
    this.foo = foo;
  }
}

export default new MyClass<string>('test');

gets output as

class MyClass {

  constructor(foo) {
    this.foo = foo;
  }
}

export default new MyClass() < string > 'test';

(note that <string> is not stripped away)

Expected behavior/code
I would expect < string > to not be included in the output.

Babel Configuration (.babelrc, package.json, cli command)

{
    "presets": [
        "flow"
    ]
}

Environment

  • Babel version(s): v6.26.0
  • Node/npm version: Node 8.11.0/npm 5.6.0
  • OS: macOS 10.13
  • How you are using Babel: cli

Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.

@babel-bot
Copy link
Collaborator

Hey @bpatram! 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.

@loganfsmyth
Copy link
Member

This syntax is relatively new in Flow and is only available in our 7.x-beta branch: #7934

@nicolo-ribaudo
Copy link
Member

Closing since this is supported in Babel 7.

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Nov 8, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Nov 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

4 participants