tsdjs / tsd

Check TypeScript type definitions
MIT License
2.4k stars 67 forks source link

Allow `expectError` assertions to detect `Expected at least arguments` error #126

Closed mrazauskas closed 3 years ago

mrazauskas commented 3 years ago

Currently expectError does not silence "Expected at least {0} arguments, but got {1}. ts(2555)" error (similar 2554 is silenced). For example:

// declaration
export function atLeastOne(...expected: [unknown, ...Array<unknown>]): void;

//test
expectError(atLeastOne())

Will fail with:

✖  4:0   Expected an error, but found none.         
✖  4:21  Expected at least 1 arguments, but got 0.  

This PR is adding 2555 to the list of silence errors. With this patch, the test above will pass.