dsherret / dsherret/ts-morph

Allow finding importId of a re-export

Open
#1,145 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
6.2k
Forks
238
Avg merge
2m
Merged PRs (30d)
1

Description

**Is your feature request related to a problem? Please describe.**

In Paka, a doc extraction utility, when looking at re-exports, we need to know if they are from external packages or not. To achieve this we look at the import ID. This information is not available on the result of `getExportedDeclarations`.

https://github.com/dsherret/ts-morph/blob/3dd5c72a48a7a5852cf5f995126b8cc12567ee86/packages/ts-morph/src/compiler/ast/base/ModuledNode.ts#L363

```
export { foo } from 'abc'
export { foo as bar } from 'abc2'
export * as qux from 'abc3'
```

**Describe the solution you'd like**

Not sure. Only way I see is changing the map value type. Instead of a declaration make it a wrapper type, a union of possible cases, one being `reExport` with a property like `importId`.

**Describe alternatives you've considered**

N/A

Contributor guide

Open the contributing guide

Research direction

Read CONTRIBUTING.md and inspect getExportedDeclarations in packages/ts-morph/src/compiler/ast/base/ModuledNode.ts at the linked location. Use the re-export examples in the issue to understand the missing import ID information; done means callers can identify whether re-exports come from external packages while retaining the existing declaration results.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers, devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.