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

parser(ts): argument of TSTypeImport is not wrapped in TSLiteralType #12833

Open
1 task
armano2 opened this issue Feb 19, 2021 · 1 comment · May be fixed by #12834
Open
1 task

parser(ts): argument of TSTypeImport is not wrapped in TSLiteralType #12833

armano2 opened this issue Feb 19, 2021 · 1 comment · May be fixed by #12834

Comments

@armano2
Copy link
Contributor

armano2 commented Feb 19, 2021

Bug Report

  • I would like to work on a fix!

Current behavior
Currently any literal node that is present in type context except TSTypeImport is wrapped into TSLiteralType node.

Input Code

type x = import('test')
type x = typeof import('test')

Expected behavior

Environment

  • Babel version(s): latest
  • Node/npm version: all
  • OS: any
  • Monorepo: no
  • How you are using Babel: @babel/parse

Possible Solution

Additional context

typescript actually allows to use any type as argument of TSTypeImport and report recoverable error

type foo = 123
type x = import(foo) // String literal expected. (1141)

I'm currently working on aligning TSTypeImport between babel and typescript-eslint/typescript-eslint#2998

@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."

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

Successfully merging a pull request may close this issue.

3 participants