Update TS
This commit is contained in:
parent
a908c81ccf
commit
47d17730e0
12 changed files with 31 additions and 25 deletions
10
package-lock.json
generated
10
package-lock.json
generated
|
@ -43,7 +43,7 @@
|
|||
"eslint": "^8.6.0",
|
||||
"jsdom": "^24.0.0",
|
||||
"prettier": "^2.5.1",
|
||||
"typescript": "^5.0.2",
|
||||
"typescript": "^5.4.2",
|
||||
"vitest": "^1.4.0",
|
||||
"vue-tsc": "^2.0.6"
|
||||
},
|
||||
|
@ -7435,16 +7435,16 @@
|
|||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.0.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
|
||||
"integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==",
|
||||
"version": "5.4.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz",
|
||||
"integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==",
|
||||
"devOptional": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.20"
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/ufo": {
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
"eslint": "^8.6.0",
|
||||
"jsdom": "^24.0.0",
|
||||
"prettier": "^2.5.1",
|
||||
"typescript": "^5.0.2",
|
||||
"typescript": "^5.4.2",
|
||||
"vitest": "^1.4.0",
|
||||
"vue-tsc": "^2.0.6"
|
||||
},
|
||||
|
|
|
@ -28,6 +28,7 @@ import { convertComputable, processComputable } from "util/computed";
|
|||
import { getFirstFeature, renderColJSX, renderJSX } from "util/vue";
|
||||
import type { ComputedRef, Ref } from "vue";
|
||||
import { computed, unref } from "vue";
|
||||
import { JSX } from "vue/jsx-runtime";
|
||||
import "./common.css";
|
||||
|
||||
/** An object that configures a {@link ResetButton} */
|
||||
|
@ -128,7 +129,7 @@ export function createResetButton<T extends ClickableOptions & ResetButtonOption
|
|||
)}
|
||||
</b>{" "}
|
||||
{resetButton.conversion.gainResource.displayName}
|
||||
{unref(resetButton.showNextAt) != null ? (
|
||||
{unref(resetButton.showNextAt as ProcessedComputable<boolean>) != null ? (
|
||||
<div>
|
||||
<br />
|
||||
{unref(resetButton.conversion.buyMax) ? "Next:" : "Req:"}{" "}
|
||||
|
|
|
@ -219,7 +219,7 @@ export function createAction<T extends ActionOptions>(
|
|||
|
||||
const onClick = action.onClick.bind(action);
|
||||
action.onClick = function () {
|
||||
if (unref(action.canClick) === false) {
|
||||
if (unref(action.canClick as ProcessedComputable<boolean>) === false) {
|
||||
return;
|
||||
}
|
||||
const amount = Decimal.div(progress.value, unref(genericAction.duration));
|
||||
|
|
|
@ -129,7 +129,7 @@ export function createClickable<T extends ClickableOptions>(
|
|||
if (clickable.onClick) {
|
||||
const onClick = clickable.onClick.bind(clickable);
|
||||
clickable.onClick = function (e) {
|
||||
if (unref(clickable.canClick) !== false) {
|
||||
if (unref(clickable.canClick as ProcessedComputable<boolean>) !== false) {
|
||||
onClick(e);
|
||||
}
|
||||
};
|
||||
|
@ -137,7 +137,7 @@ export function createClickable<T extends ClickableOptions>(
|
|||
if (clickable.onHold) {
|
||||
const onHold = clickable.onHold.bind(clickable);
|
||||
clickable.onHold = function () {
|
||||
if (unref(clickable.canClick) !== false) {
|
||||
if (unref(clickable.canClick as ProcessedComputable<boolean>) !== false) {
|
||||
onHold();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -228,7 +228,7 @@ export function createIndependentConversion<S extends ConversionOptions>(
|
|||
conversion.baseResource.value
|
||||
)
|
||||
).max(conversion.gainResource.value);
|
||||
if (unref(conversion.buyMax) === false) {
|
||||
if (unref(conversion.buyMax as ProcessedComputable<boolean>) === false) {
|
||||
gain = gain.min(Decimal.add(conversion.gainResource.value, 1));
|
||||
}
|
||||
return gain;
|
||||
|
@ -245,7 +245,7 @@ export function createIndependentConversion<S extends ConversionOptions>(
|
|||
.floor()
|
||||
.max(0);
|
||||
|
||||
if (unref(conversion.buyMax) === false) {
|
||||
if (unref(conversion.buyMax as ProcessedComputable<boolean>) === false) {
|
||||
gain = gain.min(1);
|
||||
}
|
||||
return gain;
|
||||
|
|
|
@ -2,6 +2,7 @@ import Decimal from "util/bignum";
|
|||
import { DoNotCache, ProcessedComputable } from "util/computed";
|
||||
import type { CSSProperties, DefineComponent } from "vue";
|
||||
import { isRef, unref } from "vue";
|
||||
import { JSX } from "vue/jsx-runtime";
|
||||
|
||||
/**
|
||||
* A symbol to use as a key for a vue component a feature can be rendered with
|
||||
|
|
|
@ -141,7 +141,9 @@ export function createTreeNode<T extends TreeNodeOptions>(
|
|||
if (treeNode.onClick) {
|
||||
const onClick = treeNode.onClick.bind(treeNode);
|
||||
treeNode.onClick = function (e) {
|
||||
if (unref(treeNode.canClick) !== false) {
|
||||
if (
|
||||
unref(treeNode.canClick as ProcessedComputable<boolean | undefined>) !== false
|
||||
) {
|
||||
onClick(e);
|
||||
}
|
||||
};
|
||||
|
@ -149,7 +151,9 @@ export function createTreeNode<T extends TreeNodeOptions>(
|
|||
if (treeNode.onHold) {
|
||||
const onHold = treeNode.onHold.bind(treeNode);
|
||||
treeNode.onHold = function () {
|
||||
if (unref(treeNode.canClick) !== false) {
|
||||
if (
|
||||
unref(treeNode.canClick as ProcessedComputable<boolean | undefined>) !== false
|
||||
) {
|
||||
onHold();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -19,6 +19,7 @@ import {
|
|||
import { createLazyProxy } from "util/proxies";
|
||||
import { joinJSX, renderJSX } from "util/vue";
|
||||
import { computed, unref } from "vue";
|
||||
import { JSX } from "vue/jsx-runtime";
|
||||
import Formula, { calculateCost, calculateMaxAffordable } from "./formulas/formulas";
|
||||
import type { GenericFormula } from "./formulas/types";
|
||||
import { DefaultValue, Persistent } from "./persistence";
|
||||
|
@ -179,7 +180,7 @@ export function createCostRequirement<T extends CostRequirementOptions>(
|
|||
? calculateCost(
|
||||
req.cost,
|
||||
amount ?? 1,
|
||||
unref(req.cumulativeCost) as boolean,
|
||||
unref(req.cumulativeCost as ProcessedComputable<boolean>),
|
||||
unref(req.directSum) as number
|
||||
)
|
||||
: unref(req.cost as ProcessedComputable<DecimalSource>);
|
||||
|
|
|
@ -4,9 +4,9 @@ import type { CoercableComponent, GenericComponent, JSXFunction } from "features
|
|||
import {
|
||||
Component as ComponentKey,
|
||||
GatherProps,
|
||||
Visibility,
|
||||
isVisible,
|
||||
jsx,
|
||||
Visibility
|
||||
jsx
|
||||
} from "features/feature";
|
||||
import type { ProcessedComputable } from "util/computed";
|
||||
import { DoNotCache } from "util/computed";
|
||||
|
@ -21,6 +21,7 @@ import {
|
|||
unref,
|
||||
watchEffect
|
||||
} from "vue";
|
||||
import { JSX } from "vue/jsx-runtime";
|
||||
import { camelToKebab } from "./common";
|
||||
|
||||
export function coerceComponent(
|
||||
|
|
|
@ -6,14 +6,11 @@ interface CustomMatchers<R = unknown> {
|
|||
toLogError(): R;
|
||||
}
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
namespace Vi {
|
||||
declare module "vitest" {
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface Assertion extends CustomMatchers {}
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface AsymmetricMatchersContaining extends CustomMatchers {}
|
||||
}
|
||||
}
|
||||
|
||||
expect.extend({
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"strict": true,
|
||||
"checkJs": false,
|
||||
"jsx": "preserve",
|
||||
"jsxImportSource": "vue",
|
||||
"importHelpers": true,
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
|
|
Loading…
Reference in a new issue