Closed TIRTAGT closed 2 years ago
I have to say that i didn't manage to reproduce the problem, as long as the TS-based program has @types/node installed. I've tried both in a clean TS setup with(tsc --init) and in a NestJs application.
Hmmm, I do have the node
typing installed and it's nearly on the latest version (latest was 17.0.21, while mine was 17.0.19).
But it looks like might be just my environment issue, weirdly doing the patch was the only way for me to resolve the issue and let my project compile.
I tried restarting the ts server, and setting up a new environment together with cloning my project repository and doing npm install, but weirdly nothing work.
Could be my tsconfig.json or package.json was the issue since I didn't check whether the issue persist with a clean project yet, but as it looks like the issue seems to be just my environment issue, I'm closing it.
It looks like the target was to import "anything" inside "http" module as "http", instead of trying to import default on "http" module.
This screenshot shows the typescript error I receive :
As I did not want to turn on "skipLibCheck" on TypeScript, I forked the nodejs-file-downloader repository and made the patch. I submit this pull request as it could have resolve any similar issue that I got.
Though as I see the
http
import are only used for getting theIncomingMessage
type, the import can be simplified into :This typescript issue was produced in my environment:
@types/node
version : 17.0.19