nonara / ts-patch

Augment the TypeScript compiler to support extended functionality
MIT License
764 stars 26 forks source link

When `"composite": true` specified in `tsconfig.json`, `extras.diagnostics` becomes an empty array #171

Open pucelle opened 3 weeks ago

pucelle commented 3 weeks ago

I don't know if this is an issue. I can get all the extras.diagnostics after changes composite to false.

In addition, I noticed when work with ts-loader, extras.diagnostics becomes empty too, while using tspc command is OK.

I also find when work with tspc -w, same issue happens.

pucelle commented 5 days ago

I have found the reason of this issue:

The patch of watch.ts, function

function emitFilesAndReportErrors<T extends BuilderProgram>(program: Program | T, ...)

When compile with tspc directly, program parameter is Program type, but when compile with tspc -w, program parameter is BuilderProgram type.

I can confirm to fix this issue by patching with tsp.diagnosticMap.set(program.getProgram ? program.getProgram() : program, allDiagnostics), but since I'm not familiar with typescript source codes, I would not give a pull request.