Skip to content

Provide an example of the watcher API - #169

Merged
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
masterfrom
builderSample
May 16, 2018
Merged

Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
masterfrom
builderSample

Conversation

@DanielRosenwasser

Copy link
Copy Markdown
Member

Comment thread Using-the-Compiler-API.md Outdated

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
Copy Markdown
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.

Comment thread Using-the-Compiler-API.md
* This is mainly for messages like "Starting compilation" or "Compilation completed".
*/
function reportWatchStatusChanged(diagnostic: ts.Diagnostic) {
console.info(ts.formatDiagnostic(diagnostic, formatHost));

Copy link
Copy Markdown
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
Copy Markdown
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