1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix typing and codestyle

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen 2022-03-03 16:17:20 +02:00
parent 00aef47d3b
commit e5f53e1616
No known key found for this signature in database
GPG Key ID: 8C6CFB2FFFE8F68A
3 changed files with 3 additions and 6 deletions

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>;
});
}

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;

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);