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

Export is not defined #10044

Closed
jaejun-choi opened this issue May 30, 2019 · 9 comments · Fixed by #10220
Closed

Export is not defined #10044

jaejun-choi opened this issue May 30, 2019 · 9 comments · Fixed by #10220
Labels
area: flow Has PR i: bug i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser

Comments

@jaejun-choi
Copy link

Bug Report

Current Behavior
SyntaxError: Export 'Foo' is not defined

Input Code

interface Foo {}

export type { Foo }

Expected behavior/code
no error

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

Environment

  • Babel version(s): 7.4.5
  • Node/npm version: Node 11.13 / npm 6.7

Possible Solution
flowParseInterfaceish() should call checkLVal() or scope.declareName()

@babel-bot
Copy link
Collaborator

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

@ksocha
Copy link

ksocha commented May 31, 2019

I've encountered similar issue with @babel/plugin-transform-typescript@7.4.5. Everything works fine with @babel/plugin-transform-typescript@7.4.4

@JoshRobertson
Copy link

I've also encountered this issue upgrading from 7.4.4 to 7.4.5

@tanhauhau
Copy link
Member

@ksocha @JoshRobertson could you guys explain more on the specific code that produces error in typescript?

I couldn't replicate it

@ksocha
Copy link

ksocha commented Jun 15, 2019

@tanhauhau

I've created a repo using create-react-app that replicates the issue: https://github.com/ksocha/typescript-plugin-issue

With 7.4.5, you'll see that exported function is undefined.
Works fine with 7.4.4.

You can change versions by modifying resolutions entry in package.json.

@JLHwung
Copy link
Contributor

JLHwung commented Jul 15, 2019

@ksocha Thanks for the reproduction repo! However, I can not reproduce this issue with @babel/plugin-transform-typescript 7.5.2 on your repo. Looking to the commit history, it should be related to #9944 but later it has been fixed on 7.5.0.

jj-choi's issue can be reproduced at REPL.

@boris-petrov
Copy link

@JLHwung - did you manage to catch the issue? Because I have the same issue even on the latest 7.5.4 version.

@JLHwung
Copy link
Contributor

JLHwung commented Jul 15, 2019

@boris-petrov I assume you mean the issue submitted by the OP. And yes, the issue can be reproduced.

If you mean the issue submitted by @ksocha, I could not reproduce on his repo.

@boris-petrov
Copy link

@JLHwung - sorry, yes, I mean the original issue. Great, so we'll be expecting a fix soon, thanks!

JLHwung added a commit to JLHwung/babel that referenced this issue Jul 24, 2019
nicolo-ribaudo pushed a commit that referenced this issue Oct 2, 2019
* fix: typo

* declare name for flow interface

* add test case for export overload function, typescript

* test: add test

Fixes #10044

* test: update test

* test(flow): add multiple declarations regression test

* re-enable flow test case

# Conflicts:
#	packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/def-site-variance/input.js
#	packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-declare-statements/input.js
#	packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-interfaces-module-and-script/input.js
#	packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-iterator/input.js

* test: disable two flow dupl-decl test

* fix: do not declare name for declare function until we figure out a better way

* test: duplicate declare function and function would not throw
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jan 1, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: flow Has PR i: bug i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser
Projects
None yet
9 participants