timocov / dts-bundle-generator

A tool to generate a single bundle of dts with types tree-shaking
MIT License
762 stars 40 forks source link

The exportElementSymbol occasionally returns undefined, resulting in an error in const namespaceImportForElement = getDeclarationsForSymbol(exportElementSymbol).find(ts.isNamespaceImport);. #308

Closed Byte2Tech closed 7 months ago

Byte2Tech commented 7 months ago

https://github.com/timocov/dts-bundle-generator/blob/c092c03bdc2302483512c5d473362294848a2eb9/src/types-usage-evaluator.ts#L115

timocov commented 7 months ago

Do you have an example when this happens ñ

Byte2Tech commented 7 months ago

https://github.com/Byte2Tech/dts-bundle-generator-test

timocov commented 7 months ago

Hey @Byte2Tech,

I cannot use the provided repo directly because I have no access to https://registry.npm.alibaba-inc.com. After removing lock file, tweaking npmrc and yarnrc files, added @types/node and @types/react as dependencies, and adding "types": ["react"], to the tsconfig I was able to run test.mjs without any issues. Please provide exact steps to reproduce the issue.

timocov commented 7 months ago

Let me know if you have any updates on this.