Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 75ec900

Browse files
committed
Declare SymbolConstructor for older versions of ES
Older versions of the ES standard do not define `Symbol#asyncIterator`. This means our attempts to "manually" define `AsyncIterator` for versions of ES that don't have it fail. Following [1] and [2], our understanding is that the best existing solution is to manually re-define `SymbolConstructor` to have this member. [1]: microsoft/TypeScript#13031 [2]: microsoft/TypeScript#8099
1 parent 58c4156 commit 75ec900

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## v0.3.0
2+
3+
### Improvements
4+
5+
- Re-declare the global `SymbolConstructor` with `asyncIterator`, allowing users targeting ES
6+
versions earlier than the 2018 to use this library.
7+
8+
19
## v0.2.0
210

311
### Improvements

nodejs/query/interfaces.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222

2323
///////////////////////////////////////////////////////////////////////////////
2424

25+
declare global {
26+
export interface SymbolConstructor {
27+
readonly asyncIterator: symbol;
28+
}
29+
}
30+
2531
export interface AsyncIterator<T> {
2632
next(value?: any): Promise<IteratorResult<T>>;
2733
return?(value?: any): Promise<IteratorResult<T>>;

nodejs/query/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
33
"outDir": "bin",
4-
"target": "es5",
4+
"target": "es6",
55
"module": "commonjs",
66
"moduleResolution": "node",
77
"declaration": true,
@@ -14,7 +14,6 @@
1414
"noImplicitReturns": true,
1515
"forceConsistentCasingInFileNames": true,
1616
"strictNullChecks": true,
17-
"downlevelIteration": true,
1817
},
1918
"files": [
2019
"asyncQueryable.ts",

0 commit comments

Comments
 (0)