I am currently using TypeScript version 4.3.5 and Node.js version 14.18.1 in my project. The code I am working on is compiled to target both old and new browsers by setting target=es5
in the tsconfig file. I make use of both Promise.all and Promise.allSettled methods in my source code.
However, when testing on older browsers like Safari on iPhone 8 with iOS version 11, I encounter client-side errors specifically related to Promise.allSettled. This is surprising to me as I expected using es5 target would ensure compatibility with older devices for this method. I'm struggling to understand the root cause of this issue. Below is an excerpt from my tsconfig.json file:
{
"compilerOptions": {
"sourceMap": true,
"target": "es5",
"module": "commonjs",
"esModuleInterop": true,
"outDir": "dist",
"jsx": "react",
"lib": [
"ES2020.Promise",
"dom",
"webworker"
],
"skipLibCheck": true
},
"include": [
"typings/node.d.ts",
"typings/modules.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules",
"**/*.scss.d.ts"
]
}