Skip to content

Commit

Permalink
chore: extends input type in zonesWithPoints
Browse files Browse the repository at this point in the history
  • Loading branch information
jobo322 committed Nov 12, 2024
1 parent b0e9ba7 commit d176f2f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/zones/zonesWithPoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface ZonesWithPointsOptions {
to?: number;
}

export interface FromToWithNumberOfPoints extends FromTo {
export interface ZoneWithNumberOfPoints extends FromTo {
numberOfPoints: number;
}

Expand All @@ -27,19 +27,19 @@ export interface FromToWithNumberOfPoints extends FromTo {
* @param options - options
* @returns array of zones with points
*/
export function zonesWithPoints(
zones: FromTo[] = [],
export function zonesWithPoints<Zone extends FromTo = FromTo>(
zones: Zone[] = [],

/**
* total number of points to distribute between zones
* @default 10
*/
numberOfPoints = 10,
options: ZonesWithPointsOptions = {},
): FromToWithNumberOfPoints[] {
): ZoneWithNumberOfPoints[] {
if (zones.length === 0) return [];
const normalizedZones = zonesNormalize(zones, options);
const zonesWithNumberOfPoints: FromToWithNumberOfPoints[] = [];
const zonesWithNumberOfPoints: ZoneWithNumberOfPoints[] = [];

const totalSize = normalizedZones.reduce((previous, current) => {
return previous + (current.to - current.from);
Expand Down

0 comments on commit d176f2f

Please sign in to comment.