Skip to content

Commit

Permalink
Upgrade typescript to 5.7.2 (#2997)
Browse files Browse the repository at this point in the history
  • Loading branch information
carbonrobot authored Dec 5, 2024
1 parent ae5d70a commit f4cb9e1
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 111 deletions.
6 changes: 6 additions & 0 deletions .changeset/four-lies-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"victory-area": patch
"victory-core": patch
---

Upgrade typescript to 5.7.2
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"ts-jest": "^29.2.5",
"ts-loader": "^9.3.0",
"ts-node": "^10.9.1",
"typescript": "^4.7.3",
"typescript": "^5.7.2",
"typescript-eslint": "^8.13.0",
"unified": "^8.3.2",
"victory-vendor": "*",
Expand Down
4 changes: 2 additions & 2 deletions packages/victory-area/src/helper-methods.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export const getDataWithBaseline = (props, scale) => {
const minY = Collection.getMinValue(domain);
const maxY = Collection.getMaxValue(domain);
let defaultMin: typeof minY = defaultZero;
if (minY < 0 && maxY <= 0) {
if (minY.valueOf() < 0 && maxY.valueOf() <= 0) {
defaultMin = maxY;
} else if (minY >= 0 && maxY > 0) {
} else if (minY.valueOf() >= 0 && maxY.valueOf() > 0) {
defaultMin = minY;
}
return Collection.containsDates(domain) ? new Date(defaultMin) : defaultMin;
Expand Down
4 changes: 2 additions & 2 deletions packages/victory-core/src/victory-util/axis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ function getTickArray(props) {
arr.forEach((t, index) => {
if (Array.isArray(domain)) {
if (
t >= Collection.getMinValue(domain) &&
t <= Collection.getMaxValue(domain)
t >= Collection.getMinValue(domain).valueOf() &&
t <= Collection.getMaxValue(domain).valueOf()
) {
newTickArray.push({
value: t,
Expand Down
7 changes: 4 additions & 3 deletions packages/victory-core/src/victory-util/domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,13 @@ function padDomain(domain, props, axis) {
: props.singleQuadrantDomainPadding;

const addsQuadrants =
(min >= 0 && paddedDomain.min <= 0) || (max <= 0 && paddedDomain.max >= 0);
(min.valueOf() >= 0 && paddedDomain.min <= 0) ||
(max.valueOf() <= 0 && paddedDomain.max >= 0);

const adjust = (val, type) => {
const coerce =
(type === "min" && min >= 0 && val <= 0) ||
(type === "max" && max <= 0 && val >= 0);
(type === "min" && min.valueOf() >= 0 && val <= 0) ||
(type === "max" && max.valueOf() <= 0 && val >= 0);
return coerce ? 0 : val;
};

Expand Down
5 changes: 2 additions & 3 deletions packages/victory-core/src/victory-util/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import defaults from "lodash/defaults";
import property from "lodash/property";
import pick from "lodash/pick";

import { CallbackArgs } from "../types/callbacks";
import { ValueOrAccessor } from "../types/prop-types";

// Private Functions
Expand Down Expand Up @@ -142,8 +141,8 @@ export function getStyles(style, defaultStyles) {
}

export function evaluateProp<TValue>(
prop: ValueOrAccessor<TValue, CallbackArgs>,
props: CallbackArgs,
prop: ValueOrAccessor<TValue, Record<string, any>>,
props: Record<string, any>,
): TValue {
return isFunction(prop) ? prop(props) : prop;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/victory-core/src/victory-util/user-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function assert<T>(
* @returns {Object}: object containing remaining acceptable props
*/
export const getSafeUserProps = <T>(
props: T,
props: T extends Record<string, any> ? T : never,
): Record<SafeAttribute, string> => {
const propsToFilter = { ...props };
return Object.fromEntries(
Expand Down
Loading

0 comments on commit f4cb9e1

Please sign in to comment.