JSMonk / hegel

An advanced static type checker
https://hegel.js.org
MIT License
2.09k stars 59 forks source link

Path "stream" cannot be resolved #278

Open takase1121 opened 4 years ago

takase1121 commented 4 years ago

Cool project, but:

Path "stream" cannot be resolved

I installed @types/node but it doesn't seem to detect it? I am confused.

takase1121 commented 4 years ago

After some investigation, I cannot find any part of the code (at least for module resolver) that supports loading a d.ts file. Maybe the docs is misleading me?

EDIT: I was VERY wrong and don't know what I was saying. sorry for that

thecotne commented 4 years ago

this is how you do it https://github.com/JSMonk/hegel/blob/master/packages/cli/.hegelrc#L7-L9

takase1121 commented 4 years ago

@thecotne the problem is that is the wrong folder to search for. the structure of the folder is @types > (module name) > (name from package.json).d.ts. This means that require.resolve is unable to find it because the path is hard coded here, not to mention that the config specified by typings might not actually go through here which is required to get typings from the node module.

takase1121 commented 4 years ago

I suggest that the user typings and node_modules be handled seperately. the code is kind of confusing to get around

JSMonk commented 4 years ago

@takase1121, we still work for full support of Node.js native modules, so, I will check the stream module today and will notify you about changes as soon as possible :)

takase1121 commented 4 years ago

No worries, if you ever need help, I can try my best to help. I am currently testing some code to support DefinitelyTyped, if it works I'll consider opening a PR.

brandly commented 4 years ago

hi! i have a repo with flow types that i tried using hegel on.

i'm getting a similar error:

$ npx hegel
Path "net" cannot be resolved

maybe there is a common solution, but i could create a separate issue, if needed. thanks!