nodeCategoryProperty
function has a signature requirement of
(a: ObjectData, b?: string) => string
. In my opinion, this should be updated to (a: ObjectData, b?: string) => string | void
, as the function is intended to not return anything if used as a setter.
In cases where the second argument is provided, the function will alter the node data object to reflect the new category name.
The custom function I have created is as follows:
const categoryPropertyFunction = (partData: ObjectData, category?: string): string =>
{
if (category) partData.type = category;
else return partData.type;
};
However, TypeScript is throwing an error:
TS2366: Function lacks ending return statement and return type does not include 'undefined'.