expect(isFormT(new FormA(), FormB)).toBe(false);
expect(isFormT(new FormB(), FormB)).toBe(true);
});
-
-/*
-abstract class Form2<L extends { [key: string]: Line<any> } , I> {
- abstract readonly name: string;
-
- protected abstract readonly _lines: L;
- protected abstract readonly _input?: I;
-
- getLine<K extends keyof L>(key: K): L[K] {
- return this._lines[key];
- }
-
- getInput<K extends keyof I>(key: K): I[K] {
- return this._input[key];
- }
-
- getValue<T, K extends keyof L>(tr: TaxReturn, key: K): T {
- const line = this.getLine(key);
- return line.value(tr);
- }
-};
-
-class FormG extends Form2<FormG['_lines'], FormG['_input']> {
- readonly name = 'G';
-
- protected readonly _lines = {
- x: new ComputedLine('moo', () => 42),
- z: new ComputedLine('moo', () => 36),
- };
- protected readonly _input = null;
-
- private _moo = 42;
-
- getLineImpl<T, K extends keyof T>(lines: T, k: K): T[K] {
- return lines[k];
- }
-
- allLines(): FormG['_lines'] {
- return this._lines;
- }
-
- LINE = k => this.getLineImpl(this._lines, k);
-
- testLine<K extends keyof ReturnType<FormG['allLines']>>(k: K): any {
- return this.getLineImpl(this._lines, k);
- }
-}
-
-test('testing', () => {
- const g = new FormG();
- let v = g.testLine('x'); //g.getLineImpl(g._lines, 'x');
- let v2 = g.getValue(null, 'z');
- throw new Error(`v = ${v2}`);
-});
-*/