Skip to content

isAggregateError

The isAggregateError function checks if a value is an instance of AggregateError.

Syntax

typescript
isAggregateError(value: any): value is AggregateError;

Parameters

NameTypeDescription
valueanyThe value to check

Returns

TypeDescription
booleantrue if the value is an instance of AggregateError, false otherwise

Examples

typescript
isAggregateError(new AggregateError([]));
// => true

isAggregateError(new Error());
// => false

isAggregateError({});
// => false

Notes

  • The check only returns true if AggregateError is available in the environment and the value is an instance of this class.
  • Useful for identifying aggregate errors in compatible environments.

References

Released under the MIT License.