type CUSTOM_REQUEST = {
someProp: "someValue"
}
const foo = (req: CUSTOM_REQUEST, err: unknown) => {
console.log(req);
console.log(err);
};
const someFunction = (req: CUSTOM_REQUEST) => {
try {
console.log("ON TRY");
}
catch(err) {
foo(req,err); // THIS IS OK
foo(err,req); // !!! THIS SHOULD NOT BE OK !!!
}
};
The 2nd call of foo() has got the parameters reversed. And no type errors are being shown.
Second argumennt should be unknown and req: CUSTOM_REQUEST is being passed. That's ok.
But first argument should be req: CUSTOM_REQUEST and err:any is being passed. That should trigger an error, right?
How can I make sure Typescript alert me of this error?
