Skip to content

Commit 2b9dbaf

Browse files
TS: sync up TS typings with Flow typings (#370)
1 parent ffc7d38 commit 2b9dbaf

File tree

4 files changed

+15
-26
lines changed

4 files changed

+15
-26
lines changed

src/connection/connection.d.ts

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,35 @@
11
import type {
22
GraphQLNonNull,
3-
GraphQLNamedOutputType,
4-
GraphQLScalarType,
53
GraphQLObjectType,
4+
GraphQLNamedOutputType,
65
GraphQLFieldConfigArgumentMap,
76
GraphQLFieldConfigMap,
87
GraphQLFieldResolver,
98
Thunk,
109
} from 'graphql';
1110

12-
interface ForwardConnectionArgs {
13-
after: { type: GraphQLScalarType };
14-
first: { type: GraphQLScalarType };
15-
}
16-
1711
/**
1812
* Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field
1913
* whose return type is a connection type with forward pagination.
2014
*/
21-
export const forwardConnectionArgs: GraphQLFieldConfigArgumentMap &
22-
ForwardConnectionArgs;
23-
24-
interface BackwardConnectionArgs {
25-
before: { type: GraphQLScalarType };
26-
last: { type: GraphQLScalarType };
27-
}
15+
export declare const forwardConnectionArgs: GraphQLFieldConfigArgumentMap;
2816

2917
/**
3018
* Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field
3119
* whose return type is a connection type with backward pagination.
3220
*/
33-
export const backwardConnectionArgs: GraphQLFieldConfigArgumentMap &
34-
BackwardConnectionArgs;
21+
export declare const backwardConnectionArgs: GraphQLFieldConfigArgumentMap;
3522

3623
/**
3724
* Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field
3825
* whose return type is a connection type with bidirectional pagination.
3926
*/
40-
export const connectionArgs: GraphQLFieldConfigArgumentMap &
41-
ForwardConnectionArgs &
42-
BackwardConnectionArgs;
27+
export declare const connectionArgs: GraphQLFieldConfigArgumentMap;
4328

4429
/**
4530
* A type alias for cursors in this implementation.
4631
*/
47-
export type ConnectionCursor = string;
32+
export declare type ConnectionCursor = string;
4833

4934
/**
5035
* A type describing the arguments a connection field receives in GraphQL.

src/mutation/mutation.d.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import type {
77
Thunk,
88
} from 'graphql';
99

10-
type MutationFn = (object: any, ctx: any, info: GraphQLResolveInfo) => unknown;
10+
declare type MutationFn = (
11+
object: any,
12+
ctx: any,
13+
info: GraphQLResolveInfo,
14+
) => unknown;
1115

1216
/**
1317
* A description of a mutation consumable by mutationWithClientMutationId
@@ -39,4 +43,4 @@ interface MutationConfig {
3943
*/
4044
export declare function mutationWithClientMutationId(
4145
config: MutationConfig,
42-
): GraphQLFieldConfig<any, any>;
46+
): GraphQLFieldConfig<unknown, unknown>;

src/node/node.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import type {
77

88
interface GraphQLNodeDefinitions<TContext> {
99
nodeInterface: GraphQLInterfaceType;
10-
nodeField: GraphQLFieldConfig<any, TContext>;
11-
nodesField: GraphQLFieldConfig<any, TContext>;
10+
nodeField: GraphQLFieldConfig<unknown, TContext>;
11+
nodesField: GraphQLFieldConfig<unknown, TContext>;
1212
}
1313

1414
/**
@@ -39,7 +39,7 @@ interface ResolvedGlobalId {
3939
* Takes a type name and an ID specific to that type name, and returns a
4040
* "global ID" that is unique among all types.
4141
*/
42-
export declare function toGlobalId(type: string | number, id: string): string;
42+
export declare function toGlobalId(type: string, id: string | number): string;
4343

4444
/**
4545
* Takes the "global ID" created by toGlobalID, and returns the type name and ID

src/node/plural.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ interface PluralIdentifyingRootFieldConfig {
1919

2020
export declare function pluralIdentifyingRootField(
2121
config: PluralIdentifyingRootFieldConfig,
22-
): GraphQLFieldConfig<any, any>;
22+
): GraphQLFieldConfig<unknown, unknown>;

0 commit comments

Comments
 (0)