Dynamically resolve property type based on another property value in TypeScript : <p>I have the following TypeScript interface:</p>

<pre><code>interface SelectProps {
    options: Option[];
    value: string[];
    onChange: (value: string[]) =&gt; void;
}
</code></pre>

<p>I want to add boolean called <code>isMultiple</code> that will change the types of the other properties.</p>

<p>When <code>isMultiple=true</code></p>

<ul>
<li>enforce <code>value:string[]</code></li>
<li>enforce <code>onChange: (value: string[]) =&gt; void;</code></li>
</ul>

<p>When <code>isMultiple=false</code></p>

<ul>
<li>enforce <code>value:string</code></li>
<li>enforce <code>onChange: (value: string) =&gt; void;</code></li>
</ul>

<p>Is it possible to dynamically set the type of other properties based on the value of one property?</p>
