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

Typescript: Incorrect detection of sourceType (TSExportAssignment) #9213

Closed
armano2 opened this issue Dec 19, 2018 · 4 comments
Closed

Typescript: Incorrect detection of sourceType (TSExportAssignment) #9213

armano2 opened this issue Dec 19, 2018 · 4 comments
Assignees
Labels
area: typescript i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@armano2
Copy link
Contributor

armano2 commented Dec 19, 2018

Bug Report

Current Behavior
Incorrect detection of sourceType in typescript

Input Code

  • REPL or Repo link if applicable:
const foo = '';
export = foo;

Expected behavior/code
Resolved sourceType should be resolved to module..

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

{
  sourceType: 'unambiguous',
  allowImportExportEverywhere: true,
  allowReturnOutsideFunction: true,
  ranges: true,
  plugins: [
    'jsx',
    'typescript',
    'objectRestSpread',
    'decorators-legacy',
    'classProperties',
    'asyncGenerators',
    'dynamicImport',
    'estree',
    'bigInt'
  ]
},

Environment

  • Babel version(s): 7.2.2
  • Node/npm version: 6-10
  • OS: windows & linux
  • Monorepo: no
  • How you are using Babel: cli

Possible Solution

Add node of type TSExportAssignment to detection.

@babel-bot
Copy link
Collaborator

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

@armano2 armano2 changed the title Incorrect detection of sourceType in typescript (TSExportAssignment) Typescript: Incorrect detection of sourceType (TSExportAssignment) Dec 20, 2018
@nicolo-ribaudo
Copy link
Member

I'm not sure about that. Arent export = and import foo = syntax sugar for commonjs?

@armano2
Copy link
Contributor Author

armano2 commented Dec 20, 2018

https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require

when used in typescript (tsc) its defining sourceType as module.

@liuxingbaoyu
Copy link
Member

Fixed in #15497

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Feb 11, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: typescript i: bug 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