From 6a4c914b5b01a78e8ad8af6d5a64181d3fe2652a Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 25 Mar 2023 12:46:56 -0400 Subject: [PATCH] Fix several implicit string conversion errors. --- src/core/Form.ts | 6 +++--- src/core/Line.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/Form.ts b/src/core/Form.ts index 6aaece8..5d03a2f 100644 --- a/src/core/Form.ts +++ b/src/core/Form.ts @@ -36,7 +36,7 @@ export default abstract class Form { getLine(id: K): this['lines'][K] { if (!(id in this.lines)) - throw new NotFoundError(`Form ${this.name} does not have line ${id}`); + throw new NotFoundError(`Form ${this.name} does not have line ${id.toString()}`); // This coercion is safe: the method's generic constraint for K ensures // a valid key in |lines|, and the abstract declaration of |lines| ensures // the correct index type. @@ -50,9 +50,9 @@ export default abstract class Form { getInput(name: K): I[K] { if (!(name in this._input)) { - throw new NotFoundError(`No input with key ${name} on form ${this.name}`); + throw new NotFoundError(`No input with key ${String(name)} on form ${this.name}`); } - Trace.mark(`${this.name} input: ${name}`); + Trace.mark(`${this.name} input: ${String(name)}`); return this._input[name]; } diff --git a/src/core/Line.ts b/src/core/Line.ts index 3b709c9..46d0fe0 100644 --- a/src/core/Line.ts +++ b/src/core/Line.ts @@ -75,7 +75,7 @@ export class ReferenceLine, line: L, description?: string, fallback?: T, options?: LineOptions) { - super(description || `Reference ${form.name}@${line}`, options); + super(description || `Reference ${form.name}@${line.toString()}`, options); this._form = form; this._line = line; this._fallback = fallback; @@ -103,7 +103,7 @@ export class SymbolicLine, key: K, description?: string, options?: LineOptions) { - super(description || `Reference ${form.name}/${key}`, options); + super(description || `Reference ${form.name}/${String(key)}`, options); this._form = form; this._key = key; } @@ -124,7 +124,7 @@ export class InputLine extends Line form: Form; constructor(input: T, description?: string, fallback?: U[T], options?: LineOptions) { - super(description || `Input from ${input}`, options); + super(description || `Input from ${String(input)}`, options); this._input = input; this._fallback = fallback; } @@ -148,7 +148,7 @@ export class AccumulatorLine, line: L, description?: string, options?: LineOptions) { - super(description || `Accumulator ${form.name}@${line}`, options); + super(description || `Accumulator ${form.name}@${line.toString()}`, options); this._form = form; this._line = line; } -- 2.22.5