I am working on a Deno project and need to utilize the ES2019 flatMap()
method on an array. To do this, I have created a tsconfig.json file with the following configuration:
{
"compilerOptions": {
"target": "es5",
"lib": [
"es2019"
]
}
}
After setting up the tsconfig.json file in this manner, I encountered 6 linter errors stating
Cannot find type definition file for 'cacheable-request'
. Is there a mistake in how I created the file or could it be conflicting with the Deno structure?
Within a module of my project where I intend to use flatMap()
, I received the error:
Property 'flatMap' does not exist on type 'number[][]'. Should I modify the target library? Perhaps changing the `lib` compiler option to 'es2019' or later would help.
Although I have specified es2019
as the target library in my tsconfig file, the error message seems contradictory since the code actually works. It makes me wonder if I made an error in creating the tsconfig file that is preventing it from being recognized... but then again, the code successfully compiles to es2019
.
Is there something crucial that I might be overlooking when configuring a tsconfig file for a Deno project to enable the usage of es2019
features?