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] Parsing error on import type thing = require('thing') #12957

Closed
1 task
SimenB opened this issue Mar 2, 2021 · 1 comment · Fixed by #12962
Closed
1 task

[TypeScript] Parsing error on import type thing = require('thing') #12957

SimenB opened this issue Mar 2, 2021 · 1 comment · Fixed by #12962
Assignees
Labels
area: typescript i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser

Comments

@SimenB
Copy link
Contributor

SimenB commented Mar 2, 2021

Bug Report

  • I would like to work on a fix!

Current behavior

Removing the type makes it parse properly. I believe this syntax is new in TS@4.2? Not mentioned in the blog post, tho.

I'm trying to update in jestjs/jest#11142 and there you can see I got an error from tsc for not having the type modifier, followed by Babel throwing syntax errors after adding it.

Input Code

import type expect = require('expect');

Expected behavior

It should parse properly (not necessarily transform)

Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)

  • Filename: babel.config.js
{
  "presets": ["@babel/preset-typescript"]
}

Environment


  • Babel version(s): v7.13.8
  • Node/npm version: node 14.16.0, yarn 2.4.1
  • OS: macOS 11.2.1
  • Monorepo: yup, yarn/lerna
  • How you are using Babel: @babel/core

Possible Solution

Additional context

@babel-bot
Copy link
Collaborator

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

@JLHwung JLHwung self-assigned this Mar 3, 2021
@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 Jun 14, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 14, 2021
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 pkg: parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants