tsdjs / tsd

Check TypeScript type definitions
MIT License
2.38k stars 68 forks source link

Export formatter #147

Closed RebeccaStevens closed 1 year ago

RebeccaStevens commented 2 years ago

Could you export the formatter so that when running programmatically, we can generate the same formatting output?

tommy-mitchell commented 1 year ago

The formatter is just a wrapper around eslint-formatter-pretty:

https://github.com/SamVerschueren/tsd/blob/fc516e18fd52ba2387f791c38e302e351703d944/source/lib/formatter.ts#L17-L39

This function is called with all of the diagnostics and then just uses the mentioned formatter as output. You can replicate it if needed.

I think unless #75 or something similar lands, it doesn’t make sense to output the formatted diagnostics when using tsd programmatically (since that would be a breaking change).

tommy-mitchell commented 1 year ago

I think unless #75 or something similar lands, it doesn’t make sense to output the formatted diagnostics when using tsd programmatically (since that would be a breaking change).

Ignore me, I misunderstood the request. You just wanted a way to access the formatter in addition to the diagnostics, correct?