question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@babel/plugin-proposal-pipe-operator in .babelrc causes TS error

See original GitHub issue

Current Behavior

I’ve added @babel/plugin-proposal-pipeline-operator to my .babelrc file but it doesn’t seem to be recognized.

Setup for Repro:

  1. npx tsdx create repro-913
  2. Choose basic template
  3. yarn add --dev @babel/plugin-proposal-pipeline-operator (tried this with and without adding peer dependency @babel/core)
  4. Add the following test code to src/index.ts
    const double = x => x*2;
    const increment = x => x+1;
    const doubleNext = x => x |> increment |> double
    
  5. Create a file in the root folder called .babelrc and add the following plugin:
    {
      "plugins": [
        ["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }]
      ]
    }
    
  6. npx tsdx build

Result is: syntax error TS1109: Expression expected.

I see the same result when using @babel/plugin-proposal-partial-application but when I try to use @babel/plugin-proposal-nullish-coalescing-operator it seems to work fine.

Expected behavior

Should load this plugin.

Suggested solution(s)

It sounds like there may be other issues affecting importing of .babelrc plugins. I’m wondering if perhaps there is a way to make the plugins more editable… perhaps an option to generate tsdx’s config files in the main directory when the project is created? It could also have to do with this particular plugin requiring a “proposal” property be set and maybe that’s not being merged correctly?

Other info

from package.json

"devDependencies": {
    "@babel/core": "^7.12.3",
    "@babel/plugin-proposal-partial-application": "^7.12.1",
    "@babel/plugin-proposal-pipeline-operator": "^7.12.1",

Your environment

  System:
    OS: macOS 10.15.6
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 130.29 MB / 16.00 GB
    Shell: 5.8 - /usr/local/bin/zsh
  Binaries:
    Node: 14.13.1 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.8 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 86.1.15.72
    Firefox: 72.0.1
    Safari: 14.0
  npmPackages:
    tsdx: ^0.14.1 => 0.14.1
    typescript: ^4.0.3 => 4.0.3
  npmGlobalPackages:
    tsdx: 0.14.1

Note, I’ve tried this also on node v.12.19.0 with the same results.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
mimshwrightcommented, Oct 27, 2020

Well, now it all makes sense. Thank you!

1reaction
mimshwrightcommented, Oct 27, 2020

@agilgur5 I’ve updated the issue with more details on how to reproduce. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

babel/plugin-proposal-pipe-operator in .babelrc causes TS error
Current Behavior I've added @babel/plugin-proposal-pipeline-operator to my .babelrc file but it doesn't seem to be recognized.
Read more >
babel/plugin-proposal-pipeline-operator
The pipeline operator has several competing proposals. Configure which proposal to use with the required "proposal" option. Its value is "hack" by default....
Read more >
Why do I need "@babel/plugin-proposal-optional-chaining" in ...
I have a project using Typescript and @babel/preset-env. Bundling with Webpack fails with this error and the config below. If I un-comment the ......
Read more >
EsNext features in TypeScript with Babel - DEV Community ‍ ‍
The type-check errors ain't pretty neat, cause they show us code snippets pre-compiled with Babel for example: lib/index. ts:10:3 - error TS ...
Read more >
@babel/plugin-proposal-pipeline-operator - Package Manager
Important: This documentation covers modern versions of Yarn. For 1.x docs, see classic.yarnpkg.com. Yarn.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found