ttypescript does not patch createWatchProgram
mrmeku opened this issue · comments
Currently ttypescript patches createProgram
but does not patch createWatchProgram
or createIncrementalProgram
. As a result, transformations do not occur when calling those two APIs which is unexpected
Working on this in ts-patch
now - nonara/ts-patch#35
I looked into this a bit. I'm not sure I see how this wouldn't work.
But, if it isn't working, I believe I found the solution.
For createIncrementalProgram
, look at the signature and you will see that it takes a createProgram
function as an argument. Pass ts.createProgram
to it (where ts
is your patched typescript instance) and it should work.
For createWatchProgram
you also need to pass it a WatchCompilerHost
, which is created using createWatchCompilerHost
. In that case, check the signature for createWatchCompilerHost
and you will see a parameter which takes a createProgram
function. Follow the same procedure for that, and it should work.
If it isn't working, create a reproduction using ts-patch
, and I'll have a look!