dsherret / dsherret/ts-morph

How to force get emit output?

Open
#1,332 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

First of all, great project. Thanks a lot!
```ts
const service = project.getLanguageService()
const outputFiles = project
.getSourceFiles()
.map(sourceFile => {
const temp = service.getEmitOutput(sourceFile, true)
const emitOutputFiles = temp.getOutputFiles()

return emitOutputFiles
})
```
Hello! I use `service.getEmitOutput` in the way above. But when my code modified and rerun `service.getEmitOutput`, **the emit output not change**.

And I found that the emit process was skipped(Result of `temp.getEmitSkipped()` was true). How can I solve this problem?

And I found `LanguageService` in ts has `forceDtsEmit` options for `getEmitOutput`, can I use it?

https://github.com/microsoft/TypeScript/blob/8e5e2e08ead119910d6eb177eab9beb84e3ab311/src/services/types.ts#L551

Contributor guide

Open the contributing guide

Research direction

Start with the service.getEmitOutput call, temp.getEmitSkipped(), and the TypeScript LanguageService getEmitOutput declaration linked in the issue. Reproduce a second emit after modifying a project source file, then trace the ts-morph entry point to determine whether the forceDtsEmit option is supported. Done means the supported way to obtain refreshed output is established and covered by an appropriate test or documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.