Skip to content

Commit 72b7d03

Browse files
committed
Fixed TypeScript declarations for Point.update() and Segment.update()
This also simplifies the declarations by using Partial<PointOptions> and Partial<SegmentOptions> which are now also used in PointMarker.update() and SegmentMarker.update() See #562
1 parent 889e519 commit 72b7d03

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

peaks.js.d.ts

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ declare module 'peaks.js' {
3434
}
3535

3636
interface Segment extends SegmentOptions {
37-
update: (options: SegmentOptions) => void;
37+
update: (options: Partial<SegmentOptions>) => void;
3838
}
3939

4040
interface PointOptions {
@@ -47,7 +47,7 @@ declare module 'peaks.js' {
4747
}
4848

4949
interface Point extends PointOptions {
50-
update: (options: PointOptions) => void;
50+
update: (options: Partial<PointOptions>) => void;
5151
}
5252

5353
type LabelHorizontalAlign = 'left' | 'center' | 'right';
@@ -190,34 +190,17 @@ declare module 'peaks.js' {
190190

191191
type AudioOptions = OneOf<RemoteWaveformDataOptions, LocalWaveformDataOptions, WebAudioOptions>;
192192

193-
export interface PointMarkerUpdateOptions {
194-
time?: number;
195-
editable?: boolean;
196-
color?: string;
197-
labelText?: string;
198-
[userAttributes: string]: unknown;
199-
}
200-
201193
export interface PointMarker {
202194
init: (group: object) => void; // TODO: group: Konva.Group
203195
fitToView: () => void;
204-
update?: (options: PointMarkerUpdateOptions) => void;
196+
update?: (options: Partial<PointOptions>) => void;
205197
destroy?: () => void;
206198
}
207199

208-
export interface SegmentMarkerUpdateOptions {
209-
startTime?: number;
210-
endTime?: number;
211-
editable?: boolean;
212-
color?: string;
213-
labelText?: string;
214-
[userAttributes: string]: unknown;
215-
}
216-
217200
export interface SegmentMarker {
218201
init: (group: object) => void; // TODO: group: Konva.Group
219202
fitToView: () => void;
220-
update?: (options: SegmentMarkerUpdateOptions) => void;
203+
update?: (options: Partial<SegmentOptions>) => void;
221204
destroy?: () => void;
222205
}
223206

0 commit comments

Comments
 (0)