Skip to content

Commit ea30120

Browse files
authored
fix: remove shape from type definitions (#114)
1 parent a7402cd commit ea30120

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

src/GSDPeak.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { Shape1D } from 'ml-peak-shape-generator';
2-
31
export interface GSDPeak {
42
id?: string;
53
x: number;
@@ -18,8 +16,6 @@ export interface GSDPeak {
1816
*/
1917
ddY: number;
2018

21-
shape: Shape1D;
22-
2319
inflectionPoints: {
2420
from: { x: number; index: number };
2521
to: { x: number; index: number };

src/gsd.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111

1212
import { GSDPeak } from './GSDPeak';
1313
import { MakeMandatory } from './utils/MakeMandatory';
14-
import { MakeOptional } from './utils/MakeOptional';
1514
import { optimizeTop } from './utils/optimizeTop';
1615

1716
export interface GSDOptions {
@@ -49,7 +48,7 @@ export interface GSDOptions {
4948
realTopDetection?: boolean;
5049
}
5150
export type GSDPeakID = MakeMandatory<GSDPeak, 'id'>;
52-
export type GSDPeakIDOptionalShape = MakeOptional<GSDPeak, 'shape'>;
51+
5352
/**
5453
* Global spectra deconvolution
5554
* @param data - Object data with x and y arrays. Values in x has to be growing
@@ -213,7 +212,7 @@ export function gsd(data: DataXY, options: GSDOptions = {}): GSDPeakID[] {
213212

214213
let lastK = -1;
215214

216-
const peaks: GSDPeakIDOptionalShape[] = [];
215+
const peaks: GSDPeakID[] = [];
217216
for (const minddYIndex of minddY) {
218217
let deltaX = x[minddYIndex];
219218
let possible = -1;
@@ -271,5 +270,5 @@ export function gsd(data: DataXY, options: GSDOptions = {}): GSDPeakID[] {
271270
return a.x - b.x;
272271
});
273272

274-
return peaks as GSDPeakID[];
273+
return peaks;
275274
}

src/post/broadenPeaks.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { getShape1D, Shape1D } from 'ml-peak-shape-generator';
22

33
import { GSDBroadenPeak } from '../GSDBroadenPeak';
44
import { GSDPeak } from '../GSDPeak';
5-
import { MakeOptional } from '../utils/MakeOptional';
65

7-
type GSDPeakOptionalShape = MakeOptional<GSDPeak, 'shape'>;
6+
type GSDPeakOptionalShape = GSDPeak & { shape?: Shape1D };
87

98
type GSDBroadenPeakWithID = GSDBroadenPeak & { id: string };
109
type GSDBroadenPeakWithShape = GSDBroadenPeak & { shape: Shape1D };

src/post/joinBroadPeaks.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { OptimizationOptions } from 'ml-spectra-fitting';
44

55
import { GSDPeak } from '../GSDPeak';
66
import { GSDPeakOptimized } from '../GSDPeakOptimized';
7-
import { MakeOptional } from '../utils/MakeOptional';
87
import { addMissingIDs } from '../utils/addMissingIDs';
98
import { addMissingShape } from '../utils/addMissingShape';
109

@@ -36,7 +35,7 @@ export interface JoinBroadPeaksOptions {
3635
* This function tries to join the peaks that seems to belong to a broad signal in a single broad peak.
3736
*/
3837

39-
export type GSDPeakOptionalShape = MakeOptional<GSDPeak, 'shape'>;
38+
export type GSDPeakOptionalShape = GSDPeak & { shape?: Shape1D };
4039

4140
export function joinBroadPeaks<T extends GSDPeakOptionalShape>(
4241
peakList: T[],

0 commit comments

Comments
 (0)