Fix several implicit string conversion errors.
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 25 Mar 2023 16:46:56 +0000 (12:46 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 25 Mar 2023 16:46:56 +0000 (12:46 -0400)
src/core/Form.ts
src/core/Line.ts

index 6aaece894f34b1ea23065fcccd08f264bceb4f77..5d03a2f46bea4d3dedfd2b697a6a464cc8c49a75 100644 (file)
@@ -36,7 +36,7 @@ export default abstract class Form<I = unknown> {
 
   getLine<K extends keyof this['lines']>(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<I = unknown> {
 
   getInput<K extends keyof I>(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];
   }
 
index 3b709c90ad634e6947dfce9b80c7cbdcd5c4b14e..46d0fe0009a7123df02ed7c8dd91e5ef4d6d3e8e 100644 (file)
@@ -75,7 +75,7 @@ export class ReferenceLine<F extends Form,
   // the one the Line is in, erase |form|'s type with |as any| to
   // keep TypeScript happy.
   constructor(form: FormClass<F>, 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<F extends Form & { [key in K]: ComputeFunc<ReturnType<
   private _key: K;
 
   constructor(form: FormClass<F>, 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<U = unknown, T extends keyof U = any> extends Line<U[T]>
   form: Form<U>;
 
   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<F extends Form,
   private _line: L;
 
   constructor(form: FormClass<F>, 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;
   }