feat: add type to exporter generic param

main
spacemeowx2 2022-10-22 19:17:27 +08:00
parent 1f16903aa1
commit ec1e56e945
2 changed files with 9 additions and 1 deletions

View File

@ -85,6 +85,7 @@ class BattleFetcher {
if (!group) {
return {
type: "VsBattle",
challengeProgress: null,
bankaraMatchChallenge: null,
listNode: null,
@ -112,6 +113,7 @@ class BattleFetcher {
}
return {
type: "VsBattle",
bankaraMatchChallenge,
listNode,
challengeProgress,

View File

@ -97,6 +97,7 @@ export type ChallengeProgress = {
};
// With challenge info
export type VsBattle = {
type: "VsBattle";
listNode: null | BattleListNode;
bankaraMatchChallenge: null | BankaraMatchChallenge;
challengeProgress: null | ChallengeProgress;
@ -138,7 +139,12 @@ export type VsHistoryDetail = {
duration: number;
};
export type BattleExporter<D> = {
export type BattleExporter<
D extends {
// type is seful when you implement more than one BattleExporter on the same class
type: string;
},
> = {
name: string;
notExported: (list: string[]) => Promise<string[]>;
exportBattle: (detail: D) => Promise<void>;