judge: add type annotations (#300)

Co-authored-by: undefined <i@undefined.moe>
This commit is contained in:
Yang Gaoandundefined authored and GitHub committed 2022-02-03 00:14:11 +08:00
1 parent 04685ef864
commit b0f1c0d52c
19 files changed
+418 -71

No files matched your search

+3 -3
View File
@@ -23,19 +23,19 @@ import { Queue, sleep } from './utils';
declare global {
namespace NodeJS {
interface Global {
onDestory: Function[]
onDestroy: Function[]
hosts: any
}
}
}
if (!global.onDestory) global.onDestory = [];
if (!global.onDestroy) global.onDestroy = [];
if (!global.hosts) global.hosts = [];
let exit = false;
const terminate = async () => {
log.info('正在保存数据');
try {
await Promise.all(global.onDestory.map((f) => f()));
await Promise.all(global.onDestroy.map((f: Function) => f()));
process.exit(1);
} catch (e) {
if (exit) process.exit(1);