[WIP] support for project references in languageService codepath #1111
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
blocked by merge of #970
Project references are basically an extension to TypeScript's resolver. It will intelligently figure out when you're importing the output of a referenced project, and will internally map to the source .ts file for typechecking. I think if we pair this with the isExternalLibraryImport override in #970, then we can reliably transpile these files.
Internally the compiler monkey-patches CompilerHost so that it "lies" about the filesystem. I'm pretty sure it pretends that the emitted output of project references exists on disk, because this allows the resolver to resolve before compilation is complete. It has an @internal API it uses to expose a reference to this monkey-patched CompilerHost.
Missing is a runtime resolver. If someone imports from a project reference, typechecking might be happy, but node will still complain the file doesn't exist. Should this happen in tsconfig-paths? Should ts-node get into the business of hooking node's resolvers itself? We already rewrite .js to .ts in the ESM resolver.