I'm trying to build my project that uses the AWS Javascript SDK v3. Here my tsconfig.json
{
"compilerOptions": {
"target":"ES2020",
"module": "commonjs",
"lib": ["es2020"],
"outDir": "dist",
"resolveJsonModule": true,
},
"exclude": [
"coverage",
"node_modules",
"dist",
"tests"
]
}
And here an example of the build error I get (I've strip out some of the output for brevity sake):
node_modules/@aws-sdk/client-s3/types/models/models_1.d.ts:727:23 - error TS2304: Cannot find name 'ReadableStream'.
node_modules/@aws-sdk/client-s3/types/models/models_1.d.ts:727:40 - error TS2304: Cannot find name 'Blob'.
node_modules/@aws-sdk/util-dynamodb/types/models.d.ts:19:86 - error TS2304: Cannot find name 'File'.
I don't understand why this is giving me such an issue, even if I have installed the @types/node
module to support node typing
Turned out that in order for typescript to find the Blob
, File
etc. names I had to add the dom
entry to the lib in my tsconfig.json. Here my final tsconfig, which allow me to build the project correctly
{
"compilerOptions": {
"target":"ES2020",
"module": "commonjs",
"lib": ["es2020", "dom"],
"outDir": "dist",
"resolveJsonModule": true,
},
"exclude": [
"coverage",
"node_modules",
"dist",
"tests"
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With