When transpiling TS to JS compatible with NodeJS v14, using the following config:
{
"compilerOptions": {
"lib": ["es2020"],
"rootDir": "src",
"outDir": "build",
"module": "commonjs",
"moduleResolution": "node",
"target": "es2020",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"skipLibCheck": true,
}
}
It was expected that the usage of at(index)
would be converted to a compatible JS code, but in fact, when I ran the built code it generates (...).at is not a function
error.
[1,2,3].at(-1)
The transpiled code still makes use of .at(index)
, but I was expecting it would get transpiled to something compatible with the target set on tsconfig.js
target: "es2020"
What am I not getting correctly here?