Skip to content

Commit 0f09ef3

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 7bc5ac7 commit 0f09ef3

10 files changed

+670
-993
lines changed

src/jsutils/Maybe.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1+
<<<<<<< HEAD
12
/** Conveniently represents flow's "Maybe" type https://flow.org/en/docs/types/maybe/ */
3+
=======
4+
// Conveniently represents flow's "Maybe" type https://flow.org/en/docs/types/maybe/
5+
>>>>>>> Migrate to TS: rename `.js` to `.ts` and fix everything in latter PRs (#3088)
26
export type Maybe<T> = null | undefined | T;

src/jsutils/ObjMap.js

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

src/jsutils/ObjMap.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<<<<<<< HEAD
12
export interface ObjMap<T> {
23
[key: string]: T;
34
}
@@ -11,3 +12,12 @@ export interface ReadOnlyObjMap<T> {
1112
export type ReadOnlyObjMapLike<T> =
1213
| ReadOnlyObjMap<T>
1314
| { readonly [key: string]: T };
15+
=======
16+
export type ObjMap<T> = { [key: string]: T; __proto__: null; ... };
17+
export type ObjMapLike<T> = ObjMap<T> | { [key: string]: T; ... };
18+
19+
export type ReadOnlyObjMap<T> = { +[key: string]: T; __proto__: null; ... };
20+
export type ReadOnlyObjMapLike<T> =
21+
| ReadOnlyObjMap<T>
22+
| { +[key: string]: T; ... };
23+
>>>>>>> Migrate to TS: rename `.js` to `.ts` and fix everything in latter PRs (#3088)

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)