How to specify partial object signatures correctly in TypeScript?
<p>The TypeScript code is based on the Angular 2 Cookbook chapter on dynamic forms - <a href="https://angular.io/docs/ts/latest/cookbook/dynamic-form.html" rel="nofollow">https://angular.io/docs/ts/latest/cookbook/dynamic-form.html</a></p>

<p>Please, observe:</p>

<p><strong>question-base.ts</strong></p>

<pre><code>export class QuestionBase&lt;T&gt;{
  value: T;
  key: string;
  label: string;
  required: boolean;
  order: number;
  controlType: string;
  constructor(options: {
    value?: T,
    key?: string,
    label?: string,
    required?: boolean,
    order?: number,
    controlType?: string
  } = {}) {
    this.value = options.value;
    this.key = options.key || '';
    this.label = options.label || '';
    this.required = !!options.required;
    this.order = options.order === undefined ? 1 : options.order;
    this.controlType = options.controlType || '';
  }
}
</code></pre>

<p><strong>multi-answer-question-base.ts</strong></p>

<pre><code>import {QuestionBase} from './question-base';

interface AnswerOption {
  key: string;
  value: string;
}

export class MultiAnswerQuestionBase&lt;T&gt; extends QuestionBase&lt;T&gt; {
  answerOptions: AnswerOption[];

  constructor(options: {answerOptions?: AnswerOption[]}) {
    super(options);
    this.answerOptions = options.answerOptions;
  }
}
</code></pre>

<p><strong>question-dropdown.ts</strong></p>

<pre><code>import {MultiAnswerQuestionBase} from './multi-answer-question-base';

export class DropdownQuestion extends MultiAnswerQuestionBase&lt;string&gt; {
  controlType = 'dropdown';
}
</code></pre>

<p>Now I am trying to instantiate <code>DropdownQuestion</code> like that:</p>

<pre><code>new DropdownQuestion({
    key: 'brave',
    label: 'Bravery Rating',
    order: 3,
    answerOptions: [
        {key: 'solid', value: 'Solid'},
        {key: 'great', value: 'Great'},
        {key: 'good', value: 'Good'},
        {key: 'unproven', value: 'Unproven'}
    ]
});
</code></pre>

<p>And here TypeScript complaints about the fields key, label and order:</p>

<pre><code>Error:(45, 17) TS2345: Argument of type '{ key: string; label: string; order: number; answerOptions: { key: string; value: string; }[]; }' is not assignable to parameter of type '{ answerOptions?: AnswerOption[]; }'.
 Object literal may only specify known properties, and 'key' does not exist in type '{ answerOptions?: AnswerOption[]; }'.
</code></pre>

<p>I understand the meaning of this error and I can fix it by either introducing more classes and make my code more similar to C# or Java or just throw away all the types and leave it JavaScript. Neither is a TypeScript way, I suspect.</p>

<p>So, what is the TypeScript way to fix it?</p>