Message from JavaScript discussions

October 2020

— Yeah

— 

I still need to guess if it is typeof or not. Usually if it doesn't work without typeof, it works with typeof

— Create a class extending from Error ?

— Not a TS guy so I might be telling non-sense

— No no, I am doing dependency injection and I need to pass the type of a throwable

— Ah

— `let isError = function(e){
return e && e.stack && e.message;
}`

— If it walks like a duck, it's a lion

— But it's a completely generic error or what?

— No it is a custom error

— There is an interface ErrorConstructor too

— 

interface ErrorConstructor {
new(message?: string): Error;
(message?: string): Error;
readonly prototype: Error;
}

Message permanent page