Skip to content

Commit 7bfc55e

Browse files
committed
type: fix type errors.
1 parent bb411f6 commit 7bfc55e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/utils/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { ServerResponse } from 'http';
22
import types from './types.json';
33

4-
const mime = Object.entries(types).reduce(
5-
(all, [type, exts]) =>
6-
Object.assign(all, ...exts.map(ext => ({ [ext]: type }))),
7-
{}
4+
const mime: Record<string, string> = Object.entries(types).reduce(
5+
(all, [type, exts]) => Object.assign(all, [...exts].map(ext => ({ [ext]: type }))), {}
86
);
97

108
export const isRouteRequest = (uri: string = '') => {
@@ -18,6 +16,7 @@ export const sendMessage = (res: ServerResponse, channel: string, data: string)
1816
};
1917

2018
export const sendFile = (res: ServerResponse, resource: string, status: number, file: string, ext: string) => {
19+
2120
res.writeHead(status, {
2221
"Content-Type": mime[ext] || "application/octet-stream",
2322
"Access-Control-Allow-Origin": "*"

0 commit comments

Comments
 (0)