Skip to content

Commit f4cb9e1

Browse files
authored
Upgrade typescript to 5.7.2 (#2997)
1 parent ae5d70a commit f4cb9e1

File tree

8 files changed

+117
-111
lines changed

8 files changed

+117
-111
lines changed

.changeset/four-lies-rush.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"victory-area": patch
3+
"victory-core": patch
4+
---
5+
6+
Upgrade typescript to 5.7.2

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"ts-jest": "^29.2.5",
102102
"ts-loader": "^9.3.0",
103103
"ts-node": "^10.9.1",
104-
"typescript": "^4.7.3",
104+
"typescript": "^5.7.2",
105105
"typescript-eslint": "^8.13.0",
106106
"unified": "^8.3.2",
107107
"victory-vendor": "*",

packages/victory-area/src/helper-methods.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ export const getDataWithBaseline = (props, scale) => {
1919
const minY = Collection.getMinValue(domain);
2020
const maxY = Collection.getMaxValue(domain);
2121
let defaultMin: typeof minY = defaultZero;
22-
if (minY < 0 && maxY <= 0) {
22+
if (minY.valueOf() < 0 && maxY.valueOf() <= 0) {
2323
defaultMin = maxY;
24-
} else if (minY >= 0 && maxY > 0) {
24+
} else if (minY.valueOf() >= 0 && maxY.valueOf() > 0) {
2525
defaultMin = minY;
2626
}
2727
return Collection.containsDates(domain) ? new Date(defaultMin) : defaultMin;

packages/victory-core/src/victory-util/axis.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ function getTickArray(props) {
218218
arr.forEach((t, index) => {
219219
if (Array.isArray(domain)) {
220220
if (
221-
t >= Collection.getMinValue(domain) &&
222-
t <= Collection.getMaxValue(domain)
221+
t >= Collection.getMinValue(domain).valueOf() &&
222+
t <= Collection.getMaxValue(domain).valueOf()
223223
) {
224224
newTickArray.push({
225225
value: t,

packages/victory-core/src/victory-util/domain.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,13 @@ function padDomain(domain, props, axis) {
111111
: props.singleQuadrantDomainPadding;
112112

113113
const addsQuadrants =
114-
(min >= 0 && paddedDomain.min <= 0) || (max <= 0 && paddedDomain.max >= 0);
114+
(min.valueOf() >= 0 && paddedDomain.min <= 0) ||
115+
(max.valueOf() <= 0 && paddedDomain.max >= 0);
115116

116117
const adjust = (val, type) => {
117118
const coerce =
118-
(type === "min" && min >= 0 && val <= 0) ||
119-
(type === "max" && max <= 0 && val >= 0);
119+
(type === "min" && min.valueOf() >= 0 && val <= 0) ||
120+
(type === "max" && max.valueOf() <= 0 && val >= 0);
120121
return coerce ? 0 : val;
121122
};
122123

packages/victory-core/src/victory-util/helpers.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import defaults from "lodash/defaults";
33
import property from "lodash/property";
44
import pick from "lodash/pick";
55

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

98
// Private Functions
@@ -142,8 +141,8 @@ export function getStyles(style, defaultStyles) {
142141
}
143142

144143
export function evaluateProp<TValue>(
145-
prop: ValueOrAccessor<TValue, CallbackArgs>,
146-
props: CallbackArgs,
144+
prop: ValueOrAccessor<TValue, Record<string, any>>,
145+
props: Record<string, any>,
147146
): TValue {
148147
return isFunction(prop) ? prop(props) : prop;
149148
}

packages/victory-core/src/victory-util/user-props.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function assert<T>(
7878
* @returns {Object}: object containing remaining acceptable props
7979
*/
8080
export const getSafeUserProps = <T>(
81-
props: T,
81+
props: T extends Record<string, any> ? T : never,
8282
): Record<SafeAttribute, string> => {
8383
const propsToFilter = { ...props };
8484
return Object.fromEntries(

0 commit comments

Comments
 (0)