diff --git a/io/buf_reader.ts b/io/buf_reader.ts index 7118e011c4a4..e2b43eaae616 100644 --- a/io/buf_reader.ts +++ b/io/buf_reader.ts @@ -207,7 +207,7 @@ export class BufReader implements Reader { if (this.#eof) return null; await this.#fill(); // buffer is empty. } - const c = this.#buf[this.#r]; + const c = this.#buf[this.#r]!; this.#r++; // this.lastByte = c; return c; diff --git a/io/buf_writer_test.ts b/io/buf_writer_test.ts index fc4d273a3a68..fa95c9048bb9 100644 --- a/io/buf_writer_test.ts +++ b/io/buf_writer_test.ts @@ -127,7 +127,7 @@ Deno.test({ await bufWriter.flush(); const buf = new Uint8Array(cache.length); - for (let i = 0; i < cache.length; i++) buf.set(cache[i], i); + for (const [i, val] of cache.entries()) buf.set(val, i); assertEquals(data, buf); }, @@ -154,7 +154,7 @@ Deno.test({ bufWriter.flush(); const buf = new Uint8Array(cache.length); - for (let i = 0; i < cache.length; i++) buf.set(cache[i], i); + for (const [i, val] of cache.entries()) buf.set(val, i); assertEquals(data, buf); }, diff --git a/io/read_delim.ts b/io/read_delim.ts index 7eff7d0e7ebc..16266aa23d8c 100644 --- a/io/read_delim.ts +++ b/io/read_delim.ts @@ -19,7 +19,7 @@ function createLPS(pat: Uint8Array): Uint8Array { lps[i] = 0; i++; } else { - prefixEnd = lps[prefixEnd - 1]; + prefixEnd = lps[prefixEnd - 1]!; } } return lps; @@ -76,7 +76,7 @@ export async function* readDelim( inspectIndex++; localIndex++; } else { - matchIndex = delimLPS[matchIndex - 1]; + matchIndex = delimLPS[matchIndex - 1]!; } } } diff --git a/io/string_writer_test.ts b/io/string_writer_test.ts index 89ef0fee59ee..babc08478f4c 100644 --- a/io/string_writer_test.ts +++ b/io/string_writer_test.ts @@ -33,6 +33,5 @@ Deno.test("ioStringWriterIsolationTest", async function () { const written = await w.write(c); assertEquals(written, 1); } - srcChunks[0][0] = 88; assertEquals(w.toString(), src); });