diff --git a/src/xy/xyEnsureGrowingX.ts b/src/xy/xyEnsureGrowingX.ts index 4d22d63e..7a19b552 100644 --- a/src/xy/xyEnsureGrowingX.ts +++ b/src/xy/xyEnsureGrowingX.ts @@ -1,4 +1,4 @@ -import type { DataXY } from 'cheminfo-types'; +import type { DataXY, NumberArray } from 'cheminfo-types'; import { xIsMonotonic } from '../x/index.ts'; @@ -8,7 +8,9 @@ import { xyCheck } from './xyCheck.ts'; * Filters x,y values to allow strictly growing values in x-axis. * @param data - Object that contains property x (an ordered increasing array) and y (an array). */ -export function xyEnsureGrowingX(data: DataXY): DataXY { +export function xyEnsureGrowingX( + data: DataXY, +): DataXY { xyCheck(data); if (xIsMonotonic(data.x) === 1) return data; const x = Array.from(data.x); diff --git a/src/xy/xyGrowingX.ts b/src/xy/xyGrowingX.ts index bc7a5f24..141685a5 100644 --- a/src/xy/xyGrowingX.ts +++ b/src/xy/xyGrowingX.ts @@ -1,10 +1,12 @@ -import type { DataXY } from 'cheminfo-types'; +import type { DataXY, NumberArray } from 'cheminfo-types'; /** * Order object of array, x has to be monotone. Ensure x is growing * @param data - Object of kind {x:[], y:[]}. */ -export function xyGrowingX(data: DataXY): DataXY { +export function xyGrowingX( + data: DataXY, +): DataXY { const { x, y } = data; if (x.length !== y.length) { @@ -14,7 +16,7 @@ export function xyGrowingX(data: DataXY): DataXY { if (x.length < 2 || x[0] < (x.at(-1) as number)) return data; return { - x: x.toReversed(), - y: y.toReversed(), + x: x.toReversed() as DataType, + y: y.toReversed() as DataType, }; }