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

types.cloneNode does not preverse type annotations #8996

Closed
neoziro opened this Issue Nov 8, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@neoziro
Contributor

neoziro commented Nov 8, 2018

Bug Report

Current Behavior
Calling types.cloneNode on a node containing a typeAnnotation does not preserve it.

Expected behavior/code
It should preserve typeAnnotation.

Environment

  • Babel version(s): [v7.1.2]

Possible Solution
Clone typeAnnotation here: https://github.com/babel/babel/blob/master/packages/babel-types/src/clone/cloneNode.js#L64

Additional context/Screenshots
Actually it is a problem because @babel/template is using types.cloneNode, the result is that it is not possible to have a type annotation using Babel template.

The original use-case is to be able to create TypeScript template for SVGR (see smooth-code/svgr#226).

@babel-bot

This comment has been minimized.

Collaborator

babel-bot commented Nov 8, 2018

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

neoziro added a commit to neoziro/babel that referenced this issue Nov 8, 2018

neoziro added a commit to neoziro/babel that referenced this issue Nov 9, 2018

neoziro added a commit to neoziro/babel that referenced this issue Nov 9, 2018

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