Everything seems to be working fine during development with no warnings or compile errors. However, when running npm build, I encounter the TS2554 error on a constructor stating that it expects 0-1 arguments but is receiving 2.
The constructor is defined as follows: ErrorConstructor
ErrorConstructor
(message?: string | undefined, options?: ErrorOptions | undefined) => Error (+1 overload)
ErrorOptions
interface ErrorOptions {
cause?: unknown;
}
This error occurs because I am passing a cause through the ErrorOptions object, even though no errors are detected during development or compilation.
throw Error('message', {cause: 'cause'})