You should add es2019
or es2019.array
to your --lib
setting for TypeScript to recognize array.flat()
and flatMap()
.
Example:
{
"compilerOptions": {
"target": "es5",
"lib": [
"es2019"
]
}
}
Previously this was available as part of esnext
or esnext.array
, but it’s now officially part of ES2019.