ttypescript icon indicating copy to clipboard operation
ttypescript copied to clipboard

addDiagnostic is unavaliable

Open kainstar opened this issue 3 years ago • 2 comments

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?

kainstar avatar Apr 23 '21 02:04 kainstar

If it helps, ts-patch supports diagnostics manipulation.

nonara avatar Apr 23 '21 02:04 nonara

Thanks, I will try it.

kainstar avatar Apr 23 '21 06:04 kainstar