cevek / ttypescript

Over TypeScript tool to use custom transformers in the tsconfig.json
1.53k stars 56 forks source link

addDiagnostic is unavaliable #117

Open kainstar opened 3 years ago

kainstar commented 3 years ago

Hello, I'm writing a transformer which could transform some restricted types to runtime code, and when someone write some type unsupported, I want to show a typescript diagnostic.

I found the addDiagnostic method created by addDiagnosticFactory and try use it, but it did not work. https://github.com/cevek/ttypescript/blob/505e3aa95e26b90dd30efa2d2d6612a6882a2baa/packages/ttypescript/src/PluginCreator.ts#L100-L102

Then I found the commented code: https://github.com/cevek/ttypescript/blob/505e3aa95e26b90dd30efa2d2d6612a6882a2baa/packages/ttypescript/src/patchCreateProgram.ts#L97-L98

What typescript 3.7 done to make you have to disable the addDiagnostic? And could you uncomment these code and make addDiagnostic avaliable now?

nonara commented 3 years ago

If it helps, ts-patch supports diagnostics manipulation.

kainstar commented 3 years ago

Thanks, I will try it.