Skip to content

Commit

Permalink
feat: typescript typings (#9)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
n1ru4l authored Nov 9, 2020
1 parent 9865b2c commit dfa54d0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "2.1.0",
"description": "Cross browser function to fetch and parse streaming multipart graphql responses.",
"main": "dist/index.js",
"types": "./typings.d.ts",
"repository": "[email protected]:relay-tools/fetch-multipart-graphql.git",
"author": "Rob Richard <[email protected]>",
"license": "MIT",
Expand Down
22 changes: 22 additions & 0 deletions typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Minimum TypeScript Version: 3.0

declare class PatchResolver<T = unknown> {
constructor(params?: {
onResponse: (result: T[]) => void
boundary?: string;
})
}

declare function MultipartFetchFunction<T = unknown>(url: string, params: {
method?: string;
headers?: Record<string, string>;
credentials?: string;
body?: string;
onNext: (result: T[]) => void;
onError: (error: unknown) => void;
onComplete : () => void
}): void


export { PatchResolver}
export default MultipartFetchFunction

0 comments on commit dfa54d0

Please sign in to comment.