I'm trying to patch graphql-cli's get-schema function to print description using comment. I forked the library [https://github.com/poernahi/graphql-cli] and edited src/cmds/get-schema.ts:
printSchema(newSchemaResult as GraphQLSchema)
becomes
printSchema(newSchemaResult as GraphQLSchema, {commentDescriptions: true})
When I run npm install, tsc did not like my meddling..
src/cmds/get-schema.ts(194,11): error TS2554: Expected 1 arguments, but got 2.
Now I really don't understand this error, because when I look at node_modules/graphql/utilities/schemaPrinter.js.flow, I see the function signature clearly indicates a second optional parameter.
type Options = {| commentDescriptions?: boolean |};
export function printSchema(schema: GraphQLSchema, options?: Options): string
I tried using undefined as the second parameter and still get the same error. I read the ts documentation and this is the right syntax to define optional param, even if it is written in flow.
Is this caused by mixing flow and typescript?
How did typescript get the argument list? I walked through the import chain and it pointed to the definition above.
What am I missing? Any workaround?
Thanks