I'm using @types/koa-router
I have this code:
import * as KoaRouter from 'koa-router';
import { graphiqlKoa, graphqlKoa } from 'apollo-server-koa';
const router = new KoaRouter();
router.get('/graphiql', graphiqlKoa({
endpointURL: '/graphql',
}));
It's raising this type signature error:
Argument of type '(ctx: Context) => Promise<void>' is not assignable to parameter of type 'IMiddleware'.
Types of parameters 'ctx' and 'ctx' are incompatible.
Type 'IRouterContext' is not assignable to type 'Context'.
Types of property 'app' are incompatible.
Type 'import("pplicatio")' is not assignable to type 'Application'.
Types of property 'middleware' are incompatible.
Type 'import("myproject/node_modules/@types/koa-compose/index").Middleware<import("pplicatio").Context>[]' is not assignable to type 'import("myproject/node_modules/@types/koa-compose/index").Middleware<import("myproject/node_modules/@types/koa/index").Context>[]'.
Type 'import("myproject/node_modules/@types/koa-compose/index").Middleware<import("pplicatio").Context>' is not assignable to type 'import("myproject/node_modules/@types/koa-compose/index").Middleware<import("myproject/node_modules/@types/koa/index").Context>'.
Types of parameters 'context' and 'context' are incompatible.
Type 'import("myproject/node_modules/@types/koa/index").Context' is not assignable to type 'import("pplicatio").Context'.
Property 'params' is missing in type 'Context'.
I'm brand new to typescript and working on a koa server to serve GraphQL. This type error is huge and I'm not sure where to begin on it.
@andy-ms @jackwilsdon @sdbondi I see you have worked on this file, any ideas?
@AndrewRayCode When I try that I get an error Module '"[....]/node_modules/apollo-server-koa/dist/index"' has no exported member 'graphiqlKoa'. (same for graphqlKoa).
we need types for koa-graphql as well
@AndrewRayCode When I try that I get an error
Module '"[....]/node_modules/apollo-server-koa/dist/index"' has no exported member 'graphiqlKoa'.(same forgraphqlKoa).
I also have this problem, anyone have a solution?
Most helpful comment
@AndrewRayCode When I try that I get an error
Module '"[....]/node_modules/apollo-server-koa/dist/index"' has no exported member 'graphiqlKoa'.(same forgraphqlKoa).