API: Updating typing for ns.singularity.getCurrentWork() (#989)

This commit is contained in:
Rinne
2023-12-27 08:06:45 -03:00
committed by GitHub
parent 550829a1c3
commit eba840dcd3
47 changed files with 514 additions and 29 deletions
+2 -3
View File
@@ -79,7 +79,6 @@ interface ClassWorkParams {
}
export const isClassWork = (w: Work | null): w is ClassWork => w !== null && w.type === WorkType.CLASS;
export class ClassWork extends Work {
classType: ClassType;
location: LocationName;
@@ -132,9 +131,9 @@ export class ClassWork extends Work {
}
}
APICopy(): Record<string, unknown> {
APICopy() {
return {
type: this.type,
type: WorkType.CLASS as const,
cyclesWorked: this.cyclesWorked,
classType: this.classType,
location: this.location,
+2 -2
View File
@@ -61,9 +61,9 @@ export class CompanyWork extends Work {
}
}
APICopy(): Record<string, unknown> {
APICopy() {
return {
type: this.type,
type: WorkType.COMPANY as const,
cyclesWorked: this.cyclesWorked,
companyName: this.companyName,
};
+2 -2
View File
@@ -96,9 +96,9 @@ export class CreateProgramWork extends Work {
}
}
APICopy(): Record<string, unknown> {
APICopy() {
return {
type: this.type,
type: WorkType.CREATE_PROGRAM as const,
cyclesWorked: this.cyclesWorked,
programName: this.programName,
};
+2 -2
View File
@@ -82,9 +82,9 @@ export class CrimeWork extends Work {
/** nothing to do */
}
APICopy(): Record<string, unknown> {
APICopy() {
return {
type: this.type,
type: WorkType.CRIME as const,
cyclesWorked: this.cyclesWorked,
crimeType: this.crimeType,
};
+2 -2
View File
@@ -67,9 +67,9 @@ export class FactionWork extends Work {
}
}
APICopy(): Record<string, unknown> {
APICopy() {
return {
type: this.type,
type: WorkType.FACTION as const,
cyclesWorked: this.cyclesWorked,
factionWorkType: this.factionWorkType,
factionName: this.factionName,
+2 -2
View File
@@ -79,9 +79,9 @@ export class GraftingWork extends Work {
}
}
APICopy(): Record<string, unknown> {
APICopy() {
return {
type: this.type,
type: WorkType.GRAFTING as const,
cyclesWorked: this.cyclesWorked,
augmentation: this.augmentation,
};
+3 -2
View File
@@ -1,4 +1,5 @@
import { IReviverValue } from "../utils/JSONReviver";
import type { IReviverValue } from "../utils/JSONReviver";
import type { Task } from "@nsdefs";
export abstract class Work {
type: WorkType;
@@ -13,7 +14,7 @@ export abstract class Work {
abstract process(cycles: number): boolean;
abstract finish(cancelled: boolean, suppressDialog?: boolean): void;
abstract APICopy(): Record<string, unknown>;
abstract APICopy(): Task;
abstract toJSON(): IReviverValue;
}