From 4a94162ed4ce4b09ad8e525005ef9eb72611ef58 Mon Sep 17 00:00:00 2001 From: Jacorb90 <39597610+Jacorb90@users.noreply.github.com> Date: Thu, 8 Dec 2022 19:09:15 -0500 Subject: [PATCH] fix typescript 4.9.3 bs errors --- src/features/bars/bar.ts | 6 +++--- src/features/buyable.tsx | 6 +++--- src/features/clickables/clickable.ts | 6 +++--- src/features/upgrades/upgrade.ts | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/features/bars/bar.ts b/src/features/bars/bar.ts index 4d15f18..1eca337 100644 --- a/src/features/bars/bar.ts +++ b/src/features/bars/bar.ts @@ -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; } @@ -71,7 +71,7 @@ export function createBar( 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); diff --git a/src/features/buyable.tsx b/src/features/buyable.tsx index 7570640..b3d3737 100644 --- a/src/features/buyable.tsx +++ b/src/features/buyable.tsx @@ -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; } @@ -99,7 +99,7 @@ export function createBuyable( buyable.id = getUniqueID("buyable-"); buyable.type = BuyableType; - buyable[Component] = ClickableComponent; + buyable[Component] = ClickableComponent as GenericComponent; buyable.amount = amount; buyable.amount[DefaultValue] = buyable.initialValue ?? 0; diff --git a/src/features/clickables/clickable.ts b/src/features/clickables/clickable.ts index 7c5117d..7222982 100644 --- a/src/features/clickables/clickable.ts +++ b/src/features/clickables/clickable.ts @@ -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; - [Component]: typeof ClickableComponent; + [Component]: GenericComponent; [GatherProps]: () => Record; } @@ -68,7 +68,7 @@ export function createClickable( const clickable = optionsFunc?.() ?? ({} as ReturnType>); clickable.id = getUniqueID("clickable-"); clickable.type = ClickableType; - clickable[Component] = ClickableComponent; + clickable[Component] = ClickableComponent as GenericComponent; clickable.isHolding = ref(false); diff --git a/src/features/upgrades/upgrade.ts b/src/features/upgrades/upgrade.ts index 8d20f6c..324a141 100644 --- a/src/features/upgrades/upgrade.ts +++ b/src/features/upgrades/upgrade.ts @@ -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; purchase: VoidFunction; type: typeof UpgradeType; - [Component]: typeof UpgradeComponent; + [Component]: GenericComponent; [GatherProps]: () => Record; } @@ -87,7 +87,7 @@ export function createUpgrade( 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(