magda-io / magda

A federated, open-source data catalog for all your big data and small data
https://magda.io
Apache License 2.0
509 stars 93 forks source link

@magda SDK globals.d.ts:72:13 - error TS2403: Subsequent variable declarations must have the same type. #3518

Closed t83714 closed 5 months ago

t83714 commented 5 months ago

Describe the bug

When using one of Magda SDK v3 to build a minion, connector or auth plugin, users might come across this error:

node_modules/@types/node/globals.d.ts:72:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'AbortSignal' must be of type '{ new (): AbortSignal; prototype: AbortSignal; abort(reason?: any): AbortSignal; timeout(milliseconds: number): AbortSignal; }', but here has type '{ new (): AbortSignal; prototype: AbortSignal; }'.

72 declare var AbortSignal: {
               ~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:2337:13
    2337 declare var AbortSignal: {
                     ~~~~~~~~~~~
    'AbortSignal' was also declared here.

This is caused by an incompatible version of @types/node (e.g. v16 might be resoluted installed).

User can add "@types/node": "^18.19.3" to devDependencies of package.json to resolve this issue.

t83714 commented 5 months ago

Magda SDK can probably add "@types/node": "^18.19.3" to the dependencies of SDK to reduce the chance of seeing this issue.

However, this solution might not be desired as the users might prefer a different & higher version of "@types/node".

Therefore, no fix will be done in Magda SDK. The user should add a proper version of @types/node to his project package.json by himself.