I am using Typescript with ESNEXT (as of 2021) replaceAll in my code, because it is clearer than using a regexp.
I am transpiling to es5, but in the dist folder, in the traspiled js code, replaceAll remains as it is and there is a TypeError: replaceAll is not a function error.
I thought that Typescript would have traspiled it to es5, in a way that it works with es5. Why does it not do it? How can I fix this problem?
My TS config is:
{
    "compilerOptions": {
        "strict": true,
        "target": "es5",
        "lib": [
            "ES2021"
        ],
        "sourceMap": true,
        "outDir": "../dist/server",
        "baseUrl": ".",
        "resolveJsonModule": true,
        "downlevelIteration": true,
        "paths": {
            "@/*": [
                "./*"
            ]
        }
    }
}