类:TypeError
【Class: TypeError】
表示提供的参数类型不允许。例如,将一个函数传递给期望字符串的参数就会导致 TypeError(类型错误)。
【Indicates that a provided argument is not an allowable type. For example,
passing a function to a parameter which expects a string would be a TypeError.】
require('node:url').parse(() => { });
// Throws TypeError, since it expected a string. Node.js 会立即生成并抛出 TypeError 实例,作为一种参数验证的形式。
【Node.js will generate and throw TypeError instances immediately as a form
of argument validation.】