Property 'flatMap', 'flat' does not exist on type in TS
项目TS 编译时,报以下错误
Property 'flatMap' does not exist on type 'Policy[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later.ts(2550)
错误提示很明了
解决方法:
To solve the "Property 'flatMap' or 'flat' does not exist on type" error, add the string "es2019" to the lib array in your tsconfig.json file and make sure you are running a recent version of TypeScript.
Open your tsconfig.json file and add es2019 to your lib array.
{
"compilerOptions": {
// ... other options
"lib": [
// ... other libs
"es2019"
]
}
}
tsconfig.json 文件说明 参见官方文档
https://www.typescriptlang.org/tsconfig/
浙公网安备 33010602011771号