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 { 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 { IPlayer } from "../PersonObjects/IPlayer";
import { AugmentationNames } from "./data/AugmentationNames";
@ -610,13 +610,12 @@ export class Augmentation {
}
// Serialize the current object to a JSON save state.
toJSON(): any {
toJSON(): IReviverValue {
return Generic_toJSON("Augmentation", this);
}
// Initiatizes a Augmentation object from a JSON save state.
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
static fromJSON(value: any): Augmentation {
static fromJSON(value: IReviverValue): Augmentation {
return Generic_fromJSON(Augmentation, value.data);
}
}

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

@ -1,5 +1,5 @@
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 {
name?: string;
@ -15,12 +15,11 @@ export class ActionIdentifier implements IActionIdentifier {
if (params.type) this.type = params.type;
}
toJSON(): any {
toJSON(): IReviverValue {
return Generic_toJSON("ActionIdentifier", this);
}
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
static fromJSON(value: any): ActionIdentifier {
static fromJSON(value: IReviverValue): ActionIdentifier {
return Generic_fromJSON(ActionIdentifier, value.data);
}
}

@ -1,5 +1,5 @@
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 {
constructor(params: IOperationParams | null = null) {
@ -20,12 +20,11 @@ export class BlackOperation extends Operation {
return 1;
}
toJSON(): any {
toJSON(): IReviverValue {
return Generic_toJSON("BlackOperation", this);
}
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
static fromJSON(value: any): Operation {
static fromJSON(value: IReviverValue): Operation {
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 { IActionIdentifier } from "./IActionIdentifier";
import { ActionIdentifier } from "./ActionIdentifier";
@ -2409,15 +2409,14 @@ export class Bladeburner implements IBladeburner {
/**
* Serialize the current object to a JSON save state.
*/
toJSON(): any {
toJSON(): IReviverValue {
return Generic_toJSON("Bladeburner", this);
}
/**
* Initiatizes a Bladeburner object from a JSON save state.
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
static fromJSON(value: any): Bladeburner {
static fromJSON(value: IReviverValue): Bladeburner {
return Generic_fromJSON(Bladeburner, value.data);
}
}

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

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

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

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

@ -2,7 +2,7 @@ import { codingContractTypesMetadata, DescriptionFunc, GeneratorFunc, SolverFunc
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";
/* 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.
*/
toJSON(): any {
toJSON(): IReviverValue {
return Generic_toJSON("CodingContract", this);
}
/**
* Initiatizes a CodingContract from a JSON save state.
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
static fromJSON(value: any): CodingContract {
static fromJSON(value: IReviverValue): CodingContract {
return Generic_fromJSON(CodingContract, value.data);
}
}

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

@ -11,7 +11,7 @@ import { LiteratureNames } from "../Literature/data/LiteratureNames";
import { IPlayer } from "../PersonObjects/IPlayer";
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";
interface IParams {
@ -433,15 +433,14 @@ export class Corporation {
/**
* Serialize the current object to a JSON save state.
*/
toJSON(): any {
toJSON(): IReviverValue {
return Generic_toJSON("Corporation", this);
}
/**
* Initiatizes a Corporation object from a JSON save state.
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
static fromJSON(value: any): Corporation {
static fromJSON(value: IReviverValue): Corporation {
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
const AllCorporationStates: string[] = ["START", "PURCHASE", "PRODUCTION", "SALE", "EXPORT"];
@ -28,13 +28,12 @@ export class CorporationState {
}
// Serialize the current object to a JSON save state.
toJSON(): any {
toJSON(): IReviverValue {
return Generic_toJSON("CorporationState", this);
}
// Initiatizes a CorporationState object from a JSON save state.
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
static fromJSON(value: any): CorporationState {
static fromJSON(value: IReviverValue): CorporationState {
return Generic_fromJSON(CorporationState, value.data);
}
}

@ -1,6 +1,6 @@
import { CorporationConstants } from "./data/Constants";
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 { ICorporation } from "./ICorporation";
import { OfficeSpace } from "./OfficeSpace";
@ -128,12 +128,11 @@ export class Employee {
return mult;
}
toJSON(): any {
toJSON(): IReviverValue {
return Generic_toJSON("Employee", this);
}
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
static fromJSON(value: any): Employee {
static fromJSON(value: IReviverValue): Employee {
return Generic_fromJSON(Employee, value.data);
}
}

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

@ -4,6 +4,7 @@ import { ICorporation } from "./ICorporation";
import { OfficeSpace } from "./OfficeSpace";
import { Product } from "./Product";
import { IndustryUpgrade } from "./IndustryUpgrades";
import { IReviverValue } from "../utils/JSONReviver";
export interface IIndustry {
name: string;
@ -73,5 +74,5 @@ export interface IIndustry {
getSalesMultiplier(): number;
getScientificResearchMultiplier(): 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 { Industries, IndustryStartingCosts, IndustryResearchTrees } from "./IndustryData";
import { CorporationConstants } from "./data/Constants";
@ -1438,15 +1438,14 @@ export class Industry implements IIndustry {
/**
* Serialize the current object to a JSON save state.
*/
toJSON(): any {
toJSON(): IReviverValue {
return Generic_toJSON("Industry", this);
}
/**
* Initiatizes a Industry object from a JSON save state.
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
static fromJSON(value: any): Industry {
static fromJSON(value: IReviverValue): Industry {
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";
interface IConstructorParams {
@ -229,13 +229,12 @@ export class Material {
}
// Serialize the current object to a JSON save state.
toJSON(): any {
toJSON(): IReviverValue {
return Generic_toJSON("Material", this);
}
// Initiatizes a Material object from a JSON save state.
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
static fromJSON(value: any): Material {
static fromJSON(value: IReviverValue): Material {
return Generic_fromJSON(Material, value.data);
}
}

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

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

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

@ -1,5 +1,5 @@
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 {
x: number;
@ -74,15 +74,14 @@ export class ActiveFragment {
/**
* Serialize an active fragment to a JSON save state.
*/
toJSON(): any {
toJSON(): IReviverValue {
return Generic_toJSON("ActiveFragment", this);
}
/**
* Initializes an acive fragment from a JSON save state
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
static fromJSON(value: any): ActiveFragment {
static fromJSON(value: IReviverValue): ActiveFragment {
return Generic_fromJSON(ActiveFragment, value.data);
}
}

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

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

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

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

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

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

@ -17,7 +17,7 @@ import {
import { HacknetNodeConstants } from "./data/Constants";
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";
export class HacknetNode implements IHacknetNode {
@ -123,15 +123,14 @@ export class HacknetNode implements IHacknetNode {
/**
* Serialize the current object to a JSON save state.
*/
toJSON(): any {
toJSON(): IReviverValue {
return Generic_toJSON("HacknetNode", this);
}
/**
* Initiatizes a HacknetNode object from a JSON save state.
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
static fromJSON(value: any): HacknetNode {
static fromJSON(value: IReviverValue): HacknetNode {
return Generic_fromJSON(HacknetNode, value.data);
}
}

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

@ -10,7 +10,7 @@ import { HashUpgrades } from "./HashUpgrades";
import { HashUpgrade } from "./HashUpgrade";
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 {
// 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.
toJSON(): any {
toJSON(): IReviverValue {
return Generic_toJSON("HashManager", this);
}
// Initiatizes a HashManager object from a JSON save state.
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
static fromJSON(value: any): HashManager {
static fromJSON(value: IReviverValue): HashManager {
return Generic_fromJSON(HashManager, value.data);
}
}

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

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

@ -21,7 +21,7 @@ import { SnackbarEvents, ToastVariant } from "./ui/React/Snackbar";
import * as ExportBonus from "./ExportBonus";
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 { v1APIBreak } from "./utils/v1APIBreak";
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
@ -234,11 +234,11 @@ class BitburnerSaveObject {
return Promise.resolve(data);
}
toJSON(): any {
toJSON(): IReviverValue {
return Generic_toJSON("BitburnerSaveObject", this);
}
static fromJSON(value: { data: any }): BitburnerSaveObject {
static fromJSON(value: IReviverValue): BitburnerSaveObject {
return Generic_fromJSON(BitburnerSaveObject, value.data);
}
}

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

@ -7,7 +7,7 @@
import { calculateRamUsage, RamUsageEntry } from "./RamCalculations";
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 { IPlayer } from "../PersonObjects/IPlayer";
@ -133,13 +133,12 @@ export class Script {
}
// Serialize the current object to a JSON save state
toJSON(): any {
toJSON(): IReviverValue {
return Generic_toJSON("Script", this);
}
// Initializes a Script Object from a JSON save state
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
static fromJSON(value: any): Script {
static fromJSON(value: IReviverValue): Script {
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.
s.url = "";

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

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

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

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

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