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

Parse type imports in TSImportEqualsDeclaration #12962

Merged
merged 3 commits into from Mar 14, 2021

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Mar 3, 2021

Q                       A
Fixed Issues? Fixes #12957
Patch: Bug Fix? Y
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

This PR implements parsing support on type imports in TSImportEqualsDeclaration

import type A = require("A");
export import type B = require("B");

Similar to what we did for ImportDeclaration, an enum property importKind: "value" | "type" will be added to TsImportEqualsDeclaration.

Note that when importKind is "type", the TSModuleReference on the RHS can not be an Identifier or a TSQualfiedName, which becomes an import alias for TypeScript, e.g. both

import type A = B.C;

and

export import type B = C;

will throw "An import alias can not use 'import type'".

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 3, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit fd32324:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@babel-bot
Copy link
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/43681/

@nicolo-ribaudo nicolo-ribaudo added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Mar 3, 2021
@SimenB
Copy link
Contributor

SimenB commented Mar 14, 2021

Any news on this one? 👀

Seems relatively straightforward, but there's been a couple of bug fix releases without it, so I might be missing something

@nicolo-ribaudo
Copy link
Member

Uh sorry, maybe @sosukesuzuki or @hzoo do you have time to quickly check if the changes seem ok? 🙏

Copy link
Member

@hzoo hzoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok gave a look, looks good!

@nicolo-ribaudo nicolo-ribaudo merged commit 0988c47 into babel:main Mar 14, 2021
@nicolo-ribaudo nicolo-ribaudo deleted the fix-12957 branch March 14, 2021 22:34
@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Mar 14, 2021

I can release a patch tomorrow.

@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 outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TypeScript] Parsing error on import type thing = require('thing')
5 participants