From 4a4db6d249d74d16b3eaa711aa2e32b7c93d5e24 Mon Sep 17 00:00:00 2001 From: Edward Sammut Alessi Date: Thu, 12 Jul 2018 19:00:16 +0200 Subject: [PATCH] Typings for apollo-upload-client (#27094) * Typings for apollo-upload-client * Update package.json * Triggering build --- .../apollo-upload-client-tests.ts | 16 +++++++++++++ types/apollo-upload-client/index.d.ts | 16 +++++++++++++ types/apollo-upload-client/package.json | 7 ++++++ types/apollo-upload-client/tsconfig.json | 23 +++++++++++++++++++ types/apollo-upload-client/tslint.json | 1 + 5 files changed, 63 insertions(+) create mode 100644 types/apollo-upload-client/apollo-upload-client-tests.ts create mode 100644 types/apollo-upload-client/index.d.ts create mode 100644 types/apollo-upload-client/package.json create mode 100644 types/apollo-upload-client/tsconfig.json create mode 100644 types/apollo-upload-client/tslint.json diff --git a/types/apollo-upload-client/apollo-upload-client-tests.ts b/types/apollo-upload-client/apollo-upload-client-tests.ts new file mode 100644 index 0000000000..4db60bfaf3 --- /dev/null +++ b/types/apollo-upload-client/apollo-upload-client-tests.ts @@ -0,0 +1,16 @@ +import { createUploadLink, ReactNativeFile } from "apollo-upload-client"; + +new ReactNativeFile({ + name: "its coming home", + type: "its coming", + uri: "football's coming home", +}); + +createUploadLink({ + fetch: (uri, options) => fetch(`http://localhost/${uri}`, options), + fetchOptions: { method: "GET" }, + headers: { special: "Special header value" }, + includeExtensions: true, + uri: "http://localhost", + credentials: "beepboop", +}); diff --git a/types/apollo-upload-client/index.d.ts b/types/apollo-upload-client/index.d.ts new file mode 100644 index 0000000000..7c1e3cb7b6 --- /dev/null +++ b/types/apollo-upload-client/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for apollo-upload-client 8.1 +// Project: https://github.com/jaydenseric/apollo-upload-client#readme +// Definitions by: Edward Sammut Alessi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import { ApolloLink } from "apollo-link"; +import { HttpOptions } from "apollo-link-http-common"; + +export { ReactNativeFile } from "extract-files"; + +/** + * `createUploadLink` options match `createHttpLink` options + * @param linkOptions `HttpOptions` + */ +export function createUploadLink(linkOptions?: HttpOptions): ApolloLink; diff --git a/types/apollo-upload-client/package.json b/types/apollo-upload-client/package.json new file mode 100644 index 0000000000..580aaf19c4 --- /dev/null +++ b/types/apollo-upload-client/package.json @@ -0,0 +1,7 @@ +{ + "private": true, + "dependencies": { + "apollo-link": "^1.0.0", + "apollo-link-http-common": "^0.2.4" + } +} diff --git a/types/apollo-upload-client/tsconfig.json b/types/apollo-upload-client/tsconfig.json new file mode 100644 index 0000000000..2a023ff111 --- /dev/null +++ b/types/apollo-upload-client/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "apollo-upload-client-tests.ts" + ] +} diff --git a/types/apollo-upload-client/tslint.json b/types/apollo-upload-client/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/apollo-upload-client/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }