fix type error

This commit is contained in:
monoid 2022-06-21 14:43:15 +09:00
parent 1ea8ceca7a
commit 0c3fe43be7
4 changed files with 9 additions and 2 deletions

View File

@ -53,6 +53,7 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@louislam/sqlite3": "^6.0.0", "@louislam/sqlite3": "^6.0.0",
"@types/koa-compose": "^3.2.5",
"chokidar": "^3.5.1", "chokidar": "^3.5.1",
"jsonschema": "^1.4.0", "jsonschema": "^1.4.0",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",

View File

@ -33,7 +33,7 @@ export function ReaderPage(props?: {}) {
if (match == null) { if (match == null) {
throw new Error("unreachable"); throw new Error("unreachable");
} }
const id = Number.parseInt(match.id); const id = Number.parseInt(match.id ?? "NaN");
const [info, setInfo] = useState<DocumentState>({ doc: undefined, notfound: false }); const [info, setInfo] = useState<DocumentState>({ doc: undefined, notfound: false });
const menu_list = (link?: string) => <CommonMenuList url={link}></CommonMenuList>; const menu_list = (link?: string) => <CommonMenuList url={link}></CommonMenuList>;

View File

@ -9,6 +9,12 @@ export class WatcherFilter extends EventEmitter implements IDiffWatcher{
on<U extends keyof DiffWatcherEvent>(event:U,listener:DiffWatcherEvent[U]): this{ on<U extends keyof DiffWatcherEvent>(event:U,listener:DiffWatcherEvent[U]): this{
return super.on(event,listener); return super.on(event,listener);
} }
/**
* emit event
* @param event
* @param arg
* @returns `true` if the event had listeners, `false` otherwise.
*/
emit<U extends keyof DiffWatcherEvent>(event:U,...arg:Parameters<DiffWatcherEvent[U]>): boolean{ emit<U extends keyof DiffWatcherEvent>(event:U,...arg:Parameters<DiffWatcherEvent[U]>): boolean{
if(event === "change"){ if(event === "change"){
const prev = arg[0]; const prev = arg[0];