From 0c3fe43be7612f2f49828e9bd310d68524c3dc67 Mon Sep 17 00:00:00 2001 From: monoid Date: Tue, 21 Jun 2022 14:43:15 +0900 Subject: [PATCH] fix type error --- package.json | 1 + src/client/page/contentinfo.tsx | 2 +- src/content/comic.ts | 2 +- src/diff/watcher/watcher_filter.ts | 6 ++++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fd3bb83..04717bb 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "license": "ISC", "dependencies": { "@louislam/sqlite3": "^6.0.0", + "@types/koa-compose": "^3.2.5", "chokidar": "^3.5.1", "jsonschema": "^1.4.0", "jsonwebtoken": "^8.5.1", diff --git a/src/client/page/contentinfo.tsx b/src/client/page/contentinfo.tsx index 3fbe321..ab3ca8d 100644 --- a/src/client/page/contentinfo.tsx +++ b/src/client/page/contentinfo.tsx @@ -33,7 +33,7 @@ export function ReaderPage(props?: {}) { if (match == null) { throw new Error("unreachable"); } - const id = Number.parseInt(match.id); + const id = Number.parseInt(match.id ?? "NaN"); const [info, setInfo] = useState({ doc: undefined, notfound: false }); const menu_list = (link?: string) => ; diff --git a/src/content/comic.ts b/src/content/comic.ts index 003f666..4a9b06f 100644 --- a/src/content/comic.ts +++ b/src/content/comic.ts @@ -37,7 +37,7 @@ export class ComicReferrer extends createDefaultClass("comic"){ if(this.desc === undefined) throw new Error(`??? JSON.parse is returning undefined. ${this.path} desc.json format error`); } - + async createDocumentBody(): Promise{ await this.initDesc(); const basebody = await super.createDocumentBody(); diff --git a/src/diff/watcher/watcher_filter.ts b/src/diff/watcher/watcher_filter.ts index bed3049..e0bfb30 100644 --- a/src/diff/watcher/watcher_filter.ts +++ b/src/diff/watcher/watcher_filter.ts @@ -9,6 +9,12 @@ export class WatcherFilter extends EventEmitter implements IDiffWatcher{ on(event:U,listener:DiffWatcherEvent[U]): this{ return super.on(event,listener); } + /** + * emit event + * @param event + * @param arg + * @returns `true` if the event had listeners, `false` otherwise. + */ emit(event:U,...arg:Parameters): boolean{ if(event === "change"){ const prev = arg[0];