mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-28 20:07:04 +02:00
API: Updating typing for ns.singularity.getCurrentWork() (#989)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user