Skip to content

Commit eb5e1dd

Browse files
FlarnaTrott
authored andcommitted
errors: remove dead code in ERR_INVALID_ARG_TYPE
Remove unreachable code. As expected is converted to an Array the 'not ' check will be never executed. PR-URL: #31322 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent b772b9a commit eb5e1dd

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

lib/internal/errors.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -946,14 +946,7 @@ E('ERR_INVALID_ARG_TYPE',
946946
const type = name.includes('.') ? 'property' : 'argument';
947947
msg += `"${name}" ${type} `;
948948
}
949-
950-
// determiner: 'must be' or 'must not be'
951-
if (typeof expected === 'string' && expected.startsWith('not ')) {
952-
msg += 'must not be ';
953-
expected = expected.replace(/^not /, '');
954-
} else {
955-
msg += 'must be ';
956-
}
949+
msg += 'must be ';
957950

958951
const types = [];
959952
const instances = [];

0 commit comments

Comments
 (0)