js-algorand-sdk
js-algorand-sdk copied to clipboard
ECMAScript target version mismatch with cicd env
Subject of the issue
Our unit-tests with Circleci run in node12 which supports es2019. Our tsconfig target is es2020.
Steps to reproduce
- make a function that uses optional chaining
- build
- 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.
Case in point: https://app.circleci.com/pipelines/github/algorand/js-algorand-sdk/319/workflows/276c6032-39ca-4fb4-a0b8-9d0aa3a70d08/jobs/1744