fix typescript 4.9.3 bs errors

This commit is contained in:
Jacorb90 2022-12-08 19:09:15 -05:00
parent 2d1fb360dc
commit 4a94162ed4
4 changed files with 12 additions and 12 deletions

View file

@ -1,5 +1,5 @@
import BarComponent from "features/bars/Bar.vue";
import type { CoercableComponent, OptionsFunc, Replace, StyleValue } from "features/feature";
import type { CoercableComponent, GenericComponent, OptionsFunc, Replace, StyleValue } from "features/feature";
import { Component, GatherProps, getUniqueID, setDefault, Visibility } from "features/feature";
import type { DecimalSource } from "util/bignum";
import { Direction } from "util/common";
@ -34,7 +34,7 @@ export interface BarOptions {
export interface BaseBar {
id: string;
type: typeof BarType;
[Component]: typeof BarComponent;
[Component]: GenericComponent;
[GatherProps]: () => Record<string, unknown>;
}
@ -71,7 +71,7 @@ export function createBar<T extends BarOptions>(
const bar = optionsFunc();
bar.id = getUniqueID("bar-");
bar.type = BarType;
bar[Component] = BarComponent;
bar[Component] = BarComponent as GenericComponent;
processComputable(bar as T, "visibility");
setDefault(bar, "visibility", Visibility.Visible);

View file

@ -1,5 +1,5 @@
import ClickableComponent from "features/clickables/Clickable.vue";
import type { CoercableComponent, OptionsFunc, Replace, StyleValue } from "features/feature";
import type { CoercableComponent, GenericComponent, OptionsFunc, Replace, StyleValue } from "features/feature";
import { Component, GatherProps, getUniqueID, jsx, setDefault, Visibility } from "features/feature";
import type { Resource } from "features/resources/resource";
import { DefaultValue, Persistent } from "game/persistence";
@ -53,7 +53,7 @@ export interface BaseBuyable {
onClick: VoidFunction;
purchase: VoidFunction;
type: typeof BuyableType;
[Component]: typeof ClickableComponent;
[Component]: GenericComponent;
[GatherProps]: () => Record<string, unknown>;
}
@ -99,7 +99,7 @@ export function createBuyable<T extends BuyableOptions>(
buyable.id = getUniqueID("buyable-");
buyable.type = BuyableType;
buyable[Component] = ClickableComponent;
buyable[Component] = ClickableComponent as GenericComponent;
buyable.amount = amount;
buyable.amount[DefaultValue] = buyable.initialValue ?? 0;

View file

@ -1,5 +1,5 @@
import ClickableComponent from "features/clickables/Clickable.vue";
import type { CoercableComponent, OptionsFunc, Replace, StyleValue } from "features/feature";
import type { CoercableComponent, GenericComponent, OptionsFunc, Replace, StyleValue } from "features/feature";
import { Component, GatherProps, getUniqueID, setDefault, Visibility } from "features/feature";
import type { BaseLayer } from "game/layers";
import type { Unsubscribe } from "nanoevents";
@ -37,7 +37,7 @@ export interface BaseClickable {
id: string;
type: typeof ClickableType;
isHolding: Ref<boolean>;
[Component]: typeof ClickableComponent;
[Component]: GenericComponent;
[GatherProps]: () => Record<string, unknown>;
}
@ -68,7 +68,7 @@ export function createClickable<T extends ClickableOptions>(
const clickable = optionsFunc?.() ?? ({} as ReturnType<NonNullable<typeof optionsFunc>>);
clickable.id = getUniqueID("clickable-");
clickable.type = ClickableType;
clickable[Component] = ClickableComponent;
clickable[Component] = ClickableComponent as GenericComponent;
clickable.isHolding = ref(false);

View file

@ -1,4 +1,4 @@
import type { CoercableComponent, OptionsFunc, Replace, StyleValue } from "features/feature";
import type { CoercableComponent, GenericComponent, OptionsFunc, Replace, StyleValue } from "features/feature";
import {
Component,
findFeatures,
@ -54,7 +54,7 @@ export interface BaseUpgrade {
canPurchase: Ref<boolean>;
purchase: VoidFunction;
type: typeof UpgradeType;
[Component]: typeof UpgradeComponent;
[Component]: GenericComponent;
[GatherProps]: () => Record<string, unknown>;
}
@ -87,7 +87,7 @@ export function createUpgrade<T extends UpgradeOptions>(
const upgrade = optionsFunc();
upgrade.id = getUniqueID("upgrade-");
upgrade.type = UpgradeType;
upgrade[Component] = UpgradeComponent;
upgrade[Component] = UpgradeComponent as GenericComponent;
if (upgrade.canAfford == null && (upgrade.resource == null || upgrade.cost == null)) {
console.warn(