tediousjs / tedious

Node TDS module for connecting to SQL Server databases.
http://tediousjs.github.io/tedious/
MIT License
1.56k stars 443 forks source link

Cannot find name 'AggregateError'. #1612

Closed martijnimhoff closed 3 months ago

martijnimhoff commented 3 months ago

Software versions

Problem description When I install this library in my project. I'm getting the following type error in the library:

> eslint .; tsc --noemit

node_modules/tedious/lib/connection.d.ts:748:29 - error TS2304: Cannot find name 'AggregateError'.

748     loginError: undefined | AggregateError | ConnectionError;
                                ~~~~~~~~~~~~~~

Found 1 error in node_modules/tedious/lib/connection.d.ts:748

Expected behavior It looks like AggregateError should be available, but it is not found. I can't reproduce this type error when just running the linter in the library itself.

martijnimhoff commented 3 months ago

Cause was that target in tsconfig.json was set to es2020.

wy193777 commented 1 month ago

I have the same error, can you be detailed on how did you fixed it?

lroal commented 1 month ago

How do I solve this ? I am using pure javascript with typescript definition files. Have no tsconfig.json

martijnimhoff commented 1 month ago

I have the same error, can you be detailed on how did you fixed it?

In my tsconfig.json, I changed the target to es2022.

How do I solve this ? I am using pure javascript with typescript definition files. Have no tsconfig.json

Are you building a library yourself? How does this setup work?

lroal commented 1 month ago

target es2022 solved it

tsc ./src/index.d.ts --module commonjs --target es2022 --noEmit true --strict true --esModuleInterop true

I use tsc to check that my typescript definitions are correct: https://github.com/alfateam/rdb/blob/master/package.json#L44