Coerce buyable's currDisplay first

This commit is contained in:
thepaperpilot 2022-03-16 11:24:54 -05:00
parent e076c84483
commit 765e2cfc5f

View file

@ -163,7 +163,8 @@ export function createBuyable<T extends BuyableOptions>(
// TODO once processComputable types correctly, remove this "as X" // TODO once processComputable types correctly, remove this "as X"
const currDisplay = unref(display) as BuyableDisplay; const currDisplay = unref(display) as BuyableDisplay;
if (isCoercableComponent(currDisplay)) { if (isCoercableComponent(currDisplay)) {
return <currDisplay />; const CurrDisplay = coerceComponent(currDisplay);
return <CurrDisplay />;
} }
if (currDisplay != null && buyable.cost != null && buyable.resource != null) { if (currDisplay != null && buyable.cost != null && buyable.resource != null) {
const genericBuyable = buyable as GenericBuyable; const genericBuyable = buyable as GenericBuyable;