ibrod83 / nodejs-file-downloader

130 stars 23 forks source link

Type 'typeof import("d:/work/other/export-data-from-contentful/node_modules/nodejs-file-downloader/Downloader.td")' has no construct signatures. #62

Open dlopatiuk22 opened 7 months ago

dlopatiuk22 commented 7 months ago

Not work with TS v5.4.2

import  Downloader from "nodejs-file-downloader";
const downloader = new Downloader();

Error Type 'typeof import("d:/work/other/export-data-from-contentful/node_modules/nodejs-file-downloader/Downloader.td")' has no construct signatures.

ibrod83 commented 5 months ago

Sorry for the late response. I've tried now with TS 5.4.5 and it works. Can you paste your code and configurations?

vistac commented 5 months ago

it's work in CommonJS mode. and this issue happen in module mode.

ibrod83 commented 5 months ago

Can you please paste your tsconfig, package.json and perhaps the client code? I tried using the module mode, and it all works under this configuration:

package.json:

"type": "module"

tsconfig:

 "target": "ESNext"
"module": "ESNext"
 "moduleResolution": "node10"
ibrod83 commented 5 months ago

This way or another, i've added a named export for Downloader class. After playing around, seems that some problems arise from handling of default exports. Please upgrade to version 4.13.0, and use:

import {Downloader} from 'nodejs-file-downloader'