profile
viewpoint

Ask questionsrouter.get(*, callback) now causes an error

This was working fine a couple days ago and now I'm getting: error: TS2345 [ERROR]: Argument of type '({ request, response }: { request: Request; response: Response; }) => Promise<{ success: boolean; msg: any; } | undefined>' is not assignable to parameter of type 'RouterMiddleware<Record<string | number, string | undefined>,Record<string, any>>'. Type 'Promise<{ success: boolean; msg: any; } | undefined>' is not assignable to type 'void | Promise<void>'. Type 'Promise<{ success: boolean; msg: any; } | undefined>' is not assignable to type 'Promise<void>'. Type '{ success: boolean; msg: any; } | undefined' is not assignable to type 'void'.

callback:

import { Response } from "https://deno.land/x/oak/mod.ts";

export default ({ response }: { response: Response }) => {
  response.status = 404;
  response.body = { success: false, msg: "Not Found" };
};
oakserver/oak

Answer questions kitsonk

I am unable to reproduce this off of master. There was a big rewrite of the router, which changed some of the types which may have resolved this issue.

useful!

Related questions

No questions were found.
Github User Rank List