TypeScript does not treat AggregateErrorConstructor as a subtype of
ErrorConstructor, which makes sense because their constructors
have incompatible signatures. However, we want to parameterize some
operations by any error constructor, including possible AggregateError.
So we introduce GenericErrorConstructor as a common supertype. Any call
to it to make an instance must therefore first case split on whether the
constructor is an AggregateErrorConstructor or a normal ErrorConstructor.
TypeScript does not treat
AggregateErrorConstructor
as a subtype ofErrorConstructor
, which makes sense because their constructors have incompatible signatures. However, we want to parameterize some operations by any error constructor, including possibleAggregateError
. So we introduceGenericErrorConstructor
as a common supertype. Any call to it to make an instance must therefore first case split on whether the constructor is an AggregateErrorConstructor or a normal ErrorConstructor.