-
Notifications
You must be signed in to change notification settings - Fork 11
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
Investigate TypeScript builder program API #98
Comments
As the name does imply, |
I have some experimental code in place for this but will not pursue it further for now: https://github.com/Siteimprove/alfa/tree/builder-api |
Our current use of the TypeScript language service API in which individual source files are diagnosed and emitted has at least the following drawbacks:
While diagnostics for source files that are not our own are actually collected, we never show these anywhere. Only recently have we introduced support for traversing source file dependencies (7c94bb0) such that we could improve upon this, but the next point will outline the problems with this as well.
While we can traverse source file dependencies by resolving imports, the TypeScript module resolver resolves imports from packages to their entry point defined in
package.json
, which is how things should work. What we're interested in, however, is which actual source files a given source file depends on and not necessarily which source files it imports.In effect, directly running the TypeScript compiler can yield different results than when we compile the project using the language service API.
By using the builder program API introduced in TypeScript 2.7, we should be able to fix the drawbacks of our current approach. Specifically, the builder program API includes functionally for getting all dependencies of a file (https://github.com/Microsoft/TypeScript/blob/b7d7d5f7b39a5b9619c77590e5fe7f434ed68f1e/src/compiler/builder.ts#L651) in addition to providing incremental diagnostics for an entire program (https://github.com/Microsoft/TypeScript/blob/b7d7d5f7b39a5b9619c77590e5fe7f434ed68f1e/src/compiler/builder.ts#L660). How far these APIs will take us remains to be seen though.
The text was updated successfully, but these errors were encountered: