From 6c439ebe4fff012e5fda61f7da7fcaf70e674a4d Mon Sep 17 00:00:00 2001 From: isaacs Date: Fri, 28 Apr 2023 16:31:29 -0700 Subject: [PATCH] chore(ts): small tweaks to make typescript happier - Use trimStart/trimEnd instead of deprecated trimLeft/trimRight - Target es2019, which is when trimLeft/Right/Start/End methods became available (at least according to tsc) --- lib/index.ts | 6 +++--- tsconfig.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index 0673c3a5..2188e50f 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -204,7 +204,7 @@ export class UI { const match = source.match(/^ */) const leadingWhitespace = match ? match[0].length : 0 const target = previousLine.text - const targetTextWidth = mixin.stringWidth(target.trimRight()) + const targetTextWidth = mixin.stringWidth(target.trimEnd()) if (!previousLine.span) { return source @@ -223,13 +223,13 @@ export class UI { previousLine.hidden = true - return target.trimRight() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimLeft() + return target.trimEnd() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimStart() } private rasterize (row: ColumnArray) { const rrows: string[][] = [] const widths = this.columnWidths(row) - let wrapped + let wrapped: string[] // word wrap all columns, and create // a data-structure that is easy to rasterize. diff --git a/tsconfig.json b/tsconfig.json index d5d8c212..619428fa 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "outDir": "build", "rootDir": ".", "sourceMap": false, - "target": "es2017", + "target": "es2019", "moduleResolution": "node", "module": "es2015" }, @@ -14,4 +14,4 @@ "exclude": [ "lib/cjs.ts" ] -} \ No newline at end of file +}