Skip to content

Commit 9bd0190

Browse files
committed
Fix type error
1 parent 276405f commit 9bd0190

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

extensions/ql-vscode/src/common/jsonl-reader.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ export async function readJsonlFile<T>(
2424
return new Promise((resolve, reject) => {
2525
const stream = createReadStream(path, { encoding: "utf8" });
2626
let buffer = "";
27-
stream.on("data", async (chunk: string) => {
27+
stream.on("data", async (chunk: string | Buffer) => {
28+
if (typeof chunk !== "string") {
29+
// This should never happen because we specify the encoding as "utf8".
30+
throw new Error("Invalid chunk");
31+
}
32+
2833
const parts = (buffer + chunk).split(doubleLineBreakRegexp);
2934
buffer = parts.pop()!;
3035
if (parts.length > 0) {

0 commit comments

Comments
 (0)