UNPKG

1.22 kBTypeScriptView Raw
1// Type definitions for fill-range 7.0
2// Project: https://github.com/jonschlinkert/fill-range
3// Definitions by: Richie Bendall <https://github.com/Richienb>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
6declare namespace fill {
7 interface Options<ValueType, TransformValueType> {
8 step?: number;
9 strictRanges?: boolean;
10 stringify?: boolean;
11 toRegex?: boolean;
12 transform?: (value: ValueType) => TransformValueType;
13 }
14}
15
16type FilledArray<ValueType, TransformValueType> = ValueType extends TransformValueType ? ValueType[] : TransformValueType[];
17
18declare function fill<
19 ValueType = string | number,
20 TransformValueType = unknown
21>(
22 start: ValueType,
23 end?: ValueType | null,
24 step?: number,
25 options?: fill.Options<ValueType, TransformValueType>
26): FilledArray<ValueType, TransformValueType>;
27
28declare function fill<
29 ValueType = string | number,
30 TransformValueType = unknown
31>(
32 start: ValueType,
33 end?: ValueType | null,
34 transformOrOptions?: fill.Options<ValueType, TransformValueType>['transform'] | fill.Options<ValueType, TransformValueType>
35): FilledArray<ValueType, TransformValueType>;
36
37export = fill;