Skip to content

Generating and working "index" interfaces: Is a program transformer what I need? #124

Answered by nonara
AlCalzone asked this question in Q&A
Discussion options

You must be logged in to vote

Hello! Sorry for the delay.

It sounds like a Program Transformer could help. A program transformer is essentially middleware for createProgram. You can use this to intercept the tsc process and have it perform any number of steps before returning a Program instance.

One of the main reasons to use one is if you want to generate code that gets automatically added to the Program if it isn't already built. I've done this in many instances. We actually use that for ts-patch itself, also.

Here's an example:

https://github.com/nonara/ts-patch/blob/master/projects/patch/plugin.ts

As for a language service plugin, I don't see a reason why you would need one, but I may not know the full scope of wh…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nonara
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants