From 6776ea6c02851aabbf03c91e5c47c52dd8b67ab6 Mon Sep 17 00:00:00 2001 From: Luc Patiny Date: Mon, 2 May 2022 10:08:26 +0200 Subject: [PATCH] fix: correctly define type of OptimizedPeak --- src/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 4a902e5..89dfac2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -29,6 +29,12 @@ export interface Peak { >; } +export interface OptimizedPeak { + x: number; + y: number; + shape: Shape1D; +} + type OptimizationParameter = number | ((peak: Peak) => number); export interface OptimizationOptions { @@ -88,7 +94,7 @@ export function optimize( options: OptimizeOptions = {}, ): { error: number; - peaks: Peak[]; + peaks: OptimizedPeak[]; iterations: number; } { // rescale data @@ -129,7 +135,7 @@ export function optimize( ...optimizationOptions, }); const fittedValues = fitted.parameterValues; - let newPeaks: Peak[] = []; + let newPeaks: OptimizedPeak[] = []; for (let peak of internalPeaks) { const newPeak = { x: 0,