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

Some external dependencies are treated like they're not external #125

Open
yura415 opened this issue Apr 12, 2019 · 2 comments
Open

Some external dependencies are treated like they're not external #125

yura415 opened this issue Apr 12, 2019 · 2 comments

Comments

@yura415
Copy link

yura415 commented Apr 12, 2019

Environment:

  • typescript version: 3.3.3
  • dts-generator version: 3.0.0

dts-generator is treating debug import as if it's an internal module. Probably due to recent update in typescript: the name node kind of import statement is Identifier rather than StringLiteral.

Here is the output for resolveModuleImport(params) { console.log(params) }:

{ importedModuleId: 'debug',
  currentModuleId: 'common/debug',
  isDeclaredExternalModule: false }

The debug module is listed as a dependency in package.json. Typings are also installed (@types/debug).

I suggest to add a check for name node kind to be an Identifier or a StringLiteral in declaredExternalModules routine.

@yura415
Copy link
Author

yura415 commented Apr 12, 2019

I see now. The problem is how declaration files are written.

For example pino.d.ts, debug.d.ts

They don't have a module declaration with string literal. Debug had an Identifier declaring namespace name (probably?). Pino doesn't have its name in declaration file at all.

@yura415
Copy link
Author

yura415 commented Apr 12, 2019

Explicitly defining modules in --externs or --types wouldn't help resolving them as external either.

Need a fix for that based on dependencies / devDependencies / node_modules ?

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