Skip to content

Commit 0483004

Browse files
committedAug 4, 2021
fix(utils): support old TypeScript versions
1 parent bd31967 commit 0483004

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed
 

‎.changeset/old-forks-think.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-tools/utils': patch
3+
---
4+
5+
fix(utils): support old TypeScript versions

‎packages/utils/src/AggregateError.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1-
/// <reference lib="es2021.promise" />
2-
let AggregateErrorImpl = globalThis.AggregateError;
1+
// Backwards compability for old versions of TypeScript
2+
interface AggregateError extends Error {
3+
errors: any[];
4+
}
5+
6+
interface AggregateErrorConstructor {
7+
new (errors: Iterable<any>, message?: string): AggregateError;
8+
(errors: Iterable<any>, message?: string): AggregateError;
9+
readonly prototype: AggregateError;
10+
}
11+
12+
let AggregateErrorImpl: AggregateErrorConstructor = globalThis.AggregateError;
313

414
if (typeof AggregateErrorImpl === 'undefined') {
515
class AggregateErrorClass extends Error implements AggregateError {

0 commit comments

Comments
 (0)