all repos — website @ 0ded4a2bf46a7c0e00523bf2f216fbfba12ba4d5

My website

Give files map a proper type
Alan Pearce alan@alanpearce.eu
Tue, 12 Sep 2023 17:16:58 +0200
commit

0ded4a2bf46a7c0e00523bf2f216fbfba12ba4d5

parent

2f6152539c540697290ec73a7c1b50b9f2db88c6

1 files changed, 7 insertions(+), 1 deletions(-)

jump to
M src/index.tssrc/index.ts
@@ -18,7 +18,13 @@ function getFilename(name: string): string {   return path.join(publicDir, `${name}`);
 }
 
-let files: Map<string, any> = new Map();
+type File = {
+  filename: string;
+  size: number;
+  mtime: string;
+};
+
+let files = new Map<string, File>();
 
 function registerFile(pathname: string, absPath: string, stat: Stats): void {
   pathname = "/" + (pathname === "." || pathname === "./" ? "" : pathname);