From e23602113092bcd88916b01e833a9e55fb9f5326 Mon Sep 17 00:00:00 2001
From: Svornost <11434-svornost@users.noreply.gitgud.io>
Date: Sat, 27 Feb 2021 16:55:02 -0800
Subject: [PATCH] Type fixes

---
 src/facilities/incubator/incubatorUtils.js   | 2 +-
 src/facilities/nursery/utils/nurseryUtils.js | 2 +-
 src/npc/generate/generateGenetics.js         | 4 ++--
 src/npc/generate/generateNewSlaveJS.js       | 1 +
 src/npc/generate/heroCreator.js              | 5 ++++-
 src/npc/infants/infantSummary.js             | 7 +++----
 src/npc/infants/longInfantDescription.js     | 2 +-
 7 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/facilities/incubator/incubatorUtils.js b/src/facilities/incubator/incubatorUtils.js
index 850b0d40a9c..ad935672e00 100644
--- a/src/facilities/incubator/incubatorUtils.js
+++ b/src/facilities/incubator/incubatorUtils.js
@@ -1,6 +1,6 @@
 /**
  * Sends a child to the Incubator if it has room
- * @param {App.Entity.SlaveState|App.Entity.InfantState} child
+ * @param {App.Entity.SlaveState} child
  */
 App.Facilities.Incubator.newChild = function(child) {
 	let fullAdapt;
diff --git a/src/facilities/nursery/utils/nurseryUtils.js b/src/facilities/nursery/utils/nurseryUtils.js
index 0fccf40c002..7593b045f97 100644
--- a/src/facilities/nursery/utils/nurseryUtils.js
+++ b/src/facilities/nursery/utils/nurseryUtils.js
@@ -611,7 +611,7 @@ App.Facilities.Nursery.nameChild = function nameChild(child) {
 
 /**
  * Adds an infant to a the cribs
- * @param {App.Entity.InfantState} child
+ * @param {App.Facilities.Nursery.InfantState} child
  */
 App.Facilities.Nursery.newChild = function newChild(child) {
 	child.ID = generateSlaveID();
diff --git a/src/npc/generate/generateGenetics.js b/src/npc/generate/generateGenetics.js
index 76ba74e0889..2d08e8ada9e 100644
--- a/src/npc/generate/generateGenetics.js
+++ b/src/npc/generate/generateGenetics.js
@@ -1194,14 +1194,14 @@ globalThis.generateGenetics = (function() {
  * @param {App.Entity.SlaveState} mother The slave object carrying the child source
  * @param {object} ovum The source for the child, comes from the mother's womb array
  * @param {boolean} [incubator=false] True if the child is destined for the incubator; false if it's destined for the nursery
- * @returns {App.Entity.SlaveState|App.Entity.InfantState}
+ * @returns {App.Entity.SlaveState|App.Facilities.Nursery.InfantState}
  */
 globalThis.generateChild = function(mother, ovum, incubator=false) {
 	let genes = ovum.genetics; // TODO: maybe just argument this? We'll see.
 	let child;
 
 	if (!incubator) { // does extra work for the incubator if defined, otherwise builds a simple object
-		child = {};
+		child = new App.Facilities.Nursery.InfantState();
 		child.genes = genes.gender;
 		setSlaveName(child, genes);
 		setSurname(child, genes);
diff --git a/src/npc/generate/generateNewSlaveJS.js b/src/npc/generate/generateNewSlaveJS.js
index 7c4197e7b9f..bee39efea26 100644
--- a/src/npc/generate/generateNewSlaveJS.js
+++ b/src/npc/generate/generateNewSlaveJS.js
@@ -1625,6 +1625,7 @@ globalThis.GenerateNewSlave = (function() {
 			}
 		}
 
+		/** @type {Array<FC.BreastShape>} */
 		const BoobShapeGen = [];
 		if (slave.boobs > 250 && slave.boobs < 800) {
 			BoobShapeGen.push("perky");
diff --git a/src/npc/generate/heroCreator.js b/src/npc/generate/heroCreator.js
index ab37ce4457a..c8bc7a0000d 100644
--- a/src/npc/generate/heroCreator.js
+++ b/src/npc/generate/heroCreator.js
@@ -95,7 +95,7 @@ App.Utils.getHeroSlave = function(heroSlave) {
 	}
 	generatePronouns(heroSlave);
 	if (heroSlave.geneMods === undefined) {
-		heroSlave.geneMods = {};
+		heroSlave.geneMods = {NCS: 0, rapidCellGrowth: 0, immortality: 0};
 	}
 	if (heroSlave.geneMods.NCS === undefined) {
 		heroSlave.geneMods.NCS = 0;
@@ -103,6 +103,9 @@ App.Utils.getHeroSlave = function(heroSlave) {
 	if (heroSlave.geneMods.rapidCellGrowth === undefined) {
 		heroSlave.geneMods.rapidCellGrowth = 0;
 	}
+	if (heroSlave.geneMods.immortality === undefined) {
+		heroSlave.geneMods.immortality = 0;
+	}
 
 	// WombInit(heroSlave);
 	const newSlave = BaseSlave();
diff --git a/src/npc/infants/infantSummary.js b/src/npc/infants/infantSummary.js
index f3085f30c8e..780bbe47d6f 100644
--- a/src/npc/infants/infantSummary.js
+++ b/src/npc/infants/infantSummary.js
@@ -1,11 +1,10 @@
 /**
  * Displays a summary of the infant
- * @param {App.Entity.InfantState} child
+ * @param {App.Facilities.Nursery.InfantState} child
  * @returns {string}
  */
 App.Facilities.Nursery.InfantSummary = function(child) {
 	const weeksOwned = V.week - child.weekAcquired;
-	const pronouns = getPronouns(child);
 	const abbreviate = V.UI.slaveSummary.abbreviation;
 
 	let r = ``;
@@ -1579,7 +1578,7 @@ App.Facilities.Nursery.InfantSummary = function(child) {
 		} else if (child.mother === -1) {
 			r += `Your ${daughter}`;
 			if (child.relationship < -1) {
-				res += ` & ${PCrelationshipTerm(child)}`;
+				r += ` & ${PCrelationshipTerm(child)}`;
 				handled = 1;
 			}
 			r += " ";
@@ -1603,7 +1602,7 @@ App.Facilities.Nursery.InfantSummary = function(child) {
 		} else if (child.father === -1 && child.mother !== -1) {
 			r += `Your ${daughter}`;
 			if (child.relationship < -1) {
-				res += ` & ${PCrelationshipTerm(child)}`;
+				r += ` & ${PCrelationshipTerm(child)}`;
 				handled = 1;
 			}
 			r += " ";
diff --git a/src/npc/infants/longInfantDescription.js b/src/npc/infants/longInfantDescription.js
index 924a69efebe..9e3f39f6485 100644
--- a/src/npc/infants/longInfantDescription.js
+++ b/src/npc/infants/longInfantDescription.js
@@ -1,6 +1,6 @@
 /**
  * Displays a detailed description of the infant
- * @param {App.Entity.InfantState} child
+ * @param {App.Facilities.Nursery.InfantState} child
  * @returns {string}
  */
 App.Facilities.Nursery.LongInfantDescription = function(child, {market = 0, eventDescription = 0} = {}) {
-- 
GitLab