dsherret / dsherret/ts-morph

Is there a way to shorten the full paths in types to package names?

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

Description

I have case:
```ts
import log, {type LogFunctions} from 'electron-log'
const renderLogger: LogFunctions = log.scope('renderer')
```
In processing `renderLogger` type resolved as
```js
import("/global/path/to/project/node_modules/electron-log/src/index").LogFunctions;
```

But I would like to get a type without global path but with package name:
```js
import("electron-log").LogFunctions;
```

Is there a way to do this?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the TypeScript example using ts-morph and the electron-log package, then inspect the type-processing or printing entry points that produce the displayed fully qualified path. Determine whether package-name shortening is supported or requires a design decision; done means the rendered type uses import("electron-log").LogFunctions without the global path.

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.