Fix typing and codestyle

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen committed 2022-03-11 09:30:33 +02:00
1 parent 00aef47d3b
commit e5f53e1616
3 files changed
+3 -6

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ export interface LensApiResultContentType {
resultMapper: (result: LensApiResult<any>) => ({
statusCode: number;
content: any;
headers: { [ name: string ]: string };
headers: Record<string, string>;
});
}
-3
View File
@@ -36,8 +36,6 @@ describe("router", () => {
instantiate: (): Route<any> => ({
method: "get",
path: "/some-path",
// @ts-ignore
handler: routeHandlerMock,
}),
@@ -66,7 +64,6 @@ describe("router", () => {
},
});
// @ts-ignore
responseStub = { end: jest.fn(), setHeader: jest.fn(), write: jest.fn(), statusCode: undefined };
clusterStub = {} as Cluster;
+2 -2
View File
@@ -50,7 +50,7 @@ export class Router {
protected router = new Call.Router();
protected static rootPath = path.resolve(__static);
constructor(routes: Route<any>[], private dependencies: Dependencies) {
constructor(routes: Route<unknown>[], private dependencies: Dependencies) {
routes.forEach(route => {
this.router.add({ method: route.method, path: route.path }, handleRoute(route));
});
@@ -118,7 +118,7 @@ export interface Route<TResponse> {
handler: RouteHandler<TResponse>;
}
const handleRoute = (route: Route<any>) => async (request: LensApiRequest, response: http.ServerResponse) => {
const handleRoute = (route: Route<unknown>) => async (request: LensApiRequest, response: http.ServerResponse) => {
let result: LensApiResult<any> | void;
const writeServerResponse = writeServerResponseFor(response);