The tsconfig manual (https://www.typescriptlang.org/tsconfig/#target) states that the target
property of the tsconfig
should set which features are downlevelled.
The target setting changes which JS features are downleveled and which are left intact. For example, an arrow function () => this will be turned into an equivalent function expression if target is ES5 or lower.
In my tsconfig.json
I have set my target
to be es6
:
{
"compilerOptions": {
"target": "es6",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"typeRoots": ["./src/@types", "./src/global.d.ts", "./node_modules/@types"],
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["**/*.ts", "**/*.tsx", "jest.config.js"],
"exclude": ["./node_modules"]
}
As such I would expect the feature Array.prototype.with
to be downlevelled to something that works in es6. However, it isn’t and this is causing issues running in Chrome 109 (last working version for Windows 7/8 users?)
Is there a reason that this isn’t the case?