mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 11:02:11 +08:00
Update signature to enable responses to be used in the middleware.
This commit is contained in:
@@ -14,13 +14,13 @@ const graphqlOption: graphqlHTTP.OptionsObj = {
|
||||
extensions: (args) => { }
|
||||
};
|
||||
|
||||
const graphqlOptionRequest = (request: express.Request): graphqlHTTP.OptionsObj => ({
|
||||
const graphqlOptionRequest = (request: express.Request, response: express.Response): graphqlHTTP.OptionsObj => ({
|
||||
graphiql: true,
|
||||
schema: schema,
|
||||
context: request.session
|
||||
});
|
||||
|
||||
const graphqlOptionRequestAsync = async (request: express.Request): Promise<graphqlHTTP.OptionsObj> => {
|
||||
const graphqlOptionRequestAsync = async (request: express.Request, response: express.Response): Promise<graphqlHTTP.OptionsObj> => {
|
||||
return {
|
||||
graphiql: true,
|
||||
schema: await Promise.resolve(schema),
|
||||
|
||||
2
types/express-graphql/index.d.ts
vendored
2
types/express-graphql/index.d.ts
vendored
@@ -16,7 +16,7 @@ declare namespace graphqlHTTP {
|
||||
* Used to configure the graphQLHTTP middleware by providing a schema
|
||||
* and other configuration options.
|
||||
*/
|
||||
export type Options = ((req: Request) => OptionsObj) | ((req: Request) => Promise<OptionsObj>) | OptionsObj
|
||||
export type Options = ((req: Request, res: Response) => OptionsObj) | ((req: Request, res: Response) => Promise<OptionsObj>) | OptionsObj
|
||||
export type OptionsObj = {
|
||||
/**
|
||||
* A GraphQL schema from graphql-js.
|
||||
|
||||
Reference in New Issue
Block a user