<h3 dir="auto"><g-emoji class="g-emoji" alias="computer" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f4bb.png">💻</g-emoji></h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Would you like to work on this feature?</li>
</ul>
<h3 dir="auto">What problem are you trying to solve?</h3>
<p dir="auto">TypeScript 4.7 Beta ships with <code class="notranslate">in</code> and<code class="notranslate"> out</code> modifiers for type parameters on type declarations.</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="type Getter&lt;out T&gt; = () =&gt; T;

type Setter&lt;in T&gt; = (value: T) =&gt; void;

interface State&lt;in out T&gt; {
    get: () =&gt; T;
    set: (value: T) =&gt; void;
}"><pre class="notranslate"><span class="pl-k">type</span> <span class="pl-smi">Getter</span><span class="pl-c1">&lt;</span><span class="pl-smi">out</span> <span class="pl-smi">T</span><span class="pl-c1">&gt;</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">T</span><span class="pl-kos">;</span>

<span class="pl-k">type</span> <span class="pl-smi">Setter</span><span class="pl-c1">&lt;</span><span class="pl-smi">in</span> <span class="pl-smi">T</span><span class="pl-c1">&gt;</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-s1">value</span>: <span class="pl-smi">T</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>

<span class="pl-k">interface</span> <span class="pl-smi">State</span><span class="pl-c1">&lt;</span><span class="pl-smi">in</span> <span class="pl-s1">out</span> <span class="pl-smi">T</span><span class="pl-c1">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-c1">get</span>: <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">T</span><span class="pl-kos">;</span>
    <span class="pl-c1">set</span>: <span class="pl-kos">(</span><span class="pl-s1">value</span>: <span class="pl-smi">T</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">TypeScript developers using Babel will need to support this syntax.</p>
<p dir="auto">These <code class="notranslate">in</code> and <code class="notranslate">out</code> modifiers can only be placed on type parameter declarations for</p>
<ul dir="auto">
<li><code class="notranslate">type</code> aliases</li>
<li><code class="notranslate">interface</code> declarations</li>
<li><code class="notranslate">class</code> declarations</li>
<li><a href="https://github.com/microsoft/TypeScript/issues/48618" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/48618/hovercard"><del><em>possibly</em></del> <code class="notranslate">class</code> expressions</a></li>
</ul>
<p dir="auto">It is possible to have <code class="notranslate">in</code>, <code class="notranslate">out</code>, and <code class="notranslate">in out</code>. Duplicates are not allowed, and <code class="notranslate">in</code> must always come before <code class="notranslate">out</code>.</p>
<h3 dir="auto">Describe the solution you'd like</h3>
<p dir="auto">For the next minor version of Babel, we may want to implement this feature.</p>
<h3 dir="auto">Describe alternatives you've considered</h3>
<p dir="auto">There are alternative compilers, but that would not be ideal for Babel users.</p>
<h3 dir="auto">Documentation, Adoption, Migration Strategy</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto"><g-emoji class="g-emoji" alias="computer" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f4bb.png">💻</g-emoji></h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Would you like to work on a fix?</li>
</ul>
<h3 dir="auto">How are you using Babel?</h3>
<p dir="auto">Other (Next.js, Gatsby, vue-cli, ...)</p>
<h3 dir="auto">Input code</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function foo(...[x]) {
 var x = 1
}"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">foo</span><span class="pl-kos">(</span>...<span class="pl-kos">[</span><span class="pl-s1">x</span><span class="pl-kos">]</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
 <span class="pl-k">var</span> <span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-c1">1</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">/repl.js: Duplicate declaration "x"</p>
<h3 dir="auto">Configuration file name</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Configuration</h3>
<p dir="auto"><a href="https://babeljs.io/repl#?browsers=chrome%2033&amp;build=&amp;builtIns=false&amp;corejs=3.6&amp;spec=false&amp;loose=false&amp;code_lz=GYVwdgxgLglg9mABMOcAUA6LBtAHgXQEpEBvAKEQDcBDAJ0V0QF5EBGMgXyA&amp;debug=false&amp;forceAllTransforms=false&amp;shippedProposals=false&amp;circleciRepo=&amp;evaluate=false&amp;fileSize=false&amp;timeTravel=false&amp;sourceType=module&amp;lineWrap=true&amp;presets=env&amp;prettier=false&amp;targets=&amp;version=7.16.9&amp;externalPlugins=&amp;assumptions=%7B%7D" rel="nofollow">https://babeljs.io/repl#?browsers=chrome%2033&amp;build=&amp;builtIns=false&amp;corejs=3.6&amp;spec=false&amp;loose=false&amp;code_lz=GYVwdgxgLglg9mABMOcAUA6LBtAHgXQEpEBvAKEQDcBDAJ0V0QF5EBGMgXyA&amp;debug=false&amp;forceAllTransforms=false&amp;shippedProposals=false&amp;circleciRepo=&amp;evaluate=false&amp;fileSize=false&amp;timeTravel=false&amp;sourceType=module&amp;lineWrap=true&amp;presets=env&amp;prettier=false&amp;targets=&amp;version=7.16.9&amp;externalPlugins=&amp;assumptions=%7B%7D</a></p>
<h3 dir="auto">Current and expected behavior</h3>
<p dir="auto">Current :error<br>
expected : no error</p>
<h3 dir="auto">Environment</h3>
<p dir="auto">.</p>
<h3 dir="auto">Possible solution</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Additional context</h3>
<p dir="auto">.</p>