Skip to content

Commit c3f777a

Browse files
committed
fix: remove use of any in 2D components
1 parent e25d653 commit c3f777a

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/component/2d/1d-tracer/VerticalSliceChart.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface usePathOptions extends BaseProps {
1919
width?: number;
2020
}
2121

22-
function usePath(data: any, props: usePathOptions) {
22+
function usePath(data: NmrData1D, props: usePathOptions) {
2323
const { reverse, width = 100, horizontalMargin = 10 } = props;
2424
const { mode } = useChartData();
2525
const scaleX = useScale2DY(reverse);
@@ -37,7 +37,7 @@ function usePath(data: any, props: usePathOptions) {
3737

3838
const pathBuilder = new PathBuilder();
3939

40-
pathBuilder.moveTo(scaleY(y.at(-1)), scaleX(x.at(-1)));
40+
pathBuilder.moveTo(scaleY(y.at(-1) as number), scaleX(x.at(-1) as number));
4141

4242
for (let i = x.length - 2; i >= 0; i--) {
4343
pathBuilder.lineTo(scaleY(y[i]), scaleX(x[i]));

src/component/2d/BrushTracker2D.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export function BrushTracker2D({ children }: Required<PropsWithChildren>) {
7676
general: { invertScroll },
7777
},
7878
} = usePreferences();
79-
function handleBrush(brushData: any) {
79+
function handleBrush(brushData: BrushTrackerData) {
8080
const { startX, endX, startY, endY } = convertToPPM(brushData);
8181

8282
if (brushData.mouseButton === 'secondary') {
@@ -92,7 +92,7 @@ export function BrushTracker2D({ children }: Required<PropsWithChildren>) {
9292
}
9393

9494
const handleBrushEnd = useCallback<OnBrush>(
95-
(brushData) => {
95+
(brushData: BrushTrackerData) => {
9696
const brushDataInPPM = convertToPPM(brushData);
9797

9898
//reset the brush start

src/component/2d/FooterBanner.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export default function FooterBanner(props: FooterBannerProps) {
113113
) {
114114
return <FooterContainer />;
115115
}
116-
const getRealYValue = (coordinate: any) => {
116+
const getRealYValue = (coordinate: number) => {
117117
let axis: 'x' | 'y' | null = null;
118118
if (trackID === LAYOUT.top) {
119119
axis = 'x';
@@ -178,7 +178,7 @@ export default function FooterBanner(props: FooterBannerProps) {
178178
return (getXValue(startY) - getXValue(endY)).toPrecision(6);
179179
};
180180

181-
const getLabel = (label2d: any, label1d: any, nucleus: any) => {
181+
const getLabel = (label2d: string, label1d: string, nucleus: string) => {
182182
return trackID === LAYOUT.main ? (
183183
<Fragment>
184184
{label2d} ( <MF mf={nucleus} /> )

src/component/2d/zones/Signal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function Signal({ signal }: SignalProps) {
1515
const scaleX = useScale2DX();
1616
const scaleY = useScale2DY();
1717

18-
const buildIDs = useCallback((id: any) => {
18+
const buildIDs = useCallback((id: string) => {
1919
return [id].concat(buildID(id, 'X'), buildID(id, 'Y'));
2020
}, []);
2121
const assignment = useAssignment(signal?.id || '');

src/component/2d/zones/ZonesAssignmentsLabels.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled from '@emotion/styled';
22
import type { Signal1D, Zone, Zones as ZonesType } from '@zakodium/nmr-types';
3-
import type { Spectrum2D } from '@zakodium/nmrium-core';
3+
import type { Spectrum1D, Spectrum2D } from '@zakodium/nmrium-core';
44
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
55
import { PiTextTSlash } from 'react-icons/pi';
66

@@ -40,7 +40,7 @@ interface TargetBoundary {
4040
y2: number;
4141
}
4242

43-
function getDistance(x1: any, y1: any, x2: any, y2: any) {
43+
function getDistance(x1: number, y1: number, x2: number, y2: number) {
4444
const deltaX = x2 - x1;
4545
const deltaY = y2 - y1;
4646
return Math.hypot(deltaX, deltaY);
@@ -249,7 +249,7 @@ function findClosestAssignment(signals: Signal1D[], target: number) {
249249
}
250250

251251
function getAssignmentLabel(
252-
spectrum: any,
252+
spectrum: Spectrum1D | null,
253253
options: { from: number; to: number; center: number },
254254
) {
255255
if (!spectrum) return null;

0 commit comments

Comments
 (0)