dsherret / dsherret/ts-morph

Ability to inline a value

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

Description

For example, something like this (rough idea):

```
// input
const someValue = 5;
const otherVar = someValue;

// then in the code to do the manipulation
sourceFile.getVariableDeclarationOrThrow("otherVar").getInitializerIfKindOrThrow(...).inlineWithValue();

// output
const someValue = 5;
const otherVar = 5;
```

Also:

```ts
// input
const someValue = 5;
const otherVar = someValue;

// then in the code to do the manipulation
sourceFile.getVariableDeclarationOrThrow("someValue").inline();

// output
const otherVar = 5;
```

This should be able to work across projects that use ES6 modules... so it should be able to import any dependencies. It would be useful to use #247 with this.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.