@@ -40,7 +40,7 @@ export function MainPanel(props: IProps): React.ReactElement {
)
}
- function renderDivisionPage() {
+ function renderDivisionPage(): React.ReactElement {
// Note: Division is the same thing as Industry...I wasn't consistent with naming
const division = props.routing.currentDivision;
if (division == null) {
diff --git a/src/Corporation/ui/Overview.tsx b/src/Corporation/ui/Overview.tsx
index 7305d97e8..5972cd6a4 100644
--- a/src/Corporation/ui/Overview.tsx
+++ b/src/Corporation/ui/Overview.tsx
@@ -24,7 +24,7 @@ interface IProps {
export function Overview(props: IProps): React.ReactElement {
// Generic Function for Creating a button
- function createButton(props: any) {
+ function createButton(props: any): React.ReactElement {
let className = props.class ? props.class : "std-button";
const displayStyle = props.display ? props.display : "block";
const hasTooltip = (props.tooltip != null);
@@ -46,7 +46,7 @@ export function Overview(props: IProps): React.ReactElement {
}
// Returns a string with general information about Corporation
- function getOverviewText() {
+ function getOverviewText(): string {
// Formatted text for profit
const profit = props.corp.revenue.minus(props.corp.expenses).toNumber(),
profitStr = profit >= 0 ? numeralWrapper.formatMoney(profit) : "-" + numeralWrapper.format(-1 * profit, "$0.000a");
@@ -110,7 +110,7 @@ export function Overview(props: IProps): React.ReactElement {
// Render the buttons that lie below the overview text.
// These are mainly for things such as managing finances/stock
- function renderButtons() {
+ 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);
@@ -124,7 +124,7 @@ export function Overview(props: IProps): React.ReactElement {
"provides some tips/pointers for helping you get started with managing it.",
});
- function openBribeFactionPopup() {
+ function openBribeFactionPopup(): void {
const popupId = "corp-bribe-popup";
createPopup(popupId, BribeFactionPopup, {
player: props.player,
@@ -162,7 +162,7 @@ export function Overview(props: IProps): React.ReactElement {
// Render the buttons for when your Corporation is still private
- function renderPrivateButtons(generalBtns: any) {
+ function renderPrivateButtons(generalBtns: any): 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;
@@ -202,7 +202,7 @@ export function Overview(props: IProps): React.ReactElement {
}
// Render the buttons for when your Corporation has gone public
- function renderPublicButtons(generalBtns: any) {
+ function renderPublicButtons(generalBtns: any): React.ReactElement {
const corp = props.corp;
const sellSharesOnCd = (corp.shareSaleCooldown > 0);
@@ -228,7 +228,7 @@ export function Overview(props: IProps): React.ReactElement {
tooltip: sellSharesTooltip,
});
- function openBuybackSharesPopup() {
+ function openBuybackSharesPopup(): void {
const popupId = "corp-buyback-shares-popup";
createPopup(popupId, BuybackSharesPopup, {
player: props.player,
@@ -281,9 +281,9 @@ export function Overview(props: IProps): React.ReactElement {
}
// Render the UI for Corporation upgrades
- function renderUpgrades() {
+ function renderUpgrades(): React.ReactElement {
// Don't show upgrades
- if (props.corp.divisions.length <= 0) { return; }
+ if (props.corp.divisions.length <= 0) { return (<>>); }
// Create an array of all Unlocks
const unlockUpgrades: React.ReactElement[] = [];
diff --git a/src/Corporation/ui/SellSharesPopup.tsx b/src/Corporation/ui/SellSharesPopup.tsx
index 385074223..10d075db1 100644
--- a/src/Corporation/ui/SellSharesPopup.tsx
+++ b/src/Corporation/ui/SellSharesPopup.tsx
@@ -4,7 +4,6 @@ import { dialogBoxCreate } from "../../../utils/DialogBox";
import { IPlayer } from "../../PersonObjects/IPlayer";
import { removePopup } from "../../ui/React/createPopup";
import { CorporationConstants } from "../data/Constants";
-import { createElement } from "../../../utils/uiHelpers/createElement";
interface IProps {
corp: any;
@@ -22,7 +21,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: any}): 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>);
@@ -35,7 +34,7 @@ export function SellSharesPopup(props: IProps): React.ReactElement {
}
}
- function sell() {
+ function sell(): void {
if(shares === null) return;
if (isNaN(shares) || shares <= 0) {
dialogBoxCreate("ERROR: Invalid value for number of shares");
@@ -50,7 +49,7 @@ export function SellSharesPopup(props: IProps): React.ReactElement {
props.corp.numShares -= shares;
if (isNaN(props.corp.issuedShares)) {
console.error(`Corporation issuedShares is NaN: ${props.corp.issuedShares}`);
- var res = parseInt(props.corp.issuedShares);
+ const res = parseInt(props.corp.issuedShares);
if (isNaN(res)) {
props.corp.issuedShares = 0;
} else {
@@ -74,7 +73,7 @@ export function SellSharesPopup(props: IProps): React.ReactElement {
}
- function onKeyDown(event: React.KeyboardEvent
) {
+ function onKeyDown(event: React.KeyboardEvent): void {
if (event.keyCode === 13) sell();
}
diff --git a/src/Corporation/ui/ThrowPartyPopup.tsx b/src/Corporation/ui/ThrowPartyPopup.tsx
index ff267fa38..ee25fa830 100644
--- a/src/Corporation/ui/ThrowPartyPopup.tsx
+++ b/src/Corporation/ui/ThrowPartyPopup.tsx
@@ -17,7 +17,7 @@ export function ThrowPartyPopup(props: IProps): React.ReactElement {
setCost(parseFloat(event.target.value));
}
- function throwParty() {
+ function throwParty(): void {
if (cost === null || isNaN(cost) || cost < 0) {
dialogBoxCreate("Invalid value entered");
} else {
@@ -37,14 +37,14 @@ export function ThrowPartyPopup(props: IProps): React.ReactElement {
}
}
- function EffectText(props: {cost: number | null, office: IOfficeSpace}): React.ReactElement {
+ function EffectText(props: {cost: number | null; office: IOfficeSpace}): React.ReactElement {
let cost = props.cost;
if(cost !== null && (isNaN(cost) || cost < 0)) return Invalid value entered!
if(cost === null) cost = 0;
return Throwing this party will cost a total of {numeralWrapper.formatMoney(cost * props.office.employees.length)}
}
- function onKeyDown(event: React.KeyboardEvent) {
+ function onKeyDown(event: React.KeyboardEvent): void {
if (event.keyCode === 13) throwParty();
}
diff --git a/src/Corporation/ui/UnlockUpgrade.tsx b/src/Corporation/ui/UnlockUpgrade.tsx
index beb7965bf..77bb92873 100644
--- a/src/Corporation/ui/UnlockUpgrade.tsx
+++ b/src/Corporation/ui/UnlockUpgrade.tsx
@@ -13,7 +13,7 @@ export function UnlockUpgrade(props: IProps): React.ReactElement {
const data = props.upgradeData;
const text = `${data[2]} - ${numeralWrapper.formatMoney(data[1])}`;
const tooltip = data[3];
- function onClick() {
+ function onClick(): void {
const corp = props.corp;
if (corp.funds.lt(data[1])) {
dialogBoxCreate("Insufficient funds");
diff --git a/src/Corporation/ui/UpgradeOfficeSizePopup.tsx b/src/Corporation/ui/UpgradeOfficeSizePopup.tsx
index b40cf75dd..087548a92 100644
--- a/src/Corporation/ui/UpgradeOfficeSizePopup.tsx
+++ b/src/Corporation/ui/UpgradeOfficeSizePopup.tsx
@@ -24,12 +24,12 @@ export function UpgradeOfficeSizePopup(props: IProps): React.ReactElement {
const upgradeCost15 = CorporationConstants.OfficeInitialCost * mult;
//Calculate max upgrade size and cost
- let maxMult = (props.corp.funds.dividedBy(CorporationConstants.OfficeInitialCost)).toNumber();
+ const maxMult = (props.corp.funds.dividedBy(CorporationConstants.OfficeInitialCost)).toNumber();
let maxNum = 1;
mult = Math.pow(costMultiplier, initialPriceMult);
while(maxNum < 50) { //Hard cap of 50x (extra 150 employees)
if (mult >= maxMult) break;
- let multIncrease = Math.pow(costMultiplier, initialPriceMult + maxNum);
+ const multIncrease = Math.pow(costMultiplier, initialPriceMult + maxNum);
if (mult + multIncrease > maxMult) {
break;
} else {