From a8a908d2959428d1ecc67b82f89f8f69d124f2b8 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Sat, 23 Nov 2024 00:30:04 +0000 Subject: [PATCH] =?UTF-8?q?refactor:=20add=20explicit=20type=20annotations?= =?UTF-8?q?=20=F0=9F=8F=B7=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cli/src/parse.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/parse.ts b/packages/cli/src/parse.ts index 00b6ef089..88911c9c7 100644 --- a/packages/cli/src/parse.ts +++ b/packages/cli/src/parse.ts @@ -93,7 +93,7 @@ export async function parsePDF( */ export async function parseDOCX(file: string) { // Uses DOCXTryParse to extract text from the DOCX file - const text = await DOCXTryParse(file) + const text: string = await DOCXTryParse(file) console.log(text) } @@ -104,7 +104,7 @@ export async function parseDOCX(file: string) { export async function parseHTMLToText(file: string) { const html = await readFile(file, { encoding: "utf-8" }) // Converts HTML to plain text - const text = HTMLToText(html) + const text: string = await HTMLToText(html) console.log(text) } @@ -126,7 +126,7 @@ export async function parseJinja2( const i = parseFloat(vars[k]) if (!isNaN(i)) vars[k] = i } - const res = jinjaRender(src, vars) + const res: string = jinjaRender(src, vars) console.log(res) } @@ -189,7 +189,7 @@ export async function jsonl2json(files: string[]) { } const content = await tryReadText(file) const objs = await JSONLTryParse(content, { repair: true }) - const out = replaceExt(file, ".json") + const out: string = replaceExt(file, ".json") await writeText(out, JSON.stringify(objs, null, 2)) console.log(`${file} -> ${out}`) } @@ -240,7 +240,7 @@ export async function prompty2genaiscript( console.log(`${f} -> ${gf}`) const content = await readText(f) const doc = promptyParse(f, content) - const script = promptyToGenAIScript(doc) + const script: string = promptyToGenAIScript(doc) await writeText(gf, script) } }