You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 traceResolution works internally:
TypeScript communicates with your host environment through a Host. This Host implements filesystem access and other input-output functions. There is a trace function 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 the trace function.
So to add support for trace output, you'll need to add an implementation of the trace function, ensuring we pass it via both the LanguageService and CompilerHost codepaths. 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 trace output, you'll need to add an implementation of the trace function, ensuring we pass it via both the LanguageService and CompilerHost codepaths. Should be simple enough: console.log.bind(console)
Thanks @cspotcode, could you provide the references in the ts-node codebase, please?
TypeScript uses the "host" we give it for all interaction with the host environment, so as long as these hosts have a trace implementation, TypeScript should be able to log tracing messages.
We'll need tests to verify that it works before we can merge.
Activity
cspotcode commentedon Oct 11, 2020
Can this flag be specified in a tsconfig file?
mprinc commentedon Oct 11, 2020
Hi, @cspotcode It can, but
ts-nodeis not respecting/recognizing it.cspotcode commentedon Nov 21, 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.
mprinc commentedon Nov 25, 2020
Thanks @cspotcode, could you provide the references in the
ts-nodecodebase, please?cspotcode commentedon Nov 25, 2020
Here is where we create the
LanguageServiceHost: https://github.com/TypeStrong/ts-node/blob/master/src/index.ts#L652Here is where we create the
CompilerHost: 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!
Update dependency ts-node to v10.5.0 (#1156)