I am getting this Error when running the following code
let foo = ' foo '
console.log(foo.trimLeft())
//foo.trimStart() works neither
I know most of the solutions in the internet say, that I have to fix my tsconfig.json
to include es20whatever.
The funny thing is, I can use es2018 stuff like Promise.prototype.finally and rest spread etc. VSCode also auto completes trimStart()
for me which is odd, because the project and the editor should use the same tsconfig.json
.
But this particular piece of code does not compile.
Here is my tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"baseUrl": "./",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": ["node_modules/@types"],
"lib": ["es2018", "dom"],
"plugins": [
{
"name": "tslint-language-service",
"configFile": "./tslint.json"
}
],
"paths": {
"foo": ["projects/foo/src/public_api.ts"],
"bar": ["projects/bar/src/public_api.ts"],
"baz": ["dist/baz"]
}
}
}
I am running this in a monorepo angular folder (as you can see above). Perhaps there is an issue with that, I don't know.