tsdjs / tsd

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

fix(`cli`): print number of warnings #184

Closed tommy-mitchell closed 1 year ago

tommy-mitchell commented 1 year ago

Might resolve #166.

Changes the formatter to report the number of warnings and changes the CLI to exit successfully if only warnings are reported:

image

I want some feedback as well - should printType support printing generic arguments? I.e:

// assert.ts
export const printType = <T>(expression?: any) => {};

// index.test-d.ts
import {printType} from 'tsd';

type Severity = 'error' | 'warning';
printType<Severity>();
//=> 'Type for expression *Severity* is: *'error' | 'warning'*'

My only thought is that printType should only print either the generic or the expression, but not both.

This PR is dependent on #182.

tommy-mitchell commented 1 year ago

I want some feedback as well - should printType support printing generic arguments?

On second thought, I’d rather explore this further (and other changes to assert.ts) in another PR.