Skip to content

Commit 39825ee

Browse files
saihajtwof
authored andcommitted
Migrate to TS: rename .js to .ts and fix everything in latter PRs (graphql#3088)
using this `find src -name "*.js" -exec sh -c 'git mv "$0" "${0%.js}.ts"' {} \;` shell command renamed all files in `src`
1 parent 2fa47ec commit 39825ee

File tree

6 files changed

+13
-993
lines changed

6 files changed

+13
-993
lines changed

src/jsutils/ObjMap.js

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

src/jsutils/PromiseOrValue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export type PromiseOrValue<T> = Promise<T> | T;
1+
export type PromiseOrValue<+T> = Promise<T> | T;

src/jsutils/isAsyncIterable.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
* Returns true if the provided object implements the AsyncIterator protocol via
33
* implementing a `Symbol.asyncIterator` method.
44
*/
5-
export function isAsyncIterable(
6-
maybeAsyncIterable: any,
7-
): maybeAsyncIterable is AsyncIterable<unknown> {
5+
declare function isAsyncIterable(
6+
value: mixed,
7+
// $FlowFixMe[invalid-in-rhs]
8+
): boolean %checks(value instanceof AsyncIterable);
9+
10+
// eslint-disable-next-line no-redeclare
11+
export function isAsyncIterable(maybeAsyncIterable) {
812
return typeof maybeAsyncIterable?.[Symbol.asyncIterator] === 'function';
913
}

src/jsutils/isPromise.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
* Returns true if the value acts like a Promise, i.e. has a "then" function,
33
* otherwise returns false.
44
*/
5-
export function isPromise(value: any): value is Promise<unknown> {
5+
declare function isPromise(value: mixed): boolean %checks(value instanceof
6+
Promise);
7+
8+
// eslint-disable-next-line no-redeclare
9+
export function isPromise(value) {
610
return typeof value?.then === 'function';
711
}

0 commit comments

Comments
 (0)