Simplify uses of ComputedLine to not type the |tr| argument.
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 23 Feb 2020 07:29:54 +0000 (02:29 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 23 Feb 2020 07:29:54 +0000 (02:29 -0500)
src/Line.test.ts
src/Line.ts
src/fed2019/Form1040.ts
src/fed2019/Form8959.ts
src/fed2019/ScheduleD.ts

index 0014ce6137bf6b25f8ddc5ff0110e640322de87d..52271d5ba1294cd12ab52274ed5074f5d93c1061 100644 (file)
@@ -19,9 +19,8 @@ class ConstantLine<T> extends Line<T> {
 test('computed line', () => {
   const tr = new TaxReturn(2019);
   const l = new ComputedLine<number>(
-    (taxReturn: TaxReturn, line: ComputedLine<number>): number => {
+    (taxReturn: TaxReturn): number => {
       expect(taxReturn).toBe(tr);
-      expect(line).toBe(l);
       return 42;
     },
     'Computed Line A');
@@ -117,7 +116,7 @@ test('line stack', () => {
   class FormZ2 extends Form<FormZ2['_lines']> {
     readonly name = 'Z-2';
     protected readonly _lines = {
-      '2c': new ComputedLine<number>((tr: TaxReturn, l: Line<number>): any => {
+      '2c': new ComputedLine<number>((tr: TaxReturn): any => {
           return tr.getForm(FormZ).getLine('3').value(tr) * 0.2;
         })
     };
index 8fec28a95763ccaee8dafda4072ce6e0c6366c0a..ed182e3bcae0ccc679db4062bcb130d18996e6bf 100644 (file)
@@ -22,7 +22,7 @@ export abstract class Line<T> {
   abstract value(tr: TaxReturn): T;
 };
 
-type ComputeFunc<T> = (tr: TaxReturn, l: ComputedLine<T>) => T;
+type ComputeFunc<T> = (tr: TaxReturn) => T;
 
 export class ComputedLine<T> extends Line<T> {
   private _compute: ComputeFunc<T>;
@@ -33,7 +33,7 @@ export class ComputedLine<T> extends Line<T> {
   }
 
   value(tr: TaxReturn): T {
-    return this._compute(tr, this);
+    return this._compute(tr);
   }
 };
 
@@ -91,7 +91,7 @@ export class AccumulatorLine<F extends Form<any>,
     this._line = line;
   }
 
-  value(tr: TaxReturn): number {
+  value(tr): number {
     const forms: F[] = tr.findForms(this._form);
     return sumLineOfForms(tr, forms, this._line);
   }
index f5822192c4ca4ba29b3652461413a7bb129bb044..ec36a017244eddb4f9e5690082aa1c70b0833ba1 100644 (file)
@@ -35,7 +35,7 @@ export default class Form1040 extends Form<Form1040['_lines'], Form1040Input> {
     '4d': new ComputedLine(() => 0),
     // 4c and 4d are not supported
     // 5a and 5b are not supported
-    '6': new ComputedLine((tr: TaxReturn): number => {
+    '6': new ComputedLine((tr): number => {
       const schedD = tr.findForm(ScheduleD);
       if (!schedD)
         return 0;
@@ -47,7 +47,7 @@ export default class Form1040 extends Form<Form1040['_lines'], Form1040Input> {
     }, 'Capital gain/loss'),
     '7a': new ReferenceLine(/*'Schedule 1'*/ undefined, '9', 'Other income from Schedule 1', 0),
 
-    '7b': new ComputedLine((tr: TaxReturn): number => {
+    '7b': new ComputedLine((tr): number => {
       let income = 0;
       income += this.getValue(tr, '1');
       income += this.getValue(tr, '2b');
@@ -62,14 +62,14 @@ export default class Form1040 extends Form<Form1040['_lines'], Form1040Input> {
 
     '8a': new ReferenceLine(undefined /*'Schedule 1'*/, '22', 'Adjustments to income', 0),
 
-    '8b': new ComputedLine((tr: TaxReturn): number => {
+    '8b': new ComputedLine((tr): number => {
       return this.getValue(tr, '7b') - this.getValue(tr, '8a');
     }, 'Adjusted gross income'),
 
     // TODO - Deduction
     '9': new ComputedLine(() => 0, 'Deduction'),
 
-    '10': new ComputedLine((tr: TaxReturn): number => {
+    '10': new ComputedLine((tr): number => {
       const taxableIncome = this.getValue(tr, '8b');
       let use8995a = false;
       switch (this.getInput('filingStatus')) {
@@ -80,15 +80,15 @@ export default class Form1040 extends Form<Form1040['_lines'], Form1040Input> {
       return 0;
     }, 'Qualified business income deduction'),
 
-    '11a': new ComputedLine((tr: TaxReturn): number => {
+    '11a': new ComputedLine((tr): number => {
       return this.getValue(tr, '9') + this.getValue(tr, '10');
     }),
-    '11b': new ComputedLine((tr: TaxReturn): number => {
+    '11b': new ComputedLine((tr): number => {
       const value = this.getValue(tr, '8b') - this.getValue(tr, '11a');
       return value < 0 ? 0 : value;
     }, 'Taxable income'),
 
-    '12a': new ComputedLine((tr: TaxReturn): number => {
+    '12a': new ComputedLine((tr): number => {
       // Not supported:
       // Form 8814 (election to report child's interest or dividends)
       // Form 4972 (relating to lump-sum distributions)
@@ -104,18 +104,18 @@ export default class Form1040 extends Form<Form1040['_lines'], Form1040Input> {
       return computeTax(taxableIncome, this.getInput('filingStatus'));
     }, 'Tax'),
 
-    '12b': new ComputedLine((tr: TaxReturn): number => {
+    '12b': new ComputedLine((tr): number => {
       return this.getValue(tr, '12a') + tr.getForm(Schedule2).getValue(tr, '3');
     }, 'Additional tax'),
 
     // Not supported: 13a - child tax credit
 
-    '13b': new ComputedLine((tr: TaxReturn): number => {
+    '13b': new ComputedLine((tr): number => {
       // TODO: add Sched 3.L7
       return 0;
     }, 'Additional credits'),
 
-    '14': new ComputedLine((tr: TaxReturn): number => {
+    '14': new ComputedLine((tr): number => {
       const l12b = this.getValue(tr, '12b');
       const l13b = this.getValue(tr, '13b');
       const value = l12b - l13b;
@@ -124,11 +124,11 @@ export default class Form1040 extends Form<Form1040['_lines'], Form1040Input> {
 
     '15': new ReferenceLine(undefined /*'Schedule 2'*/, '10', undefined, 0),
 
-    '16': new ComputedLine((tr: TaxReturn): number => {
+    '16': new ComputedLine((tr): number => {
       return this.getValue(tr, '14') + this.getValue(tr, '15');
     }, 'Total tax'),
 
-    '17': new ComputedLine((tr: TaxReturn): number => {
+    '17': new ComputedLine((tr): number => {
       const fedTaxWithheldBoxes = [
         new AccumulatorLine(FormW2, '2'),
         //new AccumulatorLine(Form1099R, '4'),
@@ -150,7 +150,7 @@ export default class Form1040 extends Form<Form1040['_lines'], Form1040Input> {
 
     '19': new ReferenceLine(Form1040 as any, '17', 'Total payments'),
 
-    '20': new ComputedLine((tr: TaxReturn): number => {
+    '20': new ComputedLine((tr): number => {
       const l16: number = this.getValue(tr, '16');
       const l19: number = this.getValue(tr, '19');
       if (l19 > l16)
@@ -158,7 +158,7 @@ export default class Form1040 extends Form<Form1040['_lines'], Form1040Input> {
       return 0;
     }, 'Amount overpaid'),
 
-    '23': new ComputedLine((tr: TaxReturn): number => {
+    '23': new ComputedLine((tr): number => {
       const l16 = this.getValue(tr, '16');
       const l19 = this.getValue(tr, '19');
       if (l19 < l16)
@@ -172,7 +172,7 @@ export class Schedule2 extends Form<Schedule2['_lines']> {
   readonly name = 'Schedule 2';
 
   protected readonly _lines = {
-    '1': new ComputedLine((tr: TaxReturn): number => {
+    '1': new ComputedLine((tr): number => {
       // TODO - this is just using Taxable Income, rather than AMT-limited
       // income
       const f1040 = tr.getForm(Form1040);
@@ -191,7 +191,7 @@ export class Schedule2 extends Form<Schedule2['_lines']> {
       throw new UnsupportedFeatureError('The AMT is not supported');
     }, 'AMT'),
     // 2 is not supported (Excess advance premium tax credit repayment)
-    '3': new ComputedLine((tr: TaxReturn): number => {
+    '3': new ComputedLine((tr): number => {
       // Should include line 2.
       return this.getValue(tr, '1');
     }),
@@ -200,7 +200,7 @@ export class Schedule2 extends Form<Schedule2['_lines']> {
     // 5 is not supported (Unreported social security and Medicare tax from)
     // 6 is not supported (Additional tax on IRAs, other qualified retirement plans, and other tax-favored accounts)
     // 7 is not supported (Household employment taxes.)
-    '8': new ComputedLine((tr: TaxReturn): number => {
+    '8': new ComputedLine((tr): number => {
       const f1040 = tr.getForm(Form1040);
       const wages = f1040.getLine('1').value(tr);
       const agi = f1040.getLine('8b').value(tr);
@@ -243,7 +243,7 @@ export class Schedule2 extends Form<Schedule2['_lines']> {
     }),
     // 9 is not supported (Section 965 net tax liability installment from Form 965-A)
 
-    '10': new ComputedLine((tr: TaxReturn): number => {
+    '10': new ComputedLine((tr): number => {
       // Should be lines 4 - 8.
       return this.getValue(tr, '8');
     })
index 93f7b433b228ace61d14e9f3e07af600d9006fe2..35041deec2c9816bd86fdfab41ec46c32aa55e07 100644 (file)
@@ -12,39 +12,39 @@ export default class Form8959 extends Form<Form8959['_lines']> {
     '1': new AccumulatorLine(FormW2, '5', 'Medicare wages'),
     // 2 is not supported (Unreported tips from Form 4137)
     // 3 is not supported (Wages from Form 8919)
-    '4': new ComputedLine((tr: TaxReturn): number => {
+    '4': new ComputedLine((tr): number => {
       // Should include 2-3.
       return this.getValue(tr, '1');
     }),
-    '5': new ComputedLine((tr: TaxReturn): number => {
+    '5': new ComputedLine((tr): number => {
       return Form8959.filingStatusLimit(tr.getForm(Form1040).getInput('filingStatus'));
     }),
-    '6': new ComputedLine((tr: TaxReturn): number => {
+    '6': new ComputedLine((tr): number => {
       const value = this.getValue(tr, '5') - this.getValue(tr, '4');
       return value < 0 ? 0 : value;
     }),
-    '7': new ComputedLine((tr: TaxReturn): number => {
+    '7': new ComputedLine((tr): number => {
       return this.getValue(tr, '6') * 0.009;
     }, 'Additional Medicare tax on Medicare wages'),
 
     // All of Section 2 and 3 skipped.
 
-    '18': new ComputedLine((tr: TaxReturn): number => {
+    '18': new ComputedLine((tr): number => {
       // Should include 13 and 17.
       return this.getValue(tr, '7');
     }),
 
     '19': new AccumulatorLine(FormW2, '6', 'Medicare tax withheld'),
     '20': new ReferenceLine(Form8959 as any, '1'),
-    '21': new ComputedLine((tr: TaxReturn): number => {
+    '21': new ComputedLine((tr): number => {
       return this.getValue(tr, '20') * 0.0145;
     }, 'Regular Medicare withholding on Medicare wages'),
-    '22': new ComputedLine((tr: TaxReturn): number => {
+    '22': new ComputedLine((tr): number => {
       const value = this.getValue(tr, '19') - this.getValue(tr, '21');
       return value < 0 ? 0 : value;
     }, 'Additional Medicare withholding on Medicare wages'),
     // 23 is not supported (Additional Medicare Tax withholding on railroad retirement (RRTA) compensation)
-    '24': new ComputedLine((tr: TaxReturn): number => {
+    '24': new ComputedLine((tr): number => {
       // Should include 23.
       return this.getValue(tr, '22');
     }),
index 35f08aae54b8fb831769a636f13797f909bb8ee6..f36e47f90a7044def5dabccec4d3f9d17a92e85c 100644 (file)
@@ -18,7 +18,7 @@ export default class ScheduleD extends Form<ScheduleD['_lines']> {
     // 5 is not supported (Net short-term gain or (loss) from partnerships, S corporations, estates, and trusts from Schedule(s) K-1)
     // 6 is not supported (Short-term capital loss carryover. Enter the amount, if any, from line 8 of your Capital Loss Carryover Worksheet in the instructions)
 
-    '7': new ComputedLine((tr: TaxReturn): number => {
+    '7': new ComputedLine((tr): number => {
       // 1-3 are computed by Form8949.
       // 4-6 should be included.
       const f8949 = tr.getForm(Form8949);
@@ -36,7 +36,7 @@ export default class ScheduleD extends Form<ScheduleD['_lines']> {
 
     // 14 is not supported (Long-term capital loss carryover. Enter the amount, if any, from line 13 of your Capital Loss Carryover Worksheet in the instructions)
 
-    '15': new ComputedLine((tr: TaxReturn): number => {
+    '15': new ComputedLine((tr): number => {
       // 11-14 should be included.
       const f8949 = tr.getForm(Form8949);
       return f8949.getValue(tr, 'boxD').gainOrLoss +
@@ -45,15 +45,15 @@ export default class ScheduleD extends Form<ScheduleD['_lines']> {
              this.getValue(tr, '13');
     }, 'Net long-term capital gain or (loss)'),
 
-    '16': new ComputedLine((tr: TaxReturn): number => {
+    '16': new ComputedLine((tr): number => {
       return this.getValue(tr, '7') + this.getValue(tr, '15');
     }),
 
-    '17': new ComputedLine((tr: TaxReturn): boolean => {
+    '17': new ComputedLine((tr): boolean => {
       return this.getValue(tr, '15') > 0 && this.getValue(tr, '16') > 0;
     }, 'Both ST and LT are gains'),
 
-    '18': new ComputedLine((tr: TaxReturn): number | undefined => {
+    '18': new ComputedLine((tr): number | undefined => {
       if (!this.getValue(tr, '17') || this.getValue(tr, '16') <= 0)
         return undefined;
       // Not supported - only for gains on Qualified Small Business Stock or collectibles.
@@ -62,7 +62,7 @@ export default class ScheduleD extends Form<ScheduleD['_lines']> {
 
     // 19 is not supported (Unrecaptured Section 1250 Gain Worksheet)
 
-    '20': new ComputedLine((tr: TaxReturn): boolean | undefined => {
+    '20': new ComputedLine((tr): boolean | undefined => {
       if (!this.getValue(tr, '17') || this.getValue(tr, '16') <= 0)
         return undefined;
       const l18 = this.getValue(tr, '18');
@@ -70,7 +70,7 @@ export default class ScheduleD extends Form<ScheduleD['_lines']> {
       return (l18 === 0 || l18 === undefined) || (l19 === 0 || l19 === undefined);
     }, 'Line 18 and 19 both 0 or blank?'),
 
-    '21': new ComputedLine((tr: TaxReturn): number | undefined => {
+    '21': new ComputedLine((tr): number | undefined => {
       if (!this.getValue(tr, '17') || !this.getValue(tr, '20'))
         return undefined;
       const filingStatus = tr.getForm(Form1040).getInput('filingStatus');
@@ -88,27 +88,27 @@ export class ScheduleDTaxWorksheet extends Form<ScheduleDTaxWorksheet['_lines']>
     '2': new ReferenceLine(Form1040, '3a'),
     // TODO 3 - form 4952
     // TODO 4 - 4952
-    '5': new ComputedLine((tr: TaxReturn): number => 0),
-    '6': new ComputedLine((tr: TaxReturn): number => clampToZero(this.getValue(tr, '2') - this.getValue(tr, '5'))),
-    '7': new ComputedLine((tr: TaxReturn): number => {
+    '5': new ComputedLine((tr): number => 0),
+    '6': new ComputedLine((tr): number => clampToZero(this.getValue(tr, '2') - this.getValue(tr, '5'))),
+    '7': new ComputedLine((tr): number => {
       const schedD = tr.getForm(ScheduleD);
       return Math.min(schedD.getValue(tr, '15'), schedD.getValue(tr, '16'));
     }),
-    '8': new ComputedLine((tr: TaxReturn): number => {
+    '8': new ComputedLine((tr): number => {
       return 0;
       // return Math.min(this.getValue(tr, '3'), this.getValue(tr, '4'));
     }),
-    '9': new ComputedLine((tr: TaxReturn): number => clampToZero(this.getValue(tr, '7') - this.getValue(tr, '8'))),
-    '10': new ComputedLine((tr: TaxReturn): number => this.getValue(tr, '6') + this.getValue(tr, '9')),
-    '11': new ComputedLine((tr: TaxReturn): number => {
+    '9': new ComputedLine((tr): number => clampToZero(this.getValue(tr, '7') - this.getValue(tr, '8'))),
+    '10': new ComputedLine((tr): number => this.getValue(tr, '6') + this.getValue(tr, '9')),
+    '11': new ComputedLine((tr): number => {
       const schedD = tr.getForm(ScheduleD);
       // TODO - line 19 is not supported.
       return Math.min(schedD.getValue(tr, '18'), Infinity); //schedD.getValue(tr, '19'));
     }),
-    '12': new ComputedLine((tr: TaxReturn): number => Math.min(this.getValue(tr, '9'), this.getValue(tr, '11'))),
-    '13': new ComputedLine((tr: TaxReturn): number => this.getValue(tr, '10') - this.getValue(tr, '12')),
-    '14': new ComputedLine((tr: TaxReturn): number => clampToZero(this.getValue(tr, '1') - this.getValue(tr, '13'))),
-    '15': new ComputedLine((tr: TaxReturn): number => {
+    '12': new ComputedLine((tr): number => Math.min(this.getValue(tr, '9'), this.getValue(tr, '11'))),
+    '13': new ComputedLine((tr): number => this.getValue(tr, '10') - this.getValue(tr, '12')),
+    '14': new ComputedLine((tr): number => clampToZero(this.getValue(tr, '1') - this.getValue(tr, '13'))),
+    '15': new ComputedLine((tr): number => {
       switch (tr.getForm(Form1040).getInput('filingStatus')) {
         case FilingStatus.Single:
         case FilingStatus.MarriedFilingSeparate:
@@ -117,10 +117,10 @@ export class ScheduleDTaxWorksheet extends Form<ScheduleDTaxWorksheet['_lines']>
           return 78750;
       }
     }),
-    '16': new ComputedLine((tr: TaxReturn): number => Math.min(this.getValue(tr, '1'), this.getValue(tr, '15'))),
-    '17': new ComputedLine((tr: TaxReturn): number => Math.min(this.getValue(tr, '14'), this.getValue(tr, '16'))),
-    '18': new ComputedLine((tr: TaxReturn): number => clampToZero(this.getValue(tr, '1') - this.getValue(tr, '10'))),
-    '19': new ComputedLine((tr: TaxReturn): number => {
+    '16': new ComputedLine((tr): number => Math.min(this.getValue(tr, '1'), this.getValue(tr, '15'))),
+    '17': new ComputedLine((tr): number => Math.min(this.getValue(tr, '14'), this.getValue(tr, '16'))),
+    '18': new ComputedLine((tr): number => clampToZero(this.getValue(tr, '1') - this.getValue(tr, '10'))),
+    '19': new ComputedLine((tr): number => {
       let threshold: number;
       switch (tr.getForm(Form1040).getInput('filingStatus')) {
         case FilingStatus.Single:
@@ -133,13 +133,13 @@ export class ScheduleDTaxWorksheet extends Form<ScheduleDTaxWorksheet['_lines']>
       }
       return Math.min(this.getValue(tr, '1'), threshold);
     }),
-    '20': new ComputedLine((tr: TaxReturn): number => Math.min(this.getValue(tr, '14'), this.getValue(tr, '19'))),
-    '21': new ComputedLine((tr: TaxReturn): number => Math.max(this.getValue(tr, '18'), this.getValue(tr, '20'))),
-    '22': new ComputedLine((tr: TaxReturn): number => this.getValue(tr, '16') - this.getValue(tr, '17')),
-    '23': new ComputedLine((tr: TaxReturn): number => Math.min(this.getValue(tr, '1'), this.getValue(tr, '13'))),
+    '20': new ComputedLine((tr): number => Math.min(this.getValue(tr, '14'), this.getValue(tr, '19'))),
+    '21': new ComputedLine((tr): number => Math.max(this.getValue(tr, '18'), this.getValue(tr, '20'))),
+    '22': new ComputedLine((tr): number => this.getValue(tr, '16') - this.getValue(tr, '17')),
+    '23': new ComputedLine((tr): number => Math.min(this.getValue(tr, '1'), this.getValue(tr, '13'))),
     '24': new ReferenceLine(ScheduleDTaxWorksheet as any, '22'),
-    '25': new ComputedLine((tr: TaxReturn): number => clampToZero(this.getValue(tr, '23') - this.getValue(tr, '24'))),
-    '26': new ComputedLine((tr: TaxReturn): number => {
+    '25': new ComputedLine((tr): number => clampToZero(this.getValue(tr, '23') - this.getValue(tr, '24'))),
+    '26': new ComputedLine((tr): number => {
       switch (tr.getForm(Form1040).getInput('filingStatus')) {
         case FilingStatus.Single:
           return 434550;
@@ -149,55 +149,55 @@ export class ScheduleDTaxWorksheet extends Form<ScheduleDTaxWorksheet['_lines']>
           return 488850;
       }
     }),
-    '27': new ComputedLine((tr: TaxReturn): number => Math.min(this.getValue(tr, '1'), this.getValue(tr, '26'))),
-    '28': new ComputedLine((tr: TaxReturn): number => this.getValue(tr, '21') + this.getValue(tr, '22')),
-    '29': new ComputedLine((tr: TaxReturn): number => clampToZero(this.getValue(tr, '27') - this.getValue(tr, '28'))),
-    '30': new ComputedLine((tr: TaxReturn): number => Math.min(this.getValue(tr, '25'), this.getValue(tr, '29'))),
-    '31': new ComputedLine((tr: TaxReturn): number => this.getValue(tr, '30') * 0.15),
-    '32': new ComputedLine((tr: TaxReturn): number => this.getValue(tr, '24') + this.getValue(tr, '30')),
-    '33': new ComputedLine((tr: TaxReturn): number => this.getValue(tr, '23') - this.getValue(tr, '32')),
-    '34': new ComputedLine((tr: TaxReturn): number => this.getValue(tr, '33') * 0.20),
-    '35': new ComputedLine((tr: TaxReturn): number => {
+    '27': new ComputedLine((tr): number => Math.min(this.getValue(tr, '1'), this.getValue(tr, '26'))),
+    '28': new ComputedLine((tr): number => this.getValue(tr, '21') + this.getValue(tr, '22')),
+    '29': new ComputedLine((tr): number => clampToZero(this.getValue(tr, '27') - this.getValue(tr, '28'))),
+    '30': new ComputedLine((tr): number => Math.min(this.getValue(tr, '25'), this.getValue(tr, '29'))),
+    '31': new ComputedLine((tr): number => this.getValue(tr, '30') * 0.15),
+    '32': new ComputedLine((tr): number => this.getValue(tr, '24') + this.getValue(tr, '30')),
+    '33': new ComputedLine((tr): number => this.getValue(tr, '23') - this.getValue(tr, '32')),
+    '34': new ComputedLine((tr): number => this.getValue(tr, '33') * 0.20),
+    '35': new ComputedLine((tr): number => {
       const schedD = tr.getForm(ScheduleD);
       // TODO - line 19 is not supported.
       return Math.min(this.getValue(tr, '9'), Infinity); //schedD.getValue(tr, '19'));
     }),
-    '36': new ComputedLine((tr: TaxReturn): number => this.getValue(tr, '10') + this.getValue(tr, '21')),
+    '36': new ComputedLine((tr): number => this.getValue(tr, '10') + this.getValue(tr, '21')),
     '37': new ReferenceLine(ScheduleDTaxWorksheet as any, '1'),
-    '38': new ComputedLine((tr: TaxReturn): number => clampToZero(this.getValue(tr, '36') - this.getValue(tr, '37'))),
-    '39': new ComputedLine((tr: TaxReturn): number => clampToZero(this.getValue(tr, '35') - this.getValue(tr, '38'))),
-    '40': new ComputedLine((tr: TaxReturn): number => this.getValue(tr, '39') * 0.25),
-    '41': new ComputedLine((tr: TaxReturn): number => {
+    '38': new ComputedLine((tr): number => clampToZero(this.getValue(tr, '36') - this.getValue(tr, '37'))),
+    '39': new ComputedLine((tr): number => clampToZero(this.getValue(tr, '35') - this.getValue(tr, '38'))),
+    '40': new ComputedLine((tr): number => this.getValue(tr, '39') * 0.25),
+    '41': new ComputedLine((tr): number => {
       const schedD = tr.getForm(ScheduleD);
       if (schedD.getValue(tr, '18'))
         throw new UnsupportedFeatureError('28% Gain unsupported');
       return 0;
     }),
-    '42': new ComputedLine((tr: TaxReturn): number => {
+    '42': new ComputedLine((tr): number => {
       if (!tr.getForm(ScheduleD).getValue(tr, '18'))
         return 0;
       return this.getValue(tr, '1') - this.getValue(tr, '41');
     }),
-    '43': new ComputedLine((tr: TaxReturn): number => {
+    '43': new ComputedLine((tr): number => {
       if (!tr.getForm(ScheduleD).getValue(tr, '18'))
         return 0;
       return this.getValue(tr, '42') * 0.28;
     }),
-    '44': new ComputedLine((tr: TaxReturn): number => {
+    '44': new ComputedLine((tr): number => {
       const income = this.getValue(tr, '21');
       return computeTax(income, tr.getForm(Form1040).getInput('filingStatus'));
     }),
-    '45': new ComputedLine((tr: TaxReturn): number => {
+    '45': new ComputedLine((tr): number => {
       return this.getValue(tr, '31') +
              this.getValue(tr, '34') +
              this.getValue(tr, '40') +
              this.getValue(tr, '43') +
              this.getValue(tr, '44');
     }),
-    '46': new ComputedLine((tr: TaxReturn): number => {
+    '46': new ComputedLine((tr): number => {
       const income = this.getValue(tr, '1');
       return computeTax(income, tr.getForm(Form1040).getInput('filingStatus'));
     }),
-    '47': new ComputedLine((tr: TaxReturn): number => Math.min(this.getValue(tr, '45'), this.getValue(tr, '46'))),
+    '47': new ComputedLine((tr): number => Math.min(this.getValue(tr, '45'), this.getValue(tr, '46'))),
   };
 };