1# TypeError 2 3The `Napi::TypeError` class is a representation of the JavaScript `TypeError` that is 4thrown when an operand or argument passed to a function is incompatible with the 5type expected by the operator or function. 6 7The `Napi::TypeError` class inherits its behaviors from the `Napi::Error` class (for more info 8see: [`Napi::Error`](error.md)). 9 10For more details about error handling refer to the section titled [Error handling](error_handling.md). 11 12## Methods 13 14### New 15 16Creates a new instance of the `Napi::TypeError` object. 17 18```cpp 19Napi::TypeError::New(Napi::Env env, const char* message); 20``` 21 22- `[in] Env`: The environment in which to construct the `Napi::TypeError` object. 23- `[in] message`: Null-terminated string to be used as the message for the `Napi::TypeError`. 24 25Returns an instance of a `Napi::TypeError` object. 26 27### New 28 29Creates a new instance of a `Napi::TypeError` object. 30 31```cpp 32Napi::TypeError::New(Napi::Env env, const std::string& message); 33``` 34 35- `[in] Env`: The environment in which to construct the `Napi::TypeError` object. 36- `[in] message`: Reference string to be used as the message for the `Napi::TypeError`. 37 38Returns an instance of a `Napi::TypeError` object. 39 40### Constructor 41 42Creates a new empty instance of a `Napi::TypeError`. 43 44```cpp 45Napi::TypeError::TypeError(); 46``` 47 48### Constructor 49 50Initializes a `Napi::TypeError` instance from an existing JavaScript error object. 51 52```cpp 53Napi::TypeError::TypeError(napi_env env, napi_value value); 54``` 55 56- `[in] Env`: The environment in which to construct the `Napi::TypeError` object. 57- `[in] value`: The `Napi::Error` reference to wrap. 58 59Returns an instance of a `Napi::TypeError` object. 60