diff --git a/types/apollo-codegen/apollo-codegen-tests.ts b/types/apollo-codegen/apollo-codegen-tests.ts index 38d9733faf..2c78f26fa9 100644 --- a/types/apollo-codegen/apollo-codegen-tests.ts +++ b/types/apollo-codegen/apollo-codegen-tests.ts @@ -14,7 +14,7 @@ async function main() { "POST" ); - generate(["input.ts"], "schema.json", "types.ts", "typescript", "gql", { + generate(["input.ts"], "schema.json", "types.ts", "", "typescript", "gql", "", { passthroughCustomScalars: false, customScalarsPrefix: "S", addTypename: false, diff --git a/types/apollo-codegen/index.d.ts b/types/apollo-codegen/index.d.ts index a506f7475e..1372739066 100644 --- a/types/apollo-codegen/index.d.ts +++ b/types/apollo-codegen/index.d.ts @@ -1,13 +1,15 @@ -// Type definitions for apollo-codegen 0.16 +// Type definitions for apollo-codegen 0.20 // Project: https://github.com/apollographql/apollo-codegen -// Definitions by: Bradley Ayers +// Definitions by: Bradley Ayers , Maria Carrasco // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 +import { Options } from 'graphql/utilities/schemaPrinter'; + export function downloadSchema( url: string, outputPath: string, - additionalHeaders: { [name: string]: string }, + additionalHeaders: { [name: string]: string; }, insecure: boolean, method: string ): Promise; @@ -19,22 +21,19 @@ export function introspectSchema( export function printSchema( schemaPath: string, - outputPath: string + outputPath: string, + options?: Options ): Promise; +export type TargetType = 'json' | 'swift' | 'ts-legacy' | 'typescript-legacy' | 'flow-legacy' | 'scala' | 'flow' | 'typescript' | 'ts'; + export function generate( inputPaths: string[], schemaPath: string, outputPath: string, - target: "json" | "swift" | "ts" | "typescript" | "flow" | "scala", + only: string, + target: TargetType, tagName: string, - options: { - passthroughCustomScalars: boolean; - customScalarsPrefix: string; - addTypename: boolean; - namespace: string; - operationIdsPath: string | null; - generateOperationIds: boolean; - mergeInFieldsFromFragmentSpreads: boolean; - } + projectName: string, + options: any ): void;