From 3abea86f3c4bf91e222b8d7c5d76d5a4e2717261 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 20 Feb 2020 00:08:57 -0500 Subject: [PATCH] Strongly type TaxReturn.getForm{,s}() --- src/TaxReturn.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/TaxReturn.ts b/src/TaxReturn.ts index 940c965..23a00ad 100644 --- a/src/TaxReturn.ts +++ b/src/TaxReturn.ts @@ -47,8 +47,8 @@ export default class TaxReturn { this._forms.push(form); } - getForm(name: string): Form { - const forms = this.getForms(name); + getForm(name: string): T { + const forms = this.getForms(name); if (forms.length == 0) { throw new NotFoundError(`No form named ${name}`); } @@ -58,7 +58,7 @@ export default class TaxReturn { return forms[0]; } - getForms(name: string): Form[] { - return this._forms.filter(f => f.name == name); + getForms(name: string): T[] { + return this._forms.filter(f => f.name == name) as T[]; } }; -- 2.43.5