-
Notifications
You must be signed in to change notification settings - Fork 314
Add sample for incremental compiling and solution builder #225
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Conversation
57ab2a5
to
d3be118
Compare
4f5cab8
to
a912d4a
Compare
...program.getOptionsDiagnostics(), | ||
...program.getGlobalDiagnostics(), | ||
...program.getSemanticDiagnostics() // Get the diagnostics before emit to cache them in the buildInfo file. | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We not ts.getPreEmitDiagnostics()
instead of duplicating the get___Diagnostics()
calls?
What about ts.sortAndDeduplicateDiagnostics(diagnostics)
?
} | ||
|
||
const program = ts.createIncrementalProgram({ | ||
rootName: config.fileNames, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: this is rootNames
and not rootName
/*optionsToExtend*/ { incremental: true }, | ||
/*host*/ { | ||
...ts.sys, | ||
onUnRecoverableConfigFileDiagnostic: d => console.error(ts.flattenDiagnosticMessageText(d, "\n")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be:
onUnRecoverableConfigFileDiagnostic: d => console.error(ts.flattenDiagnosticMessageText(d.messageText, "\n"));
Now it throws a compile error:
Argument of type 'Diagnostic' is not assignable to parameter of type 'string | DiagnosticMessageChain | undefined'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an invalid semi colon at the end
onUnRecoverableConfigFileDiagnostic: d => console.error(ts.flattenDiagnosticMessageText(d.messageText, "\n"));
c888fbb
to
9927788
Compare
5c070ad
to
fbcbe2a
Compare
hi @sheetalkamat , is it possible to have an example of using |
This PR refers to If possible, it would be great to have an explanation of |
); | ||
|
||
// Builds the solution and watches for changes | ||
solution.clean(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be: solution.build()
This PR is a goldmine - would be great to see it merged now one year after its creation |
@sheetalkamat is there something outdated about this API that is holding up this documentation? |
Fixes microsoft/TypeScript#31849