nuke some use of any

This commit is contained in:
Olivier Gagnon 2022-07-14 19:00:10 -04:00
parent 5629c16def
commit 6b630753f0
41 changed files with 122 additions and 153 deletions

@ -7,7 +7,7 @@ import { Factions } from "../Faction/Factions";
import { numeralWrapper } from "../ui/numeralFormat"; import { numeralWrapper } from "../ui/numeralFormat";
import { Money } from "../ui/React/Money"; import { Money } from "../ui/React/Money";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
import { FactionNames } from "../Faction/data/FactionNames"; import { FactionNames } from "../Faction/data/FactionNames";
import { IPlayer } from "../PersonObjects/IPlayer"; import { IPlayer } from "../PersonObjects/IPlayer";
import { AugmentationNames } from "./data/AugmentationNames"; import { AugmentationNames } from "./data/AugmentationNames";
@ -610,13 +610,12 @@ export class Augmentation {
} }
// Serialize the current object to a JSON save state. // Serialize the current object to a JSON save state.
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Augmentation", this); return Generic_toJSON("Augmentation", this);
} }
// Initiatizes a Augmentation object from a JSON save state. // Initiatizes a Augmentation object from a JSON save state.
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Augmentation {
static fromJSON(value: any): Augmentation {
return Generic_fromJSON(Augmentation, value.data); return Generic_fromJSON(Augmentation, value.data);
} }
} }

@ -1,7 +1,7 @@
import { Player } from "../Player"; import { Player } from "../Player";
import { getRandomInt } from "../utils/helpers/getRandomInt"; import { getRandomInt } from "../utils/helpers/getRandomInt";
import { addOffset } from "../utils/helpers/addOffset"; import { addOffset } from "../utils/helpers/addOffset";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
import { BladeburnerConstants } from "./data/Constants"; import { BladeburnerConstants } from "./data/Constants";
import { IBladeburner } from "./IBladeburner"; import { IBladeburner } from "./IBladeburner";
import { IAction, ISuccessChanceParams } from "./IAction"; import { IAction, ISuccessChanceParams } from "./IAction";
@ -292,12 +292,11 @@ export class Action implements IAction {
} }
} }
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Action", this); return Generic_toJSON("Action", this);
} }
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Action {
static fromJSON(value: any): Action {
return Generic_fromJSON(Action, value.data); return Generic_fromJSON(Action, value.data);
} }
} }

@ -1,5 +1,5 @@
import { IActionIdentifier } from "./IActionIdentifier"; import { IActionIdentifier } from "./IActionIdentifier";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
interface IParams { interface IParams {
name?: string; name?: string;
@ -15,12 +15,11 @@ export class ActionIdentifier implements IActionIdentifier {
if (params.type) this.type = params.type; if (params.type) this.type = params.type;
} }
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("ActionIdentifier", this); return Generic_toJSON("ActionIdentifier", this);
} }
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): ActionIdentifier {
static fromJSON(value: any): ActionIdentifier {
return Generic_fromJSON(ActionIdentifier, value.data); return Generic_fromJSON(ActionIdentifier, value.data);
} }
} }

@ -1,5 +1,5 @@
import { Operation, IOperationParams } from "./Operation"; import { Operation, IOperationParams } from "./Operation";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
export class BlackOperation extends Operation { export class BlackOperation extends Operation {
constructor(params: IOperationParams | null = null) { constructor(params: IOperationParams | null = null) {
@ -20,12 +20,11 @@ export class BlackOperation extends Operation {
return 1; return 1;
} }
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("BlackOperation", this); return Generic_toJSON("BlackOperation", this);
} }
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Operation {
static fromJSON(value: any): Operation {
return Generic_fromJSON(BlackOperation, value.data); return Generic_fromJSON(BlackOperation, value.data);
} }
} }

@ -1,4 +1,4 @@
import { Reviver, Generic_toJSON, Generic_fromJSON } from "../utils/JSONReviver"; import { Reviver, Generic_toJSON, Generic_fromJSON, IReviverValue } from "../utils/JSONReviver";
import { IBladeburner } from "./IBladeburner"; import { IBladeburner } from "./IBladeburner";
import { IActionIdentifier } from "./IActionIdentifier"; import { IActionIdentifier } from "./IActionIdentifier";
import { ActionIdentifier } from "./ActionIdentifier"; import { ActionIdentifier } from "./ActionIdentifier";
@ -2409,15 +2409,14 @@ export class Bladeburner implements IBladeburner {
/** /**
* Serialize the current object to a JSON save state. * Serialize the current object to a JSON save state.
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Bladeburner", this); return Generic_toJSON("Bladeburner", this);
} }
/** /**
* Initiatizes a Bladeburner object from a JSON save state. * Initiatizes a Bladeburner object from a JSON save state.
*/ */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Bladeburner {
static fromJSON(value: any): Bladeburner {
return Generic_fromJSON(Bladeburner, value.data); return Generic_fromJSON(Bladeburner, value.data);
} }
} }

@ -1,6 +1,6 @@
import { BladeburnerConstants } from "./data/Constants"; import { BladeburnerConstants } from "./data/Constants";
import { getRandomInt } from "../utils/helpers/getRandomInt"; import { getRandomInt } from "../utils/helpers/getRandomInt";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
import { addOffset } from "../utils/helpers/addOffset"; import { addOffset } from "../utils/helpers/addOffset";
interface IChangePopulationByCountParams { interface IChangePopulationByCountParams {
@ -177,15 +177,14 @@ export class City {
/** /**
* Serialize the current object to a JSON save state. * Serialize the current object to a JSON save state.
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("City", this); return Generic_toJSON("City", this);
} }
/** /**
* Initiatizes a City object from a JSON save state. * Initiatizes a City object from a JSON save state.
*/ */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): City {
static fromJSON(value: any): City {
return Generic_fromJSON(City, value.data); return Generic_fromJSON(City, value.data);
} }
} }

@ -1,6 +1,6 @@
import { IBladeburner } from "./IBladeburner"; import { IBladeburner } from "./IBladeburner";
import { Action, IActionParams } from "./Action"; import { Action, IActionParams } from "./Action";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
export class Contract extends Action { export class Contract extends Action {
constructor(params: IActionParams | null = null) { constructor(params: IActionParams | null = null) {
@ -11,12 +11,11 @@ export class Contract extends Action {
return inst.skillMultipliers.successChanceContract; return inst.skillMultipliers.successChanceContract;
} }
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Contract", this); return Generic_toJSON("Contract", this);
} }
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Contract {
static fromJSON(value: any): Contract {
return Generic_fromJSON(Contract, value.data); return Generic_fromJSON(Contract, value.data);
} }
} }

@ -1,3 +1,4 @@
import { IReviverValue } from "../utils/JSONReviver";
import { IPerson } from "../PersonObjects/IPerson"; import { IPerson } from "../PersonObjects/IPerson";
import { IBladeburner } from "./IBladeburner"; import { IBladeburner } from "./IBladeburner";
@ -67,5 +68,5 @@ export interface IAction {
getSuccessChance(inst: IBladeburner, person: IPerson, params: ISuccessChanceParams): number; getSuccessChance(inst: IBladeburner, person: IPerson, params: ISuccessChanceParams): number;
getSuccessesNeededForNextLevel(baseSuccessesPerLevel: number): number; getSuccessesNeededForNextLevel(baseSuccessesPerLevel: number): number;
setMaxLevel(baseSuccessesPerLevel: number): void; setMaxLevel(baseSuccessesPerLevel: number): void;
toJSON(): any; toJSON(): IReviverValue;
} }

@ -1,7 +1,7 @@
import { IBladeburner } from "./IBladeburner"; import { IBladeburner } from "./IBladeburner";
import { BladeburnerConstants } from "./data/Constants"; import { BladeburnerConstants } from "./data/Constants";
import { Action, IActionParams } from "./Action"; import { Action, IActionParams } from "./Action";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
export interface IOperationParams extends IActionParams { export interface IOperationParams extends IActionParams {
reqdRank?: number; reqdRank?: number;
@ -44,12 +44,11 @@ export class Operation extends Action {
return 1; return 1;
} }
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Operation", this); return Generic_toJSON("Operation", this);
} }
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Operation {
static fromJSON(value: any): Operation {
return Generic_fromJSON(Operation, value.data); return Generic_fromJSON(Operation, value.data);
} }
} }

@ -2,7 +2,7 @@ import { codingContractTypesMetadata, DescriptionFunc, GeneratorFunc, SolverFunc
import { IMap } from "./types"; import { IMap } from "./types";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "./utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "./utils/JSONReviver";
import { CodingContractEvent } from "./ui/React/CodingContractModal"; import { CodingContractEvent } from "./ui/React/CodingContractModal";
/* tslint:disable:no-magic-numbers completed-docs max-classes-per-file no-console */ /* tslint:disable:no-magic-numbers completed-docs max-classes-per-file no-console */
@ -186,15 +186,14 @@ export class CodingContract {
/** /**
* Serialize the current file to a JSON save state. * Serialize the current file to a JSON save state.
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("CodingContract", this); return Generic_toJSON("CodingContract", this);
} }
/** /**
* Initiatizes a CodingContract from a JSON save state. * Initiatizes a CodingContract from a JSON save state.
*/ */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): CodingContract {
static fromJSON(value: any): CodingContract {
return Generic_fromJSON(CodingContract, value.data); return Generic_fromJSON(CodingContract, value.data);
} }
} }

@ -4,7 +4,7 @@ import { favorToRep, repToFavor } from "../Faction/formulas/favor";
import { IMap } from "../types"; import { IMap } from "../types";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
export interface IConstructorParams { export interface IConstructorParams {
name: string; name: string;
@ -151,15 +151,14 @@ export class Company {
/** /**
* Serialize the current object to a JSON save state. * Serialize the current object to a JSON save state.
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Company", this); return Generic_toJSON("Company", this);
} }
/** /**
* Initiatizes a Company from a JSON save state. * Initiatizes a Company from a JSON save state.
*/ */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Company {
static fromJSON(value: any): Company {
return Generic_fromJSON(Company, value.data); return Generic_fromJSON(Company, value.data);
} }
} }

@ -11,7 +11,7 @@ import { LiteratureNames } from "../Literature/data/LiteratureNames";
import { IPlayer } from "../PersonObjects/IPlayer"; import { IPlayer } from "../PersonObjects/IPlayer";
import { dialogBoxCreate } from "../ui/React/DialogBox"; import { dialogBoxCreate } from "../ui/React/DialogBox";
import { Reviver, Generic_toJSON, Generic_fromJSON } from "../utils/JSONReviver"; import { Reviver, Generic_toJSON, Generic_fromJSON, IReviverValue } from "../utils/JSONReviver";
import { isString } from "../utils/helpers/isString"; import { isString } from "../utils/helpers/isString";
interface IParams { interface IParams {
@ -433,15 +433,14 @@ export class Corporation {
/** /**
* Serialize the current object to a JSON save state. * Serialize the current object to a JSON save state.
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Corporation", this); return Generic_toJSON("Corporation", this);
} }
/** /**
* Initiatizes a Corporation object from a JSON save state. * Initiatizes a Corporation object from a JSON save state.
*/ */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Corporation {
static fromJSON(value: any): Corporation {
return Generic_fromJSON(Corporation, value.data); return Generic_fromJSON(Corporation, value.data);
} }
} }

@ -1,4 +1,4 @@
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
// Array of all valid states // Array of all valid states
const AllCorporationStates: string[] = ["START", "PURCHASE", "PRODUCTION", "SALE", "EXPORT"]; const AllCorporationStates: string[] = ["START", "PURCHASE", "PRODUCTION", "SALE", "EXPORT"];
@ -28,13 +28,12 @@ export class CorporationState {
} }
// Serialize the current object to a JSON save state. // Serialize the current object to a JSON save state.
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("CorporationState", this); return Generic_toJSON("CorporationState", this);
} }
// Initiatizes a CorporationState object from a JSON save state. // Initiatizes a CorporationState object from a JSON save state.
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): CorporationState {
static fromJSON(value: any): CorporationState {
return Generic_fromJSON(CorporationState, value.data); return Generic_fromJSON(CorporationState, value.data);
} }
} }

@ -1,6 +1,6 @@
import { CorporationConstants } from "./data/Constants"; import { CorporationConstants } from "./data/Constants";
import { getRandomInt } from "../utils/helpers/getRandomInt"; import { getRandomInt } from "../utils/helpers/getRandomInt";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
import { EmployeePositions } from "./EmployeePositions"; import { EmployeePositions } from "./EmployeePositions";
import { ICorporation } from "./ICorporation"; import { ICorporation } from "./ICorporation";
import { OfficeSpace } from "./OfficeSpace"; import { OfficeSpace } from "./OfficeSpace";
@ -128,12 +128,11 @@ export class Employee {
return mult; return mult;
} }
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Employee", this); return Generic_toJSON("Employee", this);
} }
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Employee {
static fromJSON(value: any): Employee {
return Generic_fromJSON(Employee, value.data); return Generic_fromJSON(Employee, value.data);
} }
} }

@ -3,6 +3,7 @@ import { IPlayer } from "../PersonObjects/IPlayer";
import { CorporationUnlockUpgrade } from "./data/CorporationUnlockUpgrades"; import { CorporationUnlockUpgrade } from "./data/CorporationUnlockUpgrades";
import { CorporationUpgrade } from "./data/CorporationUpgrades"; import { CorporationUpgrade } from "./data/CorporationUpgrades";
import { CorporationState } from "./CorporationState"; import { CorporationState } from "./CorporationState";
import { IReviverValue } from "../utils/JSONReviver";
export interface ICorporation { export interface ICorporation {
name: string; name: string;
@ -54,6 +55,6 @@ export interface ICorporation {
getSalesMultiplier(): number; getSalesMultiplier(): number;
getScientificResearchMultiplier(): number; getScientificResearchMultiplier(): number;
getStarterGuide(player: IPlayer): void; getStarterGuide(player: IPlayer): void;
toJSON(): any; toJSON(): IReviverValue;
getDividends(): number; getDividends(): number;
} }

@ -4,6 +4,7 @@ import { ICorporation } from "./ICorporation";
import { OfficeSpace } from "./OfficeSpace"; import { OfficeSpace } from "./OfficeSpace";
import { Product } from "./Product"; import { Product } from "./Product";
import { IndustryUpgrade } from "./IndustryUpgrades"; import { IndustryUpgrade } from "./IndustryUpgrades";
import { IReviverValue } from "../utils/JSONReviver";
export interface IIndustry { export interface IIndustry {
name: string; name: string;
@ -73,5 +74,5 @@ export interface IIndustry {
getSalesMultiplier(): number; getSalesMultiplier(): number;
getScientificResearchMultiplier(): number; getScientificResearchMultiplier(): number;
getStorageMultiplier(): number; getStorageMultiplier(): number;
toJSON(): any; toJSON(): IReviverValue;
} }

@ -1,4 +1,4 @@
import { Reviver, Generic_toJSON, Generic_fromJSON } from "../utils/JSONReviver"; import { Reviver, Generic_toJSON, Generic_fromJSON, IReviverValue } from "../utils/JSONReviver";
import { CityName } from "../Locations/data/CityNames"; import { CityName } from "../Locations/data/CityNames";
import { Industries, IndustryStartingCosts, IndustryResearchTrees } from "./IndustryData"; import { Industries, IndustryStartingCosts, IndustryResearchTrees } from "./IndustryData";
import { CorporationConstants } from "./data/Constants"; import { CorporationConstants } from "./data/Constants";
@ -1438,15 +1438,14 @@ export class Industry implements IIndustry {
/** /**
* Serialize the current object to a JSON save state. * Serialize the current object to a JSON save state.
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Industry", this); return Generic_toJSON("Industry", this);
} }
/** /**
* Initiatizes a Industry object from a JSON save state. * Initiatizes a Industry object from a JSON save state.
*/ */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Industry {
static fromJSON(value: any): Industry {
return Generic_fromJSON(Industry, value.data); return Generic_fromJSON(Industry, value.data);
} }
} }

@ -1,4 +1,4 @@
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
import { Export } from "./Export"; import { Export } from "./Export";
interface IConstructorParams { interface IConstructorParams {
@ -229,13 +229,12 @@ export class Material {
} }
// Serialize the current object to a JSON save state. // Serialize the current object to a JSON save state.
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Material", this); return Generic_toJSON("Material", this);
} }
// Initiatizes a Material object from a JSON save state. // Initiatizes a Material object from a JSON save state.
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Material {
static fromJSON(value: any): Material {
return Generic_fromJSON(Material, value.data); return Generic_fromJSON(Material, value.data);
} }
} }

@ -2,7 +2,7 @@ import { EmployeePositions } from "./EmployeePositions";
import { CorporationConstants } from "./data/Constants"; import { CorporationConstants } from "./data/Constants";
import { getRandomInt } from "../utils/helpers/getRandomInt"; import { getRandomInt } from "../utils/helpers/getRandomInt";
import { generateRandomString } from "../utils/StringHelperFunctions"; import { generateRandomString } from "../utils/StringHelperFunctions";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
import { Employee } from "./Employee"; import { Employee } from "./Employee";
import { IIndustry } from "./IIndustry"; import { IIndustry } from "./IIndustry";
import { ICorporation } from "./ICorporation"; import { ICorporation } from "./ICorporation";
@ -214,12 +214,11 @@ export class OfficeSpace {
return jobCount === amount; return jobCount === amount;
} }
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("OfficeSpace", this); return Generic_toJSON("OfficeSpace", this);
} }
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): OfficeSpace {
static fromJSON(value: any): OfficeSpace {
return Generic_fromJSON(OfficeSpace, value.data); return Generic_fromJSON(OfficeSpace, value.data);
} }
} }

@ -6,7 +6,7 @@ import { ProductRatingWeights, IProductRatingWeight } from "./ProductRatingWeigh
import { createCityMap } from "../Locations/createCityMap"; import { createCityMap } from "../Locations/createCityMap";
import { IMap } from "../types"; import { IMap } from "../types";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
import { getRandomInt } from "../utils/helpers/getRandomInt"; import { getRandomInt } from "../utils/helpers/getRandomInt";
interface IConstructorParams { interface IConstructorParams {
@ -232,13 +232,12 @@ export class Product {
} }
// Serialize the current object to a JSON save state. // Serialize the current object to a JSON save state.
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Product", this); return Generic_toJSON("Product", this);
} }
// Initiatizes a Product object from a JSON save state. // Initiatizes a Product object from a JSON save state.
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Product {
static fromJSON(value: any): Product {
return Generic_fromJSON(Product, value.data); return Generic_fromJSON(Product, value.data);
} }
} }

@ -3,7 +3,7 @@ import { ICorporation } from "./ICorporation";
import { IIndustry } from "./IIndustry"; import { IIndustry } from "./IIndustry";
import { MaterialSizes } from "./MaterialSizes"; import { MaterialSizes } from "./MaterialSizes";
import { IMap } from "../types"; import { IMap } from "../types";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
import { exceptionAlert } from "../utils/helpers/exceptionAlert"; import { exceptionAlert } from "../utils/helpers/exceptionAlert";
interface IConstructorParams { interface IConstructorParams {
@ -105,13 +105,12 @@ export class Warehouse {
} }
// Serialize the current object to a JSON save state. // Serialize the current object to a JSON save state.
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Warehouse", this); return Generic_toJSON("Warehouse", this);
} }
// Initiatizes a Warehouse object from a JSON save state. // Initiatizes a Warehouse object from a JSON save state.
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Warehouse {
static fromJSON(value: any): Warehouse {
return Generic_fromJSON(Warehouse, value.data); return Generic_fromJSON(Warehouse, value.data);
} }
} }

@ -1,5 +1,5 @@
import { Fragment, FragmentById } from "./Fragment"; import { Fragment, FragmentById } from "./Fragment";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
export interface IActiveFragmentParams { export interface IActiveFragmentParams {
x: number; x: number;
@ -74,15 +74,14 @@ export class ActiveFragment {
/** /**
* Serialize an active fragment to a JSON save state. * Serialize an active fragment to a JSON save state.
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("ActiveFragment", this); return Generic_toJSON("ActiveFragment", this);
} }
/** /**
* Initializes an acive fragment from a JSON save state * Initializes an acive fragment from a JSON save state
*/ */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): ActiveFragment {
static fromJSON(value: any): ActiveFragment {
return Generic_fromJSON(ActiveFragment, value.data); return Generic_fromJSON(ActiveFragment, value.data);
} }
} }

@ -19,22 +19,22 @@ export class DummyGift implements IStaneksGift {
height(): number { height(): number {
return this._height; return this._height;
} }
charge(): any { charge(): void {
throw new Error("unimplemented for dummy gift"); throw new Error("unimplemented for dummy gift");
} }
process(): any { process(): void {
throw new Error("unimplemented for dummy gift"); throw new Error("unimplemented for dummy gift");
} }
effect(): any { effect(): number {
throw new Error("unimplemented for dummy gift"); throw new Error("unimplemented for dummy gift");
} }
canPlace(): any { canPlace(): boolean {
throw new Error("unimplemented for dummy gift"); throw new Error("unimplemented for dummy gift");
} }
place(): any { place(): boolean {
throw new Error("unimplemented for dummy gift"); throw new Error("unimplemented for dummy gift");
} }
findFragment(): any { findFragment(): ActiveFragment | undefined {
throw new Error("unimplemented for dummy gift"); throw new Error("unimplemented for dummy gift");
} }
fragmentAt(worldX: number, worldY: number): ActiveFragment | undefined { fragmentAt(worldX: number, worldY: number): ActiveFragment | undefined {

@ -7,7 +7,7 @@ import { IPlayer } from "../PersonObjects/IPlayer";
import { Factions } from "../Faction/Factions"; import { Factions } from "../Faction/Factions";
import { CalculateEffect } from "./formulas/effect"; import { CalculateEffect } from "./formulas/effect";
import { StaneksGiftEvents } from "./StaneksGiftEvents"; import { StaneksGiftEvents } from "./StaneksGiftEvents";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
import { CONSTANTS } from "../Constants"; import { CONSTANTS } from "../Constants";
import { StanekConstants } from "./data/Constants"; import { StanekConstants } from "./data/Constants";
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
@ -224,15 +224,14 @@ export class StaneksGift implements IStaneksGift {
/** /**
* Serialize Staneks Gift to a JSON save state. * Serialize Staneks Gift to a JSON save state.
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("StaneksGift", this); return Generic_toJSON("StaneksGift", this);
} }
/** /**
* Initializes Staneks Gift from a JSON save state * Initializes Staneks Gift from a JSON save state
*/ */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): StaneksGift {
static fromJSON(value: any): StaneksGift {
return Generic_fromJSON(StaneksGift, value.data); return Generic_fromJSON(StaneksGift, value.data);
} }
} }

@ -1,6 +1,6 @@
import { FactionInfo, FactionInfos } from "./FactionInfo"; import { FactionInfo, FactionInfos } from "./FactionInfo";
import { favorToRep, repToFavor } from "./formulas/favor"; import { favorToRep, repToFavor } from "./formulas/favor";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
export class Faction { export class Faction {
/** /**
@ -75,15 +75,14 @@ export class Faction {
/** /**
* Serialize the current object to a JSON save state. * Serialize the current object to a JSON save state.
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Faction", this); return Generic_toJSON("Faction", this);
} }
/** /**
* Initiatizes a Faction object from a JSON save state. * Initiatizes a Faction object from a JSON save state.
*/ */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Faction {
static fromJSON(value: any): Faction {
return Generic_fromJSON(Faction, value.data); return Generic_fromJSON(Faction, value.data);
} }
} }

@ -8,7 +8,7 @@ import { Faction } from "../Faction/Faction";
import { Factions } from "../Faction/Factions"; import { Factions } from "../Faction/Factions";
import { dialogBoxCreate } from "../ui/React/DialogBox"; import { dialogBoxCreate } from "../ui/React/DialogBox";
import { Reviver, Generic_toJSON, Generic_fromJSON } from "../utils/JSONReviver"; import { Reviver, Generic_toJSON, Generic_fromJSON, IReviverValue } from "../utils/JSONReviver";
import { exceptionAlert } from "../utils/helpers/exceptionAlert"; import { exceptionAlert } from "../utils/helpers/exceptionAlert";
import { getRandomInt } from "../utils/helpers/getRandomInt"; import { getRandomInt } from "../utils/helpers/getRandomInt";
@ -399,15 +399,14 @@ export class Gang implements IGang {
/** /**
* Serialize the current object to a JSON save state. * Serialize the current object to a JSON save state.
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Gang", this); return Generic_toJSON("Gang", this);
} }
/** /**
* Initiatizes a Gang object from a JSON save state. * Initiatizes a Gang object from a JSON save state.
*/ */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Gang {
static fromJSON(value: any): Gang {
return Generic_fromJSON(Gang, value.data); return Generic_fromJSON(Gang, value.data);
} }
} }

@ -5,7 +5,7 @@ import { GangMemberUpgrades } from "./GangMemberUpgrades";
import { IAscensionResult } from "./IAscensionResult"; import { IAscensionResult } from "./IAscensionResult";
import { IPlayer } from "../PersonObjects/IPlayer"; import { IPlayer } from "../PersonObjects/IPlayer";
import { IGang } from "./IGang"; import { IGang } from "./IGang";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
import { import {
calculateRespectGain, calculateRespectGain,
calculateMoneyGain, calculateMoneyGain,
@ -320,15 +320,14 @@ export class GangMember {
/** /**
* Serialize the current object to a JSON save state. * Serialize the current object to a JSON save state.
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("GangMember", this); return Generic_toJSON("GangMember", this);
} }
/** /**
* Initiatizes a GangMember object from a JSON save state. * Initiatizes a GangMember object from a JSON save state.
*/ */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): GangMember {
static fromJSON(value: any): GangMember {
return Generic_fromJSON(GangMember, value.data); return Generic_fromJSON(GangMember, value.data);
} }
} }

@ -3,6 +3,7 @@ import { GangMember } from "./GangMember";
import { WorkerScript } from "../Netscript/WorkerScript"; import { WorkerScript } from "../Netscript/WorkerScript";
import { IPlayer } from "../PersonObjects/IPlayer"; import { IPlayer } from "../PersonObjects/IPlayer";
import { IAscensionResult } from "./IAscensionResult"; import { IAscensionResult } from "./IAscensionResult";
import { IReviverValue } from "src/utils/JSONReviver";
export interface IGang { export interface IGang {
facName: string; facName: string;
@ -42,5 +43,5 @@ export interface IGang {
getDiscount(): number; getDiscount(): number;
getAllTaskNames(): string[]; getAllTaskNames(): string[];
getUpgradeCost(upg: GangMemberUpgrade): number; getUpgradeCost(upg: GangMemberUpgrade): number;
toJSON(): any; toJSON(): IReviverValue;
} }

@ -17,7 +17,7 @@ import {
import { HacknetNodeConstants } from "./data/Constants"; import { HacknetNodeConstants } from "./data/Constants";
import { dialogBoxCreate } from "../ui/React/DialogBox"; import { dialogBoxCreate } from "../ui/React/DialogBox";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
import { ObjectValidator, minMax } from "../utils/Validator"; import { ObjectValidator, minMax } from "../utils/Validator";
export class HacknetNode implements IHacknetNode { export class HacknetNode implements IHacknetNode {
@ -123,15 +123,14 @@ export class HacknetNode implements IHacknetNode {
/** /**
* Serialize the current object to a JSON save state. * Serialize the current object to a JSON save state.
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("HacknetNode", this); return Generic_toJSON("HacknetNode", this);
} }
/** /**
* Initiatizes a HacknetNode object from a JSON save state. * Initiatizes a HacknetNode object from a JSON save state.
*/ */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): HacknetNode {
static fromJSON(value: any): HacknetNode {
return Generic_fromJSON(HacknetNode, value.data); return Generic_fromJSON(HacknetNode, value.data);
} }
} }

@ -18,7 +18,7 @@ import {
import { createRandomIp } from "../utils/IPAddress"; import { createRandomIp } from "../utils/IPAddress";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
import { IPlayer } from "../PersonObjects/IPlayer"; import { IPlayer } from "../PersonObjects/IPlayer";
interface IConstructorParams { interface IConstructorParams {
@ -145,13 +145,12 @@ export class HacknetServer extends BaseServer implements IHacknetNode {
} }
// Serialize the current object to a JSON save state // Serialize the current object to a JSON save state
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("HacknetServer", this); return Generic_toJSON("HacknetServer", this);
} }
// Initializes a HacknetServer Object from a JSON save state // Initializes a HacknetServer Object from a JSON save state
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): HacknetServer {
static fromJSON(value: any): HacknetServer {
return Generic_fromJSON(HacknetServer, value.data); return Generic_fromJSON(HacknetServer, value.data);
} }
} }

@ -10,7 +10,7 @@ import { HashUpgrades } from "./HashUpgrades";
import { HashUpgrade } from "./HashUpgrade"; import { HashUpgrade } from "./HashUpgrade";
import { IMap } from "../types"; import { IMap } from "../types";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
export class HashManager { export class HashManager {
// Max number of hashes this can hold. Equal to the sum of capacities of // Max number of hashes this can hold. Equal to the sum of capacities of
@ -157,13 +157,12 @@ export class HashManager {
} }
//Serialize the current object to a JSON save state. //Serialize the current object to a JSON save state.
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("HashManager", this); return Generic_toJSON("HashManager", this);
} }
// Initiatizes a HashManager object from a JSON save state. // Initiatizes a HashManager object from a JSON save state.
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): HashManager {
static fromJSON(value: any): HashManager {
return Generic_fromJSON(HashManager, value.data); return Generic_fromJSON(HashManager, value.data);
} }
} }

@ -31,7 +31,7 @@ import { HashManager } from "../../Hacknet/HashManager";
import { CityName } from "../../Locations/data/CityNames"; import { CityName } from "../../Locations/data/CityNames";
import { MoneySourceTracker } from "../../utils/MoneySourceTracker"; import { MoneySourceTracker } from "../../utils/MoneySourceTracker";
import { Reviver, Generic_toJSON, Generic_fromJSON } from "../../utils/JSONReviver"; import { Reviver, Generic_toJSON, Generic_fromJSON, IReviverValue } from "../../utils/JSONReviver";
import { ISkillProgress } from "../formulas/skill"; import { ISkillProgress } from "../formulas/skill";
import { PlayerAchievement } from "../../Achievements/Achievements"; import { PlayerAchievement } from "../../Achievements/Achievements";
import { cyrb53 } from "../../utils/StringHelperFunctions"; import { cyrb53 } from "../../utils/StringHelperFunctions";
@ -420,15 +420,14 @@ export class PlayerObject implements IPlayer {
/** /**
* Serialize the current object to a JSON save state. * Serialize the current object to a JSON save state.
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("PlayerObject", this); return Generic_toJSON("PlayerObject", this);
} }
/** /**
* Initiatizes a PlayerObject object from a JSON save state. * Initiatizes a PlayerObject object from a JSON save state.
*/ */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): PlayerObject {
static fromJSON(value: any): PlayerObject {
return Generic_fromJSON(PlayerObject, value.data); return Generic_fromJSON(PlayerObject, value.data);
} }
} }

@ -32,7 +32,7 @@ import { Factions } from "../../Faction/Factions";
import { CityName } from "../../Locations/data/CityNames"; import { CityName } from "../../Locations/data/CityNames";
import { LocationName } from "../../Locations/data/LocationNames"; import { LocationName } from "../../Locations/data/LocationNames";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../utils/JSONReviver";
import { BladeburnerConstants } from "../../Bladeburner/data/Constants"; import { BladeburnerConstants } from "../../Bladeburner/data/Constants";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../ui/numeralFormat";
import { capitalizeFirstLetter, capitalizeEachWord } from "../../utils/StringHelperFunctions"; import { capitalizeFirstLetter, capitalizeEachWord } from "../../utils/StringHelperFunctions";
@ -1236,15 +1236,14 @@ export class Sleeve extends Person {
/** /**
* Serialize the current object to a JSON save state. * Serialize the current object to a JSON save state.
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Sleeve", this); return Generic_toJSON("Sleeve", this);
} }
/** /**
* Initiatizes a Sleeve object from a JSON save state. * Initiatizes a Sleeve object from a JSON save state.
*/ */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Sleeve {
static fromJSON(value: any): Sleeve {
return Generic_fromJSON(Sleeve, value.data); return Generic_fromJSON(Sleeve, value.data);
} }
} }

@ -21,7 +21,7 @@ import { SnackbarEvents, ToastVariant } from "./ui/React/Snackbar";
import * as ExportBonus from "./ExportBonus"; import * as ExportBonus from "./ExportBonus";
import { dialogBoxCreate } from "./ui/React/DialogBox"; import { dialogBoxCreate } from "./ui/React/DialogBox";
import { Reviver, Generic_toJSON, Generic_fromJSON } from "./utils/JSONReviver"; import { Reviver, Generic_toJSON, Generic_fromJSON, IReviverValue } from "./utils/JSONReviver";
import { save } from "./db"; import { save } from "./db";
import { v1APIBreak } from "./utils/v1APIBreak"; import { v1APIBreak } from "./utils/v1APIBreak";
import { AugmentationNames } from "./Augmentation/data/AugmentationNames"; import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
@ -234,11 +234,11 @@ class BitburnerSaveObject {
return Promise.resolve(data); return Promise.resolve(data);
} }
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("BitburnerSaveObject", this); return Generic_toJSON("BitburnerSaveObject", this);
} }
static fromJSON(value: { data: any }): BitburnerSaveObject { static fromJSON(value: IReviverValue): BitburnerSaveObject {
return Generic_fromJSON(BitburnerSaveObject, value.data); return Generic_fromJSON(BitburnerSaveObject, value.data);
} }
} }

@ -8,7 +8,7 @@ import { Settings } from "../Settings/Settings";
import { IMap } from "../types"; import { IMap } from "../types";
import { Terminal } from "../Terminal"; import { Terminal } from "../Terminal";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
import { formatTime } from "../utils/helpers/formatTime"; import { formatTime } from "../utils/helpers/formatTime";
export class RunningScript { export class RunningScript {
@ -123,13 +123,12 @@ export class RunningScript {
} }
// Serialize the current object to a JSON save state // Serialize the current object to a JSON save state
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("RunningScript", this); return Generic_toJSON("RunningScript", this);
} }
// Initializes a RunningScript Object from a JSON save state // Initializes a RunningScript Object from a JSON save state
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): RunningScript {
static fromJSON(value: any): RunningScript {
return Generic_fromJSON(RunningScript, value.data); return Generic_fromJSON(RunningScript, value.data);
} }
} }

@ -7,7 +7,7 @@
import { calculateRamUsage, RamUsageEntry } from "./RamCalculations"; import { calculateRamUsage, RamUsageEntry } from "./RamCalculations";
import { ScriptUrl } from "./ScriptUrl"; import { ScriptUrl } from "./ScriptUrl";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
import { roundToTwo } from "../utils/helpers/roundToTwo"; import { roundToTwo } from "../utils/helpers/roundToTwo";
import { IPlayer } from "../PersonObjects/IPlayer"; import { IPlayer } from "../PersonObjects/IPlayer";
@ -133,13 +133,12 @@ export class Script {
} }
// Serialize the current object to a JSON save state // Serialize the current object to a JSON save state
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Script", this); return Generic_toJSON("Script", this);
} }
// Initializes a Script Object from a JSON save state // Initializes a Script Object from a JSON save state
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Script {
static fromJSON(value: any): Script {
const s = Generic_fromJSON(Script, value.data); const s = Generic_fromJSON(Script, value.data);
// Force the url to blank from the save data. Urls are not valid outside the current browser page load. // Force the url to blank from the save data. Urls are not valid outside the current browser page load.
s.url = ""; s.url = "";

@ -5,7 +5,7 @@ import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
import { createRandomString } from "../utils/helpers/createRandomString"; import { createRandomString } from "../utils/helpers/createRandomString";
import { createRandomIp } from "../utils/IPAddress"; import { createRandomIp } from "../utils/IPAddress";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
export interface IConstructorParams { export interface IConstructorParams {
adminRights?: boolean; adminRights?: boolean;
@ -152,13 +152,12 @@ export class Server extends BaseServer {
/** /**
* Serialize the current object to a JSON save state * Serialize the current object to a JSON save state
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Server", this); return Generic_toJSON("Server", this);
} }
// Initializes a Server Object from a JSON save state // Initializes a Server Object from a JSON save state
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Server {
static fromJSON(value: any): Server {
return Generic_fromJSON(Server, value.data); return Generic_fromJSON(Server, value.data);
} }
} }

@ -5,7 +5,7 @@
import { OrderTypes } from "./data/OrderTypes"; import { OrderTypes } from "./data/OrderTypes";
import { PositionTypes } from "./data/PositionTypes"; import { PositionTypes } from "./data/PositionTypes";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
export class Order { export class Order {
readonly pos: PositionTypes; readonly pos: PositionTypes;
@ -46,15 +46,14 @@ export class Order {
/** /**
* Serialize the Order to a JSON save state. * Serialize the Order to a JSON save state.
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Order", this); return Generic_toJSON("Order", this);
} }
/** /**
* Initializes a Order from a JSON save state * Initializes a Order from a JSON save state
*/ */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Order {
static fromJSON(value: any): Order {
return Generic_fromJSON(Order, value.data); return Generic_fromJSON(Order, value.data);
} }
} }

@ -1,5 +1,5 @@
import { IMinMaxRange } from "../types"; import { IMinMaxRange } from "../types";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
import { getRandomInt } from "../utils/helpers/getRandomInt"; import { getRandomInt } from "../utils/helpers/getRandomInt";
export const StockForecastInfluenceLimit = 5; export const StockForecastInfluenceLimit = 5;
@ -36,7 +36,7 @@ function toNumber(n: number | IMinMaxRange): number {
return n; return n;
} }
case "object": { case "object": {
const range = n ; const range = n;
value = getRandomInt(range.min, range.max); value = getRandomInt(range.min, range.max);
break; break;
} }
@ -308,15 +308,14 @@ export class Stock {
/** /**
* Serialize the Stock to a JSON save state. * Serialize the Stock to a JSON save state.
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("Stock", this); return Generic_toJSON("Stock", this);
} }
/** /**
* Initializes a Stock from a JSON save state * Initializes a Stock from a JSON save state
*/ */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): Stock {
static fromJSON(value: any): Stock {
return Generic_fromJSON(Stock, value.data); return Generic_fromJSON(Stock, value.data);
} }
} }

@ -1,6 +1,6 @@
import { dialogBoxCreate } from "./ui/React/DialogBox"; import { dialogBoxCreate } from "./ui/React/DialogBox";
import { BaseServer } from "./Server/BaseServer"; import { BaseServer } from "./Server/BaseServer";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "./utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "./utils/JSONReviver";
import { removeLeadingSlash, isInRootDirectory } from "./Terminal/DirectoryHelpers"; import { removeLeadingSlash, isInRootDirectory } from "./Terminal/DirectoryHelpers";
/** /**
@ -86,7 +86,7 @@ export class TextFile {
/** /**
* Serialize the current file to a JSON save state. * Serialize the current file to a JSON save state.
*/ */
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("TextFile", this); return Generic_toJSON("TextFile", this);
} }
@ -100,8 +100,7 @@ export class TextFile {
/** /**
* Initiatizes a TextFile from a JSON save state. * Initiatizes a TextFile from a JSON save state.
*/ */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value: IReviverValue): TextFile {
static fromJSON(value: any): TextFile {
return Generic_fromJSON(TextFile, value.data); return Generic_fromJSON(TextFile, value.data);
} }
} }
@ -121,7 +120,7 @@ export function getTextFile(fn: string, server: BaseServer): TextFile | null {
filename = removeLeadingSlash(filename); filename = removeLeadingSlash(filename);
} }
for (const file of server.textFiles ) { for (const file of server.textFiles) {
if (file.fn === filename) { if (file.fn === filename) {
return file; return file;
} }

@ -50,12 +50,11 @@ export class MoneySourceTracker {
} }
// Serialize the current object to a JSON save state. // Serialize the current object to a JSON save state.
toJSON(): any { toJSON(): IReviverValue {
return Generic_toJSON("MoneySourceTracker", this); return Generic_toJSON("MoneySourceTracker", this);
} }
// Initiatizes a MoneySourceTracker object from a JSON save state. // Initiatizes a MoneySourceTracker object from a JSON save state.
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
static fromJSON(value: IReviverValue): MoneySourceTracker { static fromJSON(value: IReviverValue): MoneySourceTracker {
return Generic_fromJSON(MoneySourceTracker, value.data); return Generic_fromJSON(MoneySourceTracker, value.data);
} }