algorand / js-algorand-sdk

The official JavaScript SDK for Algorand.
https://algorand.github.io/js-algorand-sdk/
MIT License
284 stars 206 forks source link

ECMAScript target version mismatch with cicd env #626

Open AlgoDoggo opened 2 years ago

AlgoDoggo commented 2 years ago

Subject of the issue

Our unit-tests with Circleci run in node12 which supports es2019. Our tsconfig target is es2020.

Steps to reproduce

  1. make a function that uses optional chaining
  2. build
  3. check the /dist folder, you'll see the optional chaining won't be downcompiled, as it's es2020 syntax.

Expected behaviour

Optional chaining, non-nullish coalescing operator and others are all features of es2020. They're essential to write modern js. We should either bump the node version in cicd to 14 - 12 being past its end of life anyway - or set a es2019 target in our tsconfig.

Actual behaviour

Any function using es2020 features unsupported by node12 will fail in testing.

AlgoDoggo commented 2 years ago

Case in point: https://app.circleci.com/pipelines/github/algorand/js-algorand-sdk/319/workflows/276c6032-39ca-4fb4-a0b8-9d0aa3a70d08/jobs/1744