ts-node icon indicating copy to clipboard operation
ts-node copied to clipboard

[WIP] support for project references in languageService codepath

Open cspotcode opened this issue 5 years ago • 0 comments

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.

cspotcode avatar Aug 12 '20 04:08 cspotcode