Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False alert: dep imported in d.ts file #421

Closed
conartist6 opened this issue Sep 19, 2019 · 1 comment · Fixed by #422
Closed

False alert: dep imported in d.ts file #421

conartist6 opened this issue Sep 19, 2019 · 1 comment · Fixed by #422

Comments

@conartist6
Copy link
Contributor

My project contains .js files coupled with their typescript typedefs in .d.ts files. I'm running

depcheck --parsers="*.js:es6,*.d.ts:typescript"

I'd think this would work since the usages in the d.ts files are just normal es import statements. The only unusual thing about the contents of a d.ts file are that they contain the declare keyword.

@conartist6
Copy link
Contributor Author

conartist6 commented Sep 19, 2019

Ah yes, this is also because you are transpiling to sources instead of checking the typescript itself. There's a highly relevant comment here but it leaves me at a bit of a loss.

For one, the referenced issue, #163, is pretty decidedly a different problem. An @types/foo package is consumed when foo is imported or required in the transpiled code. Nothing about the current solution to parsing typescript precludes such a detector from being written.

This issue on the other hand, and #359, definitely require a different way of parsing typescript -- in particular they need to work on the actual typescript AST instead of the transpiled code.

With the advent of @babel/plugin-syntax-typescript I don't see a need to use the real typescript compiler at all. We can just run babel on the typescript sources and all the normal require/import detectors should work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant