removeExport(exp)}>
+ props.mat.exp.map((exp: Export, index: number) =>
removeExport(exp)}>
Industry: {exp.ind}
City: {exp.city}
Amount/s: {exp.amt}
diff --git a/src/Corporation/ui/IndustryOffice.tsx b/src/Corporation/ui/IndustryOffice.tsx
index ac6e701b3..1e872373a 100644
--- a/src/Corporation/ui/IndustryOffice.tsx
+++ b/src/Corporation/ui/IndustryOffice.tsx
@@ -14,9 +14,10 @@ import { UpgradeOfficeSizePopup } from "./UpgradeOfficeSizePopup";
import { ThrowPartyPopup } from "./ThrowPartyPopup";
import { ICorporation } from "../ICorporation";
import { IPlayer } from "../../PersonObjects/IPlayer";
+import { CorporationRouting } from "./Routing";
interface IProps {
- routing: any;
+ routing: CorporationRouting;
corp: ICorporation;
currentCity: string;
player: IPlayer;
@@ -130,6 +131,7 @@ export function IndustryOffice(props: IProps): React.ReactElement {
function renderAutomaticEmployeeManagement(): React.ReactElement {
const division = props.routing.currentDivision; // Validated in constructor
+ if(division === null) return(<>>);
const office = division.offices[props.currentCity]; // Validated in constructor
const vechain = (props.corp.unlockUpgrades[4] === 1); // Has Vechain upgrade
@@ -432,6 +434,7 @@ export function IndustryOffice(props: IProps): React.ReactElement {
function renderManualEmployeeManagement(): React.ReactElement {
const corp = props.corp;
const division = props.routing.currentDivision; // Validated in constructor
+ if(division === null) return (<>>);
const office = division.offices[props.currentCity]; // Validated in constructor
function switchModeOnClick(): void {
@@ -542,6 +545,7 @@ export function IndustryOffice(props: IProps): React.ReactElement {
const corp = props.corp;
const division = props.routing.currentDivision; // Validated in constructor
+ if(division === null) return (<>>);
const office = division.offices[props.currentCity]; // Validated in constructor
const buttonStyle = {
@@ -560,7 +564,7 @@ export function IndustryOffice(props: IProps): React.ReactElement {
}
function hireEmployeeButtonOnClick(): void {
- office.findEmployees({ corporation: corp, industry: division });
+ office.findEmployees(props.player, { corporation: corp, industry: division });
}
// Autohire employee button
diff --git a/src/Corporation/ui/IndustryOverview.tsx b/src/Corporation/ui/IndustryOverview.tsx
index 2f7ed490e..5aad72ba0 100644
--- a/src/Corporation/ui/IndustryOverview.tsx
+++ b/src/Corporation/ui/IndustryOverview.tsx
@@ -13,9 +13,10 @@ import { ResearchPopup } from "./ResearchPopup";
import { createPopup } from "../../ui/React/createPopup";
import { ICorporation } from "../ICorporation";
import { IPlayer } from "../../PersonObjects/IPlayer";
+import { CorporationRouting } from "./Routing";
interface IProps {
- routing: any;
+ routing: CorporationRouting;
corp: ICorporation;
currentCity: string;
player: IPlayer;
@@ -24,7 +25,7 @@ interface IProps {
export function IndustryOverview(props: IProps): React.ReactElement {
function renderMakeProductButton(): React.ReactElement {
const division = props.routing.currentDivision; // Validated inside render()
-
+ if(division === null) return (<>>);
let createProductButtonText = "";
let createProductPopupText = "";
switch(division.type) {
@@ -83,6 +84,7 @@ export function IndustryOverview(props: IProps): React.ReactElement {
}
function openMakeProductPopup(): void {
+ if(division === null) return;
const popupId = "cmpy-mgmt-create-product-popup";
createPopup(popupId, MakeProductPopup, {
popupText: createProductPopupText,
@@ -108,7 +110,7 @@ export function IndustryOverview(props: IProps): React.ReactElement {
function renderText(): React.ReactElement {
const corp = props.corp;
const division = props.routing.currentDivision; // Validated inside render()
-
+ if(division === null) return (<>>);
const vechain = (corp.unlockUpgrades[4] === 1);
const profit = division.lastCycleRevenue.minus(division.lastCycleExpenses).toNumber();
@@ -129,6 +131,7 @@ export function IndustryOverview(props: IProps): React.ReactElement {
const profitStr = `Profit: ${numeralWrapper.formatMoney(profit)} / s`;
function productionMultHelpTipOnClick(): void {
+ if(division === null) return;
// Wrapper for createProgressBarText()
// Converts the industry's "effectiveness factors"
// into a graphic (string) depicting how high that effectiveness is
@@ -158,6 +161,7 @@ export function IndustryOverview(props: IProps): React.ReactElement {
}
function openResearchPopup(): void {
+ if(division === null) return;
const popupId = "corporation-research-popup-box";
createPopup(popupId, ResearchPopup, {
industry: division,
@@ -217,6 +221,7 @@ export function IndustryOverview(props: IProps): React.ReactElement {
function renderUpgrades(): React.ReactElement[] {
const corp = props.corp;
const division = props.routing.currentDivision; // Validated inside render()
+ if(division === null) return ([<>>]);
const office = division.offices[props.currentCity];
if (!(office instanceof OfficeSpace)) {
throw new Error(`Current City (${props.currentCity}) for UI does not have an OfficeSpace object`);
@@ -243,6 +248,7 @@ export function IndustryOverview(props: IProps): React.ReactElement {
}
function onClick(): void {
+ if(division === null) return;
if (corp.funds.lt(cost)) {
dialogBoxCreate("Insufficient funds");
} else {
@@ -266,7 +272,13 @@ export function IndustryOverview(props: IProps): React.ReactElement {
return upgrades;
}
- function renderUpgrade(props: any): React.ReactElement {
+ interface IRenderUpgradeProps {
+ onClick: () => void;
+ text: string;
+ tooltip: string;
+ }
+
+ function renderUpgrade(props: IRenderUpgradeProps): React.ReactElement {
return (
{props.text}
diff --git a/src/Corporation/ui/IndustryWarehouse.tsx b/src/Corporation/ui/IndustryWarehouse.tsx
index f47cf6811..cf436ba08 100644
--- a/src/Corporation/ui/IndustryWarehouse.tsx
+++ b/src/Corporation/ui/IndustryWarehouse.tsx
@@ -21,14 +21,16 @@ import { dialogBoxCreate } from "../../../utils/DialogBox";
import { createPopup } from "../../ui/React/createPopup";
import { isString } from "../../../utils/helpers/isString";
-import { ICorporation } from "../ICorporation";
-import { IPlayer } from "../../PersonObjects/IPlayer";
+import { ICorporation } from "../ICorporation";
+import { IIndustry } from "../IIndustry";
+import { CorporationRouting } from "./Routing";
+import { IPlayer } from "../../PersonObjects/IPlayer";
interface IProductProps {
corp: ICorporation;
- division: any;
+ division: IIndustry;
city: string;
- product: any;
+ product: Product;
player: IPlayer;
}
@@ -69,7 +71,7 @@ function ProductComponent(props: IProductProps): React.ReactElement {
if (isString(product.sCost)) {
sellButtonText += (" @ " + product.sCost);
} else {
- sellButtonText += (" @ " + numeralWrapper.format(product.sCost, "$0.000a"));
+ sellButtonText += (" @ " + numeralWrapper.formatMoney(product.sCost as number));
}
}
@@ -228,11 +230,11 @@ function ProductComponent(props: IProductProps): React.ReactElement {
}
interface IMaterialProps {
- corp: any;
- division: any;
- warehouse: any;
+ corp: ICorporation;
+ division: IIndustry;
+ warehouse: Warehouse;
city: string;
- mat: any;
+ mat: Material;
}
// Creates the UI for a single Material type
@@ -299,10 +301,10 @@ function MaterialComponent(props: IMaterialProps): React.ReactElement {
sellButtonText += " @ " + numeralWrapper.formatMoney(mat.bCost + markupLimit);
} else if (mat.sCost) {
if (isString(mat.sCost)) {
- const sCost = mat.sCost.replace(/MP/g, mat.bCost);
+ const sCost = (mat.sCost as string).replace(/MP/g, mat.bCost+'');
sellButtonText += " @ " + numeralWrapper.formatMoney(eval(sCost));
} else {
- sellButtonText += " @ " + numeralWrapper.formatMoney(mat.sCost);
+ sellButtonText += " @ " + numeralWrapper.formatMoney(mat.sCost as number);
}
}
} else {
@@ -405,8 +407,8 @@ function MaterialComponent(props: IMaterialProps): React.ReactElement {
}
interface IProps {
- corp: any;
- routing: any;
+ corp: ICorporation;
+ routing: CorporationRouting;
currentCity: string;
player: IPlayer;
}
@@ -414,7 +416,7 @@ interface IProps {
export function IndustryWarehouse(props: IProps): React.ReactElement {
// Returns a boolean indicating whether the given material is relevant for the
// current industry.
- function isRelevantMaterial(matName: string, division: any): boolean {
+ function isRelevantMaterial(matName: string, division: IIndustry): boolean {
// Materials that affect Production multiplier
const prodMultiplierMats = ["Hardware", "Robots", "AICores", "RealEstate"];
@@ -428,6 +430,7 @@ export function IndustryWarehouse(props: IProps): React.ReactElement {
function renderWarehouseUI(): React.ReactElement {
const corp = props.corp;
const division = props.routing.currentDivision; // Validated in render()
+ if(division === null) return (<>>);
const warehouse = division.warehouses[props.currentCity]; // Validated in render()
// General Storage information at the top
@@ -595,7 +598,7 @@ export function IndustryWarehouse(props: IProps): React.ReactElement {
}
const warehouse = division.warehouses[props.currentCity];
- function purchaseWarehouse(division: any, city: string): void {
+ function purchaseWarehouse(division: IIndustry, city: string): void {
if (props.corp.funds.lt(CorporationConstants.WarehouseInitialCost)) {
dialogBoxCreate("You do not have enough funds to do this!");
} else {
diff --git a/src/Corporation/ui/IssueNewSharesPopup.tsx b/src/Corporation/ui/IssueNewSharesPopup.tsx
index 1b4062518..9591a15c7 100644
--- a/src/Corporation/ui/IssueNewSharesPopup.tsx
+++ b/src/Corporation/ui/IssueNewSharesPopup.tsx
@@ -40,7 +40,7 @@ function EffectText(props: IEffectTextProps): React.ReactElement {
}
interface IProps {
- corp: any;
+ corp: ICorporation;
popupId: string;
}
diff --git a/src/Corporation/ui/LimitProductProductionPopup.tsx b/src/Corporation/ui/LimitProductProductionPopup.tsx
index 10cb76121..bf9c51f70 100644
--- a/src/Corporation/ui/LimitProductProductionPopup.tsx
+++ b/src/Corporation/ui/LimitProductProductionPopup.tsx
@@ -1,10 +1,11 @@
import React, { useState } from 'react';
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { removePopup } from "../../ui/React/createPopup";
+import { Product } from "../Product";
interface IProps {
- product: any;
- city: any;
+ product: Product;
+ city: string;
popupId: string;
}
diff --git a/src/Corporation/ui/MakeProductPopup.tsx b/src/Corporation/ui/MakeProductPopup.tsx
index 45745631a..a3806cec1 100644
--- a/src/Corporation/ui/MakeProductPopup.tsx
+++ b/src/Corporation/ui/MakeProductPopup.tsx
@@ -4,10 +4,11 @@ import { removePopup } from "../../ui/React/createPopup";
import { Industries } from "../IndustryData";
import { Product } from "../Product";
import { ICorporation } from "../ICorporation";
+import { IIndustry } from "../IIndustry";
interface IProps {
popupText: string;
- division: any;
+ division: IIndustry;
corp: ICorporation;
popupId: string;
}
diff --git a/src/Corporation/ui/MaterialMarketTaPopup.tsx b/src/Corporation/ui/MaterialMarketTaPopup.tsx
index fa7a4273c..94af5f78c 100644
--- a/src/Corporation/ui/MaterialMarketTaPopup.tsx
+++ b/src/Corporation/ui/MaterialMarketTaPopup.tsx
@@ -1,9 +1,12 @@
import React, { useState } from 'react';
import { numeralWrapper } from "../../ui/numeralFormat";
+import { IIndustry } from "../IIndustry";
+import { ICorporation } from "../ICorporation";
+import { Material } from "../Material";
interface IMarketTA2Props {
- industry: any;
- mat: any;
+ industry: IIndustry;
+ mat: Material;
}
function MarketTA2(props: IMarketTA2Props): React.ReactElement {
@@ -70,9 +73,9 @@ function MarketTA2(props: IMarketTA2Props): React.ReactElement {
}
interface IProps {
- mat: any;
- industry: any;
- corp: any;
+ mat: Material;
+ industry: IIndustry;
+ corp: ICorporation;
popupId: string;
}
diff --git a/src/Corporation/ui/NewIndustryPopup.tsx b/src/Corporation/ui/NewIndustryPopup.tsx
index 4ae95c876..f619e5423 100644
--- a/src/Corporation/ui/NewIndustryPopup.tsx
+++ b/src/Corporation/ui/NewIndustryPopup.tsx
@@ -7,17 +7,19 @@ import {
IndustryDescriptions } from "../IndustryData";
import { Industry } from "../Industry";
import { ICorporation } from "../ICorporation";
+import { IIndustry } from "../IIndustry";
+import { CorporationRouting } from "./Routing";
interface IProps {
corp: ICorporation;
popupId: string;
- routing: any;
+ routing: CorporationRouting;
}
// Create a popup that lets the player create a new industry.
// This is created when the player clicks the "Expand into new Industry" header tab
export function NewIndustryPopup(props: IProps): React.ReactElement {
const allIndustries = Object.keys(Industries).sort();
- const possibleIndustries = allIndustries.filter((industryType: string) => props.corp.divisions.find((division: any) => division.type === industryType) === undefined).sort();
+ const possibleIndustries = allIndustries.filter((industryType: string) => props.corp.divisions.find((division: IIndustry) => division.type === industryType) === undefined).sort();
const [industry, setIndustry] = useState(possibleIndustries.length > 0 ? possibleIndustries[0] : '');
const [name, setName] = useState('');
diff --git a/src/Corporation/ui/Overview.tsx b/src/Corporation/ui/Overview.tsx
index 95d13c818..2a3cdc314 100644
--- a/src/Corporation/ui/Overview.tsx
+++ b/src/Corporation/ui/Overview.tsx
@@ -12,7 +12,9 @@ import { GoPublicPopup } from "./GoPublicPopup";
import { CorporationConstants } from "../data/Constants";
import { CorporationUnlockUpgrades } from "../data/CorporationUnlockUpgrades";
-import { CorporationUpgrades } from "../data/CorporationUpgrades";
+import {
+ CorporationUpgrade,
+ CorporationUpgrades } from "../data/CorporationUpgrades";
import { CONSTANTS } from "../../Constants";
import { numeralWrapper } from "../../ui/numeralFormat";
@@ -26,9 +28,21 @@ interface IProps {
player: IPlayer;
}
+interface GeneralBtns {
+ bribeFactions: React.ReactElement;
+ getStarterGuide: React.ReactElement;
+}
+
export function Overview(props: IProps): React.ReactElement {
// Generic Function for Creating a button
- function createButton(props: any): React.ReactElement {
+ interface ICreateButtonProps {
+ text: string
+ class?: string;
+ display?: string;
+ tooltip?: string;
+ onClick?: (event: React.MouseEvent) => void;
+ }
+ function createButton(props: ICreateButtonProps): React.ReactElement {
let className = props.class ? props.class : "std-button";
const displayStyle = props.display ? props.display : "block";
const hasTooltip = (props.tooltip != null);
@@ -117,11 +131,10 @@ export function Overview(props: IProps): React.ReactElement {
function renderButtons(): React.ReactElement {
// Create a "Getting Started Guide" button that lets player view the
// handbook and adds it to the players home computer
- const getStarterGuideOnClick = props.corp.getStarterGuide.bind(props.corp);
const getStarterGuideBtn = createButton({
class: "a-link-button",
display: "inline-block",
- onClick: getStarterGuideOnClick,
+ onClick: () => props.corp.getStarterGuide(props.player),
text: "Getting Started Guide",
tooltip: "Get a copy of and read 'The Complete Handbook for Creating a Successful Corporation.' " +
"This is a .lit file that guides you through the beginning of setting up a Corporation and " +
@@ -166,10 +179,10 @@ export function Overview(props: IProps): React.ReactElement {
// Render the buttons for when your Corporation is still private
- function renderPrivateButtons(generalBtns: any): React.ReactElement {
+ function renderPrivateButtons(generalBtns: GeneralBtns): React.ReactElement {
const fundingAvailable = (props.corp.fundingRound < 4);
const findInvestorsClassName = fundingAvailable ? "std-button" : "a-link-button-inactive";
- const findInvestorsTooltip = fundingAvailable ? "Search for private investors who will give you startup funding in exchangefor equity (stock shares) in your company" : null;
+ const findInvestorsTooltip = fundingAvailable ? "Search for private investors who will give you startup funding in exchangefor equity (stock shares) in your company" : undefined;
function openFindInvestorsPopup(): void {
const popupId = "cmpy-mgmt-find-investors-popup";
@@ -192,7 +205,6 @@ export function Overview(props: IProps): React.ReactElement {
const findInvestorsBtn = createButton({
class: findInvestorsClassName,
onClick: openFindInvestorsPopup,
- style: "inline-block",
text: "Find Investors",
tooltip: findInvestorsTooltip,
display: "inline-block",
@@ -200,7 +212,6 @@ export function Overview(props: IProps): React.ReactElement {
const goPublicBtn = createButton({
class: "std-button",
onClick: openGoPublicPopup,
- style: "inline-block",
display: "inline-block",
text: "Go Public",
tooltip: "Become a publicly traded and owned entity. Going public " +
@@ -221,7 +232,7 @@ export function Overview(props: IProps): React.ReactElement {
}
// Render the buttons for when your Corporation has gone public
- function renderPublicButtons(generalBtns: any): React.ReactElement {
+ function renderPublicButtons(generalBtns: GeneralBtns): React.ReactElement {
const corp = props.corp;
const sellSharesOnCd = (corp.shareSaleCooldown > 0);
@@ -234,7 +245,7 @@ export function Overview(props: IProps): React.ReactElement {
const sellSharesBtn = createButton({
class: sellSharesClass,
display: "inline-block",
- onClick: function(event: MouseEvent) {
+ onClick: function(event: React.MouseEvent) {
if(!event.isTrusted) return;
const popupId = "cmpy-mgmt-sell-shares-popup";
createPopup(popupId, SellSharesPopup, {
@@ -333,8 +344,13 @@ export function Overview(props: IProps): React.ReactElement {
}
});
+ interface UpgradeData {
+ upgradeData: CorporationUpgrade;
+ upgradeLevel: number;
+ }
+
// Create an array of properties of all unlocks
- const levelableUpgradeProps = [];
+ const levelableUpgradeProps: UpgradeData[] = [];
for (let i = 0; i < props.corp.upgrades.length; ++i) {
const upgradeData = CorporationUpgrades[i];
const level = props.corp.upgrades[i];
@@ -353,7 +369,7 @@ export function Overview(props: IProps): React.ReactElement {
Upgrades
{
- levelableUpgradeProps.map((data: any) => ): void {
- setValue(event.target.value);
+ setValue(parseFloat(event.target.value));
}
@@ -25,7 +27,7 @@ function MarketTA2(props: IProps): React.ReactElement {
rerender();
}
- const sCost = parseFloat(value);
+ const sCost = value;
let markup = 1;
if (sCost > props.product.pCost) {
if ((sCost - props.product.pCost) > markupLimit) {
diff --git a/src/Corporation/ui/PurchaseMaterialPopup.tsx b/src/Corporation/ui/PurchaseMaterialPopup.tsx
index 9156d20fd..141176855 100644
--- a/src/Corporation/ui/PurchaseMaterialPopup.tsx
+++ b/src/Corporation/ui/PurchaseMaterialPopup.tsx
@@ -2,11 +2,15 @@ import React, { useState } from 'react';
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { removePopup } from "../../ui/React/createPopup";
import { MaterialSizes } from "../MaterialSizes";
+import { Warehouse } from "../Warehouse";
+import { Material } from "../Material";
+import { IIndustry } from "../IIndustry";
+import { ICorporation } from "../ICorporation";
import { numeralWrapper } from "../../ui/numeralFormat";
interface IBulkPurchaseTextProps {
- warehouse: any;
- mat: any;
+ warehouse: Warehouse;
+ mat: Material;
amount: string;
}
@@ -28,10 +32,10 @@ function BulkPurchaseText(props: IBulkPurchaseTextProps): React.ReactElement {
}
interface IProps {
- mat: any;
- industry: any;
- warehouse: any;
- corp: any;
+ mat: Material;
+ industry: IIndustry;
+ warehouse: Warehouse;
+ corp: ICorporation;
popupId: string;
}
@@ -89,10 +93,11 @@ export function PurchaseMaterialPopup(props: IProps): React.ReactElement {
const [buyAmt, setBuyAmt] = useState(props.mat.buy ? props.mat.buy : null);
function purchaseMaterial(): void {
- if (isNaN(parseFloat(buyAmt))) {
+ if(buyAmt === null) return;
+ if (isNaN(buyAmt)) {
dialogBoxCreate("Invalid amount");
} else {
- props.mat.buy = parseFloat(buyAmt);
+ props.mat.buy = buyAmt;
if (isNaN(props.mat.buy)) props.mat.buy = 0;
removePopup(props.popupId);
}
@@ -108,7 +113,7 @@ export function PurchaseMaterialPopup(props: IProps): React.ReactElement {
}
function onChange(event: React.ChangeEvent): void {
- setBuyAmt(event.target.value);
+ setBuyAmt(parseFloat(event.target.value));
}
return (<>
diff --git a/src/Corporation/ui/ResearchPopup.tsx b/src/Corporation/ui/ResearchPopup.tsx
index eb63a54a9..72010b249 100644
--- a/src/Corporation/ui/ResearchPopup.tsx
+++ b/src/Corporation/ui/ResearchPopup.tsx
@@ -6,9 +6,10 @@ import { IndustryResearchTrees } from "../IndustryData";
import { CorporationConstants } from "../data/Constants";
import { ResearchMap } from "../ResearchMap";
import { Treant } from 'treant-js';
+import { IIndustry } from "../IIndustry";
interface IProps {
- industry: any;
+ industry: IIndustry;
popupId: string;
}
diff --git a/src/Corporation/ui/Routing.ts b/src/Corporation/ui/Routing.ts
index 307f64f16..b3ae08967 100644
--- a/src/Corporation/ui/Routing.ts
+++ b/src/Corporation/ui/Routing.ts
@@ -1,33 +1,9 @@
import { IMap } from "../../types";
+import { ICorporation } from "../ICorporation";
+import { IIndustry } from "../IIndustry";
export const overviewPage = "Overview";
-// Interfaces for whatever's required to sanitize routing with Corporation Data
-interface IOfficeSpace {
- loc: string;
- cost: number;
- size: number;
- comf: number;
- beau: number;
- tier: any;
- minEne: number;
- maxEne: number;
- minHap: number;
- maxHap: number;
- maxMor: number;
- employees: any;
- employeeProd: any;
-}
-
-interface IDivision {
- name: string;
- offices: IMap;
-}
-
-interface ICorporation {
- divisions: IDivision[];
-}
-
/**
* Keeps track of what content is currently being displayed for the Corporation UI
*/
@@ -39,7 +15,7 @@ export class CorporationRouting {
// Stores a reference to the Division instance that the routing is currently on
// This will be null if routing is on the overview page
- currentDivision: IDivision | null = null;
+ currentDivision: IIndustry | null = null;
constructor(corp: ICorporation) {
this.corp = corp;
diff --git a/src/Corporation/ui/SellMaterialPopup.tsx b/src/Corporation/ui/SellMaterialPopup.tsx
index 6a481501e..e209c8125 100644
--- a/src/Corporation/ui/SellMaterialPopup.tsx
+++ b/src/Corporation/ui/SellMaterialPopup.tsx
@@ -2,9 +2,10 @@ import React, { useState } from 'react';
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { removePopup } from "../../ui/React/createPopup";
import { ICorporation } from "../ICorporation";
+import { Material } from "../Material";
-function initialPrice(mat: any): string {
- let val = mat.sCost ? mat.sCost : '';
+function initialPrice(mat: Material): string {
+ let val = mat.sCost ? mat.sCost+'' : '';
if (mat.marketTa2) {
val += " (Market-TA.II)";
} else if (mat.marketTa1) {
@@ -14,7 +15,7 @@ function initialPrice(mat: any): string {
}
interface IProps {
- mat: any;
+ mat: Material;
corp: ICorporation;
popupId: string;
}
@@ -31,7 +32,7 @@ export function SellMaterialPopup(props: IProps): React.ReactElement {
if(qty === '') qty = '0';
let cost = p.replace(/\s+/g, '');
cost = cost.replace(/[^-()\d/*+.MP]/g, ''); //Sanitize cost
- let temp = cost.replace(/MP/g, props.mat.bCost);
+ let temp = cost.replace(/MP/g, props.mat.bCost+'');
try {
temp = eval(temp);
} catch(e) {
diff --git a/src/Corporation/ui/SellProductPopup.tsx b/src/Corporation/ui/SellProductPopup.tsx
index ae4a40270..3c60fbc32 100644
--- a/src/Corporation/ui/SellProductPopup.tsx
+++ b/src/Corporation/ui/SellProductPopup.tsx
@@ -2,9 +2,10 @@ import React, { useState } from 'react';
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { removePopup } from "../../ui/React/createPopup";
import { Cities } from "../../Locations/Cities";
+import { Product } from "../Product";
-function initialPrice(product: any): string {
- let val = product.sCost ? product.sCost : '';
+function initialPrice(product: Product): string {
+ let val = product.sCost ? product.sCost+'' : '';
if (product.marketTa2) {
val += " (Market-TA.II)";
} else if (product.marketTa1) {
@@ -14,7 +15,7 @@ function initialPrice(product: any): string {
}
interface IProps {
- product: any;
+ product: Product;
city: string;
popupId: string;
}
diff --git a/src/Corporation/ui/SellSharesPopup.tsx b/src/Corporation/ui/SellSharesPopup.tsx
index 45ab140a2..f8b898810 100644
--- a/src/Corporation/ui/SellSharesPopup.tsx
+++ b/src/Corporation/ui/SellSharesPopup.tsx
@@ -22,7 +22,7 @@ export function SellSharesPopup(props: IProps): React.ReactElement {
else setShares(Math.round(parseFloat(event.target.value)));
}
- function ProfitIndicator(props: {shares: number | null; corp: any}): React.ReactElement {
+ function ProfitIndicator(props: {shares: number | null; corp: ICorporation}): React.ReactElement {
if(props.shares === null) return (<>>);
if (isNaN(props.shares) || props.shares <= 0) {
return (<>ERROR: Invalid value entered for number of shares to sell>);
diff --git a/src/Corporation/ui/UpgradeOfficeSizePopup.tsx b/src/Corporation/ui/UpgradeOfficeSizePopup.tsx
index 3f058e40c..ceddedccd 100644
--- a/src/Corporation/ui/UpgradeOfficeSizePopup.tsx
+++ b/src/Corporation/ui/UpgradeOfficeSizePopup.tsx
@@ -57,7 +57,7 @@ export function UpgradeOfficeSizePopup(props: IProps): React.ReactElement {
interface IUpgradeButton {
cost: number;
size: number;
- corp: any;
+ corp: ICorporation;
}
function UpgradeSizeButton(props: IUpgradeButton): React.ReactElement {