Skip to content

Commit 2c89248

Browse files
cmdcolinclaude
andcommitted
fix: add non-null assertions for noUncheckedIndexedAccess compliance
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent 6de6096 commit 2c89248

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/twoBitFile.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ const twoBit = ['T', 'C', 'A', 'G']
77
const byteTo4Bases: string[] = []
88
for (let index = 0; index < 256; index++) {
99
byteTo4Bases.push(
10-
twoBit[(index >> 6) & 3] +
11-
twoBit[(index >> 4) & 3] +
12-
twoBit[(index >> 2) & 3] +
13-
twoBit[index & 3],
10+
twoBit[(index >> 6) & 3]! +
11+
twoBit[(index >> 4) & 3]! +
12+
twoBit[(index >> 2) & 3]! +
13+
twoBit[index & 3]!,
1414
)
1515
}
1616

@@ -285,7 +285,7 @@ export default class TwoBitFile {
285285
// advance past mask blocks that end before current position
286286
while (
287287
maskBlockIdx < maskBlockStarts.length &&
288-
maskBlockStarts[maskBlockIdx] + maskBlockSizes[maskBlockIdx] <=
288+
maskBlockStarts[maskBlockIdx]! + maskBlockSizes[maskBlockIdx]! <=
289289
genomicPosition
290290
) {
291291
maskBlockIdx++
@@ -317,14 +317,14 @@ export default class TwoBitFile {
317317
while (genomicPosition < runEnd) {
318318
const bytePosition = (genomicPosition >>> 2) - baseBytesOffset
319319
const subPosition = genomicPosition & 3
320-
const byte = buffer[bytePosition]
320+
const byte = buffer[bytePosition]!
321321

322322
// if aligned to byte boundary and have room for full byte, emit all 4
323323
if (subPosition === 0 && genomicPosition + 4 <= runEnd) {
324-
sequenceParts.push(lookup[byte])
324+
sequenceParts.push(lookup[byte]!)
325325
genomicPosition += 4
326326
} else {
327-
sequenceParts.push(lookup[byte][subPosition])
327+
sequenceParts.push(lookup[byte]![subPosition]!)
328328
genomicPosition += 1
329329
}
330330
}
@@ -350,7 +350,7 @@ export default class TwoBitFile {
350350
while (lo < hi) {
351351
const mid = (lo + hi) >>> 1
352352
// mid is always valid index since lo < hi <= len
353-
const blockEnd = blockStarts[mid] + blockSizes[mid]
353+
const blockEnd = blockStarts[mid]! + blockSizes[mid]!
354354
if (blockEnd <= regionStart) {
355355
lo = mid + 1
356356
} else {

0 commit comments

Comments
 (0)