Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide an example of the watcher API #169

Merged
merged 2 commits into from
May 16, 2018
Merged

Conversation

DanielRosenwasser
Copy link
Member

@mhegazy @sheetalkamat can you review this?


TypeScript 2.7 introduces a new API for creating "watcher" programs that provide set of APIs that are smart enough to cache errors and emit on modules from previous compilations if they or their dependencies haven't been updated in a cascading manner.

This API is used internally in the compiler to implement its `--watch` mode, but can also be leveraged by other tools.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should also add a note about the builder API.

* This is mainly for messages like "Starting compilation" or "Compilation completed".
*/
function reportWatchStatusChanged(diagnostic: ts.Diagnostic) {
console.info(ts.formatDiagnostic(diagnostic, formatHost));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically you dont want to write this as diagnostic right? (eg. formatted as TS xxxx: Message
You would just want to write Text through ts.flattenDiagnosticMessageText(diagnostic.messageText, newLine)

@DanielRosenwasser
Copy link
Member Author

I'm going to merge this in, but please feel free to send any corrections upstream or give me a heads up on inaccuracies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants