refac: APICall에 타입 지정

- 비 undefined 타입에서 ?타입 호출 제거
- API 소속 type들을 defs/API/ 로 이동
- 모든 SammoAPI, SammoRootAPI 지정
This commit is contained in:
2022-04-03 18:16:53 +09:00
parent b029c8b3ce
commit 315dcf80c9
17 changed files with 176 additions and 115 deletions
+3 -3
View File
@@ -11,7 +11,7 @@ import { isString } from 'lodash';
import { type Args, testSubmitArgs } from './processing/args';
import { SammoAPI } from './SammoAPI';
import { StoredActionsHelper } from './util/StoredActionsHelper';
import type { ReserveCommandResponse } from './defs';
import type { ReserveCommandResponse } from './defs/API/Command';
declare const staticValues: {
serverNick: string,
@@ -31,11 +31,11 @@ async function submitCommand<T extends ReserveCommandResponse>(isChiefTurn: bool
throw new TypeError(`Invalied Type ${testResult[0]}, ${testResult[2]} should be ${testResult[1]}`);
}
console.log('trySubmit', arg);
const responseP = targetAPI<T>({
const responseP = targetAPI({
action,
turnList,
arg,
});
}) as Promise<T>;
const storedActionsHelper = new StoredActionsHelper(staticValues.serverNick, isChiefTurn?'nation':'general', staticValues.mapName, staticValues.unitSet);