Skip to content

Commit dfa54d0

Browse files
authored
feat: typescript typings (#9)
* add graphqlas a dev dependency and peer dependency for having the TypeScript typings available. * add typescript typings for the exported modules. * feat: Remove the graphql-js dependency and use generics instead.
1 parent 9865b2c commit dfa54d0

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "2.1.0",
44
"description": "Cross browser function to fetch and parse streaming multipart graphql responses.",
55
"main": "dist/index.js",
6+
"types": "./typings.d.ts",
67
"repository": "[email protected]:relay-tools/fetch-multipart-graphql.git",
78
"author": "Rob Richard <[email protected]>",
89
"license": "MIT",

typings.d.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Minimum TypeScript Version: 3.0
2+
3+
declare class PatchResolver<T = unknown> {
4+
constructor(params?: {
5+
onResponse: (result: T[]) => void
6+
boundary?: string;
7+
})
8+
}
9+
10+
declare function MultipartFetchFunction<T = unknown>(url: string, params: {
11+
method?: string;
12+
headers?: Record<string, string>;
13+
credentials?: string;
14+
body?: string;
15+
onNext: (result: T[]) => void;
16+
onError: (error: unknown) => void;
17+
onComplete : () => void
18+
}): void
19+
20+
21+
export { PatchResolver}
22+
export default MultipartFetchFunction

0 commit comments

Comments
 (0)