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

@babel/parser@v7.12.1 could not parse typescript #12197

Closed
1 task
HsuTing opened this issue Oct 16, 2020 · 2 comments
Closed
1 task

@babel/parser@v7.12.1 could not parse typescript #12197

HsuTing opened this issue Oct 16, 2020 · 2 comments
Labels
i: bug i: needs triage outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@HsuTing
Copy link

HsuTing commented Oct 16, 2020

Bug Report

  • I would like to work on a fix!

Current behavior

Input Code

interface PropsType {
  isTrue: boolean;
  render: (
    children: React.ReactElement | React.ReactElement[] | undefined,
    props: {},
  ) => React.ReactElement;
  children: React.ReactElement | React.ReactElement[] | undefined;
}

// definition
export const switchRender = ({
  isTrue,
  render,
  children,
  ...props
}: PropsType): React.ReactElement | React.ReactElement[] | undefined =>
  isTrue ? render(children, props) : children;

Error:

  14 |   children,
  15 |   ...props
> 16 | }: PropsType): React.ReactElement | React.ReactElement[] | undefined =>
     |              ^
  17 |   isTrue ? render(children, props) : children;

Expected behavior

Error should not be here.

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

  • Filename: babel.config.js
{
  presets: [
    [
      '@babel/env',
      {
        useBuiltIns: 'usage',
        corejs: 3,
      },
    ],
    '@babel/react',
    '@babel/preset-typescript',
  ],
  ...
}

Environment

System:
    OS: macOS 10.15.6
  Binaries:
    Node: 12.19.0 - /usr/local/opt/node@12/bin/node
    Yarn: 1.22.10 - ~/Desktop/work/meep-lerna/node_modules/.bin/yarn
    npm: 6.14.8 - /usr/local/opt/node@12/bin/npm
  Monorepos:
    Yarn Workspaces: 1.22.10
    Lerna: 3.22.1
  npmPackages:
    @babel/cli: ^7.7.0 => 7.12.1
    @babel/core: ^7.7.2 => 7.12.1
    @babel/plugin-proposal-class-properties: ^7.7.0 => 7.12.1
    @babel/plugin-proposal-decorators: ^7.7.0 => 7.12.1
    @babel/plugin-proposal-export-default-from: ^7.5.2 => 7.12.1
    @babel/plugin-proposal-nullish-coalescing-operator: ^7.7.4 => 7.12.1
    @babel/plugin-proposal-optional-chaining: ^7.6.0 => 7.12.1
    @babel/plugin-transform-runtime: ^7.6.2 => 7.12.1
    @babel/preset-env: ^7.7.1 => 7.12.1
    @babel/preset-react: ^7.7.0 => 7.12.1
    @babel/preset-typescript: ^7.7.2 => 7.12.1
    @babel/runtime: ^7.7.2 => 7.12.1
    babel-eslint: ^10.0.3 => 10.1.0
    babel-jest: ^24.9.0 => 24.9.0
    babel-loader: ^8.0.5 => 8.1.0
    babel-plugin-css-modules-transform: ^1.6.1 => 1.6.2
    babel-plugin-module-resolver: ^3.1.1 => 3.2.0
    babel-plugin-transform-imports: ^2.0.0 => 2.0.0
    eslint: ^6.7.2 => 6.8.0
    eslint-import-resolver-babel-module: ^5.0.0-beta.1 => 5.1.2
    jest: ^24.9.0 => 24.9.0
    lerna: ^3.19.0 => 3.22.1
    webpack: ^4.41.2 => 4.44.2
  • Babel version(s): v7.12.1
  • Node/npm version: Node 12.19.0/npm 6.14.8
  • OS: OSX 10.15.6
  • Monorepo: Lerna
  • How you are using Babel: cli

Possible Solution

I think this bug is caused by #12183

Additional context

@babel-bot
Copy link
Collaborator

Hey @HsuTing! 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
Copy link
Contributor

JLHwung commented Oct 16, 2020

Duplicate of #12196

@JLHwung JLHwung closed this as completed Oct 16, 2020
@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 Jan 15, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: bug i: needs triage 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

3 participants