Skip to content

Commit ffc7d38

Browse files
TS: add 'declare' to function typings (#369)
1 parent 285cb2d commit ffc7d38

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

src/connection/arrayConnection.d.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface ArraySliceMetaInfo {
1414
* a connection object for use in GraphQL. It uses array offsets as pagination,
1515
* so pagination will only work if the array is static.
1616
*/
17-
export function connectionFromArray<T>(
17+
export declare function connectionFromArray<T>(
1818
data: ReadonlyArray<T>,
1919
args: ConnectionArguments,
2020
): Connection<T>;
@@ -23,7 +23,7 @@ export function connectionFromArray<T>(
2323
* A version of `connectionFromArray` that takes a promised array, and returns a
2424
* promised connection.
2525
*/
26-
export function connectionFromPromisedArray<T>(
26+
export declare function connectionFromPromisedArray<T>(
2727
dataPromise: Promise<ReadonlyArray<T>>,
2828
args: ConnectionArguments,
2929
): Promise<Connection<T>>;
@@ -37,7 +37,7 @@ export function connectionFromPromisedArray<T>(
3737
* to materialize the entire array, and instead wish pass in a slice of the
3838
* total result large enough to cover the range specified in `args`.
3939
*/
40-
export function connectionFromArraySlice<T>(
40+
export declare function connectionFromArraySlice<T>(
4141
arraySlice: ReadonlyArray<T>,
4242
args: ConnectionArguments,
4343
meta: ArraySliceMetaInfo,
@@ -47,7 +47,7 @@ export function connectionFromArraySlice<T>(
4747
* A version of `connectionFromArraySlice` that takes a promised array slice,
4848
* and returns a promised connection.
4949
*/
50-
export function connectionFromPromisedArraySlice<T>(
50+
export declare function connectionFromPromisedArraySlice<T>(
5151
dataPromise: Promise<ReadonlyArray<T>>,
5252
args: ConnectionArguments,
5353
arrayInfo: ArraySliceMetaInfo,
@@ -56,17 +56,17 @@ export function connectionFromPromisedArraySlice<T>(
5656
/**
5757
* Creates the cursor string from an offset.
5858
*/
59-
export function offsetToCursor(offset: number): ConnectionCursor;
59+
export declare function offsetToCursor(offset: number): ConnectionCursor;
6060

6161
/**
6262
* Extracts the offset from the cursor string.
6363
*/
64-
export function cursorToOffset(cursor: ConnectionCursor): number;
64+
export declare function cursorToOffset(cursor: ConnectionCursor): number;
6565

6666
/**
6767
* Return the cursor associated with an object in an array.
6868
*/
69-
export function cursorForObjectInConnection<T>(
69+
export declare function cursorForObjectInConnection<T>(
7070
data: ReadonlyArray<T>,
7171
object: T,
7272
): ConnectionCursor | null;
@@ -76,7 +76,7 @@ export function cursorForObjectInConnection<T>(
7676
* to use; if the cursor contains a valid offset, that will be used,
7777
* otherwise it will be the default.
7878
*/
79-
export function getOffsetWithDefault(
79+
export declare function getOffsetWithDefault(
8080
cursor: ConnectionCursor | null | undefined,
8181
defaultOffset: number,
8282
): number;

src/connection/connection.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export interface GraphQLConnectionDefinitions {
7474
* Returns a GraphQLObjectType for a connection with the given name,
7575
* and whose nodes are of the specified type.
7676
*/
77-
export function connectionDefinitions(
77+
export declare function connectionDefinitions(
7878
config: ConnectionConfig,
7979
): GraphQLConnectionDefinitions;
8080

src/mutation/mutation.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ interface MutationConfig {
3737
* Returns a GraphQLFieldConfig for the mutation described by the
3838
* provided MutationConfig.
3939
*/
40-
export function mutationWithClientMutationId(
40+
export declare function mutationWithClientMutationId(
4141
config: MutationConfig,
4242
): GraphQLFieldConfig<any, any>;

src/node/node.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ interface GraphQLNodeDefinitions<TContext> {
2121
* handled with the `isTypeOf` method on object types, as with any GraphQL
2222
* interface without a provided `resolveType` method.
2323
*/
24-
export function nodeDefinitions<TContext>(
24+
export declare function nodeDefinitions<TContext>(
2525
fetchById: (
2626
id: string,
2727
context: TContext,
@@ -39,21 +39,21 @@ 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 function toGlobalId(type: string | number, id: string): string;
42+
export declare function toGlobalId(type: string | number, id: string): string;
4343

4444
/**
4545
* Takes the "global ID" created by toGlobalID, and returns the type name and ID
4646
* used to create it.
4747
*/
48-
export function fromGlobalId(globalId: string): ResolvedGlobalId;
48+
export declare function fromGlobalId(globalId: string): ResolvedGlobalId;
4949

5050
/**
5151
* Creates the configuration for an id field on a node, using `toGlobalId` to
5252
* construct the ID from the provided typename. The type-specific ID is fetched
5353
* by calling idFetcher on the object, or if not provided, by accessing the `id`
5454
* property on the object.
5555
*/
56-
export function globalIdField<TContext>(
56+
export declare function globalIdField<TContext>(
5757
typeName?: string,
5858
idFetcher?: (
5959
obj: any,

src/node/plural.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ interface PluralIdentifyingRootFieldConfig {
1717
description?: string;
1818
}
1919

20-
export function pluralIdentifyingRootField(
20+
export declare function pluralIdentifyingRootField(
2121
config: PluralIdentifyingRootFieldConfig,
2222
): GraphQLFieldConfig<any, any>;

0 commit comments

Comments
 (0)