On this page

    C

    TypeError

    History
    class TypeError extends errors.Error

    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 will generate and throw TypeError instances immediately as a form of argument validation.