(value: unknown, fieldName: string)
| 134 | } |
| 135 | |
| 136 | function parseNullableFiniteNumber(value: unknown, fieldName: string): number | null { |
| 137 | if (value === null) { |
| 138 | return null; |
| 139 | } |
| 140 | |
| 141 | if (typeof value === "number") { |
| 142 | assert(Number.isFinite(value), `${fieldName} should be a finite number`); |
| 143 | return value; |
| 144 | } |
| 145 | |
| 146 | if (typeof value === "bigint") { |
| 147 | const coerced = Number(value); |
| 148 | assert(Number.isFinite(coerced), `${fieldName} should coerce to a finite number`); |
| 149 | return coerced; |
| 150 | } |
| 151 | |
| 152 | throw new TypeError(`${fieldName} should be numeric or null`); |
| 153 | } |
| 154 | |
| 155 | function createHeadSignatureFromRow(row: { |
| 156 | timestamp: unknown; |
no test coverage detected