Repository navigation
support for traceResolution #1128
Description
Activity
Can this flag be specified in a tsconfig file?
Hi, @cspotcode It can, but
ts-nodeis not respecting/recognizing it.Reacted by Glenn 'devalias' Grant- addedyou can do thisGood candidate for a pull request.Good candidate for a pull request.
on Nov 12, 2020 This ticket is marked "help wanted" to indicate that we will accept a pull request implementing this feature. To help you get started, here is some information about how
traceResolutionworks internally:TypeScript communicates with your host environment through a
Host. This Host implements filesystem access and other input-output functions. There is atracefunction on the host. If implemented, TypeScript is able to output tracing information by calling this function. ts-node does not currently provide an implementation of thetracefunction.So to add support for
traceoutput, you'll need to add an implementation of thetracefunction, ensuring we pass it via both theLanguageServiceandCompilerHostcodepaths. Should be simple enough:console.log.bind(console)We'll also need a test case. Probably you can take one of our existing tests, add traceResolution to its tsconfig, and then use a regexp to verify that the stdout includes tracing messages.
So to add support for
traceoutput, you'll need to add an implementation of thetracefunction, ensuring we pass it via both theLanguageServiceandCompilerHostcodepaths. Should be simple enough:console.log.bind(console)Thanks @cspotcode, could you provide the references in the
ts-nodecodebase, please?Here is where we create the
LanguageServiceHost: https://github.com/TypeStrong/ts-node/blob/master/src/index.ts#L652
Here is where we create theCompilerHost: https://github.com/TypeStrong/ts-node/blob/master/src/index.ts#L790TypeScript uses the "host" we give it for all interaction with the host environment, so as long as these hosts have a
traceimplementation, TypeScript should be able to log tracing messages.We'll need tests to verify that it works before we can merge.
Thanks!
- added a commit that references this issue
on Feb 16, 2022
Desired Behavior
Would be great if
ts-nodewould support tsconfig'straceResolutionand provide resolution repportIs this request related to a problem?
Kind of: I cannot trace and debug the mapping and resolution problems