During dev there's no warnings or compile errors and eveything works fine but on npm run build I get the error TS2554 on a constructor saying Expected 0 - 1 arguments, but got 2.
The constructor has the following definition: ErrorConstructor
ErrorConstructor
(message?: string | undefined, options?: ErrorOptions | undefined) => Error (+1 overload)
ErrorOptions
interface ErrorOptions {
cause?: unknown;
}
This error happens because I'm passing a cause through the ErrorOptions object and as mentioned above I get no error during dev or compile
throw Error('message', {cause: 'cause'})
Looking at your code I'd assume the code should be like this:
throw new Error('message', { cause: 'cause' });
Classes have to be initialized with the
new
keyword.