any TypeScript wizzes here? how do I get this to s...
# general
s
the
declare
didn’t work either
t
It's expecting an instance of ClassError vs the ClassError class
er CustomError
s
yeah I’m not sure how to annotate the function if it’s returning the class itself
oh geez.
typeof CustomError
worked
that plus the declaration
that actually was not difficult 😄 I just kept trying the wrong things
o
if you leave out the type declaration, doesn’t it automatically infer the type?
t
You also don't have to define a return type, best practice is to let inference handle it
s
my TS is set to bug me if I don’t declare return types. that’s the
@typescript-eslint/recommended
plugin
t
Also this is the type for a class definition
{ new(): MyClass }
It can make sense to define return types in some places if you want it to help you define boundaries
s
yeah