Skip to content

Commit e4c4bc0

Browse files
committed
Fix doc comments being applied only to the first overload
This duplication sucks, but it seems to be the right solution - see https://stackoverflow.com/a/76887928 In any case, this fixes the issue where the generated `KaitaiStream.js` file was missing documentation comments for the overloaded methods, and where the generated `KaitaiStream.d.ts` file contained documentation comments only for the first overload (with type `number`), while these comments were missing for the second overloead (with type `bigint`).
1 parent 9fd0954 commit e4c4bc0

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

KaitaiStream.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,19 @@ class KaitaiStream {
11011101
* @throws {RangeError}
11021102
*/
11031103
public static mod(a: number, b: number): number;
1104+
/**
1105+
* @param a The dividend.
1106+
* @param b The divisor.
1107+
* @returns The result of `a` mod `b`.
1108+
* @throws {RangeError}
1109+
*/
11041110
public static mod(a: bigint, b: bigint): bigint;
1111+
/**
1112+
* @param a The dividend.
1113+
* @param b The divisor.
1114+
* @returns The result of `a` mod `b`.
1115+
* @throws {RangeError}
1116+
*/
11051117
public static mod(a: number | bigint, b: number | bigint): number | bigint {
11061118
// The `as number` casts in this method are a bit ugly, but I don't think
11071119
// there is a good way to tell TypeScript that we only accept either
@@ -1122,7 +1134,19 @@ class KaitaiStream {
11221134
* @returns The smallest value.
11231135
*/
11241136
public static arrayMin(arr: ArrayLike<number>): number;
1137+
/**
1138+
* Gets the smallest value in an array.
1139+
*
1140+
* @param arr The input array.
1141+
* @returns The smallest value.
1142+
*/
11251143
public static arrayMin(arr: ArrayLike<bigint>): bigint;
1144+
/**
1145+
* Gets the smallest value in an array.
1146+
*
1147+
* @param arr The input array.
1148+
* @returns The smallest value.
1149+
*/
11261150
public static arrayMin(arr: ArrayLike<number> | ArrayLike<bigint>): number | bigint {
11271151
let min = arr[0];
11281152
const n = arr.length;
@@ -1140,7 +1164,19 @@ class KaitaiStream {
11401164
* @returns The largest value.
11411165
*/
11421166
public static arrayMax(arr: ArrayLike<number>): number;
1167+
/**
1168+
* Gets the largest value in an array.
1169+
*
1170+
* @param arr The input array.
1171+
* @returns The largest value.
1172+
*/
11431173
public static arrayMax(arr: ArrayLike<bigint>): bigint;
1174+
/**
1175+
* Gets the largest value in an array.
1176+
*
1177+
* @param arr The input array.
1178+
* @returns The largest value.
1179+
*/
11441180
public static arrayMax(arr: ArrayLike<number> | ArrayLike<bigint>): number | bigint {
11451181
let max = arr[0];
11461182
const n = arr.length;

0 commit comments

Comments
 (0)