sindresorhus / is

Type check values
MIT License
1.68k stars 109 forks source link

Inaccurate exception text #134

Closed fredkilbourn closed 3 years ago

fredkilbourn commented 3 years ago

Quick snippet:

const reason = 1000;
assert.any( [ is.undefined, is.nonEmptyString ], reason );

Error states something about truthy values and array type which are both completely unrelated to the assert types and variable type

TypeError: Expected value which is `predicate returns truthy for any value`, received value of type `Array`.
    at assertType (/home/vbot/srv/vbot/node_modules/@sindresorhus/is/dist/index.js:287:15)
    at Object.any (/home/vbot/srv/vbot/node_modules/@sindresorhus/is/dist/index.js:379:36)
    at file:///home/vbot/srv/vbot/test.js:40:8
sindresorhus commented 3 years ago

Duplicate of #131