Skip to content

Commit a26c3f5

Browse files
committed
Remove polyfills for Symbol
1 parent 2300df4 commit a26c3f5

File tree

9 files changed

+16
-47
lines changed

9 files changed

+16
-47
lines changed

src/error/GraphQLError.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// flowlint uninitialized-instance-property:off
33

44
import isObjectLike from '../jsutils/isObjectLike';
5-
import { SYMBOL_TO_STRING_TAG } from '../polyfills/symbols';
65

76
import type { ASTNode } from '../language/ast';
87
import type { Source } from '../language/source';
@@ -213,7 +212,7 @@ export class GraphQLError extends Error {
213212

214213
// FIXME: workaround to not break chai comparisons, should be remove in v16
215214
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
216-
get [SYMBOL_TO_STRING_TAG](): string {
215+
get [Symbol.toStringTag](): string {
217216
return 'Object';
218217
}
219218
}

src/jsutils/isAsyncIterable.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { SYMBOL_ASYNC_ITERATOR } from '../polyfills/symbols';
2-
31
/**
42
* Returns true if the provided object implements the AsyncIterator protocol via
53
* either implementing a `Symbol.asyncIterator` or `"@@asyncIterator"` method.
@@ -13,5 +11,5 @@ export default function isAsyncIterable(maybeAsyncIterable) {
1311
return false;
1412
}
1513

16-
return typeof maybeAsyncIterable[SYMBOL_ASYNC_ITERATOR] === 'function';
14+
return typeof maybeAsyncIterable[Symbol.asyncIterator] === 'function';
1715
}

src/jsutils/isCollection.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { SYMBOL_ITERATOR } from '../polyfills/symbols';
2-
31
/**
42
* Returns true if the provided object is an Object (i.e. not a string literal)
53
* and is either Iterable or Array-like.
@@ -37,5 +35,5 @@ export default function isCollection(obj) {
3735
}
3836

3937
// Is Iterable?
40-
return typeof obj[SYMBOL_ITERATOR] === 'function';
38+
return typeof obj[Symbol.iterator] === 'function';
4139
}

src/language/source.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { SYMBOL_TO_STRING_TAG } from '../polyfills/symbols';
2-
31
import inspect from '../jsutils/inspect';
42
import devAssert from '../jsutils/devAssert';
53
import instanceOf from '../jsutils/instanceOf';
@@ -45,7 +43,7 @@ export class Source {
4543
}
4644

4745
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
48-
get [SYMBOL_TO_STRING_TAG]() {
46+
get [Symbol.toStringTag]() {
4947
return 'Source';
5048
}
5149
}

src/polyfills/symbols.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/subscription/mapAsyncIterator.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { SYMBOL_ASYNC_ITERATOR } from '../polyfills/symbols';
2-
31
import type { PromiseOrValue } from '../jsutils/PromiseOrValue';
42

53
/**
@@ -12,7 +10,7 @@ export default function mapAsyncIterator<T, U>(
1210
rejectCallback?: (any) => PromiseOrValue<U>,
1311
): AsyncGenerator<U, void, void> {
1412
// $FlowFixMe[prop-missing]
15-
const iteratorMethod = iterable[SYMBOL_ASYNC_ITERATOR];
13+
const iteratorMethod = iterable[Symbol.asyncIterator];
1614
const iterator: any = iteratorMethod.call(iterable);
1715
let $return: any;
1816
let abruptClose;
@@ -55,7 +53,7 @@ export default function mapAsyncIterator<T, U>(
5553
}
5654
return Promise.reject(error).catch(abruptClose);
5755
},
58-
[SYMBOL_ASYNC_ITERATOR]() {
56+
[Symbol.asyncIterator]() {
5957
return this;
6058
},
6159
}: $FlowFixMe);

src/type/definition.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import objectEntries from '../polyfills/objectEntries';
2-
import { SYMBOL_TO_STRING_TAG } from '../polyfills/symbols';
32

43
import type { Path } from '../jsutils/Path';
54
import type { PromiseOrValue } from '../jsutils/PromiseOrValue';
@@ -366,7 +365,7 @@ export class GraphQLList<+T: GraphQLType> {
366365
}
367366

368367
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
369-
get [SYMBOL_TO_STRING_TAG]() {
368+
get [Symbol.toStringTag]() {
370369
return 'GraphQLList';
371370
}
372371
}
@@ -415,7 +414,7 @@ export class GraphQLNonNull<+T: GraphQLNullableType> {
415414
}
416415

417416
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
418-
get [SYMBOL_TO_STRING_TAG]() {
417+
get [Symbol.toStringTag]() {
419418
return 'GraphQLNonNull';
420419
}
421420
}
@@ -627,7 +626,7 @@ export class GraphQLScalarType {
627626
}
628627
629628
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
630-
get [SYMBOL_TO_STRING_TAG]() {
629+
get [Symbol.toStringTag]() {
631630
return 'GraphQLScalarType';
632631
}
633632
}
@@ -774,7 +773,7 @@ export class GraphQLObjectType {
774773
}
775774

776775
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
777-
get [SYMBOL_TO_STRING_TAG]() {
776+
get [Symbol.toStringTag]() {
778777
return 'GraphQLObjectType';
779778
}
780779
}
@@ -1094,7 +1093,7 @@ export class GraphQLInterfaceType {
10941093
}
10951094

10961095
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
1097-
get [SYMBOL_TO_STRING_TAG]() {
1096+
get [Symbol.toStringTag]() {
10981097
return 'GraphQLInterfaceType';
10991098
}
11001099
}
@@ -1204,7 +1203,7 @@ export class GraphQLUnionType {
12041203
}
12051204

12061205
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
1207-
get [SYMBOL_TO_STRING_TAG]() {
1206+
get [Symbol.toStringTag]() {
12081207
return 'GraphQLUnionType';
12091208
}
12101209
}
@@ -1385,7 +1384,7 @@ export class GraphQLEnumType /* <T> */ {
13851384
}
13861385

13871386
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
1388-
get [SYMBOL_TO_STRING_TAG]() {
1387+
get [Symbol.toStringTag]() {
13891388
return 'GraphQLEnumType';
13901389
}
13911390
}
@@ -1537,7 +1536,7 @@ export class GraphQLInputObjectType {
15371536
}
15381537

15391538
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
1540-
get [SYMBOL_TO_STRING_TAG]() {
1539+
get [Symbol.toStringTag]() {
15411540
return 'GraphQLInputObjectType';
15421541
}
15431542
}

src/type/directives.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import objectEntries from '../polyfills/objectEntries';
2-
import { SYMBOL_TO_STRING_TAG } from '../polyfills/symbols';
32

43
import type { ReadOnlyObjMap, ReadOnlyObjMapLike } from '../jsutils/ObjMap';
54
import inspect from '../jsutils/inspect';
@@ -105,7 +104,7 @@ export class GraphQLDirective {
105104
}
106105

107106
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
108-
get [SYMBOL_TO_STRING_TAG]() {
107+
get [Symbol.toStringTag]() {
109108
return 'GraphQLDirective';
110109
}
111110
}

src/type/schema.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import objectValues from '../polyfills/objectValues';
2-
import { SYMBOL_TO_STRING_TAG } from '../polyfills/symbols';
32

43
import type {
54
ObjMap,
@@ -346,7 +345,7 @@ export class GraphQLSchema {
346345
}
347346

348347
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
349-
get [SYMBOL_TO_STRING_TAG]() {
348+
get [Symbol.toStringTag]() {
350349
return 'GraphQLSchema';
351350
}
352351
}

0 commit comments

Comments
 (0)