dsherret / dsherret/ts-morph

Is it possible to detect import from alias paths using ts-morph?

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

Description

I set the path alias in my tsconfig.json:

```
paths: {
"module/*": ["./src/app/module/*"],
...
}
```
and I have import like this:

```
import { foo } from '@module/foo';
```

Is it possible to know if the import is from alias paths?

Contributor guide

Open the contributing guide

Research direction

Start by reading the ts-morph API around import declarations and how it represents the configured paths in tsconfig.json. Reproduce the example import from '@module/foo' and determine whether the API exposes enough information to identify an alias import. Done means a documented, supported way to detect this case, or a clearly scoped limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.