<p dir="auto"><em>From <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/wangyibu/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/wangyibu">@wangyibu</a> on April 29, 2016 9:34</em></p>
<ul dir="auto">
<li>VSCode Version:1.0.0</li>
<li>OS Version:window7 sp1 build 7601</li>
<li>VS2015: commuity 2015 update1</li>
<li>system path:  C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7;</li>
</ul>
<p dir="auto">Steps to Reproduce:</p>
<p dir="auto">1.add two ts file and compile</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/14134768/14912855/95bd0bde-0e31-11e6-8289-36e5e878e8f2.png"><img src="https://cloud.githubusercontent.com/assets/14134768/14912855/95bd0bde-0e31-11e6-8289-36e5e878e8f2.png" alt="1" style="max-width: 100%;"></a></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/14134768/14912859/a0574316-0e31-11e6-94d4-174b19554a36.png"><img src="https://cloud.githubusercontent.com/assets/14134768/14912859/a0574316-0e31-11e6-94d4-174b19554a36.png" alt="2" style="max-width: 100%;"></a></p>
<p dir="auto">2.add new folder</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/14134768/14912898/e0a9252e-0e31-11e6-9908-e81c22dbb254.png"><img src="https://cloud.githubusercontent.com/assets/14134768/14912898/e0a9252e-0e31-11e6-9908-e81c22dbb254.png" alt="3" style="max-width: 100%;"></a></p>
<ol dir="auto">
<li>move all ts file and js file to new folder<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/14134768/14912921/fc6fe90a-0e31-11e6-99eb-c106f8092e52.png"><img src="https://cloud.githubusercontent.com/assets/14134768/14912921/fc6fe90a-0e31-11e6-99eb-c106f8092e52.png" alt="image" style="max-width: 100%;"></a></li>
</ol>
<p dir="auto"><em>Copied from original issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="151827637" data-permission-text="Title is private" data-url="https://github.com/microsoft/vscode/issues/5980" data-hovercard-type="issue" data-hovercard-url="/microsoft/vscode/issues/5980/hovercard" href="https://github.com/microsoft/vscode/issues/5980">microsoft/vscode#5980</a></em></p>
<p dir="auto">Using destructuring in functions signatures is a relief, but when combining it with type declarations there is a lot of duplication necessary:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function foo(
  {paramA, paramB, paramC, paramD = null}
  :{paramA: number, paramB: string, paramC: boolean, paramD?: Object}
) {}

function bar(
  [paramA, paramB, paramC, paramD]
  :[number, string, boolean, Object]
) {}"><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>paramA<span class="pl-kos">,</span> paramB<span class="pl-kos">,</span> paramC<span class="pl-kos">,</span> paramD <span class="pl-c1">=</span> <span class="pl-c1">null</span><span class="pl-kos">}</span>
  :<span class="pl-kos">{</span><span class="pl-c1">paramA</span>: <span class="pl-smi">number</span><span class="pl-kos">,</span> <span class="pl-c1">paramB</span>: <span class="pl-smi">string</span><span class="pl-kos">,</span> <span class="pl-c1">paramC</span>: <span class="pl-smi">boolean</span><span class="pl-kos">,</span> <span class="pl-c1">paramD</span>?: <span class="pl-smi">Object</span><span class="pl-kos">}</span>
<span class="pl-kos">)</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>

<span class="pl-k">function</span> <span class="pl-en">bar</span><span class="pl-kos">(</span>
  <span class="pl-kos">[</span><span class="pl-s1">paramA</span><span class="pl-kos">,</span> <span class="pl-s1">paramB</span><span class="pl-kos">,</span> <span class="pl-s1">paramC</span><span class="pl-kos">,</span> <span class="pl-s1">paramD</span><span class="pl-kos">]</span>
  :<span class="pl-kos">[</span><span class="pl-smi">number</span><span class="pl-kos">,</span> <span class="pl-smi">string</span><span class="pl-kos">,</span> <span class="pl-smi">boolean</span><span class="pl-kos">,</span> <span class="pl-smi">Object</span><span class="pl-kos">]</span>
<span class="pl-kos">)</span> <span class="pl-kos">{</span><span class="pl-kos">}</span></pre></div>
<p dir="auto">Would it make sense to introduce the following syntax to reduce duplication of code?</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function foo(
  {paramA as number, paramB as string, paramC as boolean, paramD? as Object}
) {}

function bar(
  [paramA as number, paramB as string, paramC as boolean, paramD as Object]
) {}"><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>paramA <span class="pl-s1">as</span> number<span class="pl-kos">,</span> paramB <span class="pl-s1">as</span> string<span class="pl-kos">,</span> <span class="pl-s1">paramC</span> <span class="pl-s1">as</span> boolean<span class="pl-kos">,</span> <span class="pl-s1">paramD</span>? <span class="pl-k">as</span> Object<span class="pl-kos">}</span>
<span class="pl-kos">)</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>

<span class="pl-k">function</span> <span class="pl-en">bar</span><span class="pl-kos">(</span>
  <span class="pl-kos">[</span><span class="pl-s1">paramA</span> <span class="pl-k">as</span> <span class="pl-smi">number</span><span class="pl-kos">,</span> <span class="pl-s1">paramB</span> <span class="pl-k">as</span> <span class="pl-smi">string</span><span class="pl-kos">,</span> <span class="pl-s1">paramC</span> <span class="pl-k">as</span> <span class="pl-smi">boolean</span><span class="pl-kos">,</span> <span class="pl-s1">paramD</span> <span class="pl-k">as</span> <span class="pl-smi">Object</span><span class="pl-kos">]</span><span class="pl-c1"></span>
<span class="pl-kos">)</span> <span class="pl-kos">{</span><span class="pl-kos">}</span></pre></div>
<p dir="auto">Originally I wanted to suggest to use the colon ":" instead of the "as", but since the colon is used for renaming destructured parametes, the "as" is the only option I guess.</p>
<p dir="auto">With this syntax change the following would be possible too I guess:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="let {paramA as number, paramB as string, paramC as boolean, paramD as Object} = anyObject;
let {paramA: a as number, paramB: b as string, paramC: c as boolean, paramD: d as Object} = anyObject;
let [paramA as number, paramB as string, paramC as boolean, paramD as Object] = anyArray;"><pre class="notranslate"><span class="pl-k">let</span> <span class="pl-kos">{</span>paramA <span class="pl-s1">as</span> number<span class="pl-kos">,</span> paramB <span class="pl-s1">as</span> string<span class="pl-kos">,</span> <span class="pl-s1">paramC</span> <span class="pl-s1">as</span> boolean<span class="pl-kos">,</span> paramD <span class="pl-s1">as</span> <span class="pl-smi">Object</span><span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-s1">anyObject</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> <span class="pl-kos">{</span><span class="pl-c1">paramA</span>: <span class="pl-s1">a</span> <span class="pl-k">as</span> <span class="pl-smi">number</span><span class="pl-c1"></span><span class="pl-kos">,</span> <span class="pl-c1">paramB</span>: <span class="pl-s1">b</span> <span class="pl-k">as</span> <span class="pl-smi">string</span><span class="pl-c1"></span><span class="pl-kos">,</span> <span class="pl-c1">paramC</span>: <span class="pl-s1">c</span> <span class="pl-k">as</span> <span class="pl-smi">boolean</span><span class="pl-c1"></span><span class="pl-kos">,</span> <span class="pl-c1">paramD</span>: <span class="pl-s1">d</span> <span class="pl-k">as</span> <span class="pl-smi">Object</span><span class="pl-c1"></span><span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-s1">anyObject</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> <span class="pl-kos">[</span><span class="pl-s1">paramA</span> <span class="pl-k">as</span> <span class="pl-smi">number</span><span class="pl-c1"></span><span class="pl-kos">,</span> <span class="pl-s1">paramB</span> <span class="pl-k">as</span> <span class="pl-smi">string</span><span class="pl-c1"></span><span class="pl-kos">,</span> <span class="pl-s1">paramC</span> <span class="pl-k">as</span> <span class="pl-smi">boolean</span><span class="pl-c1"></span><span class="pl-kos">,</span> <span class="pl-s1">paramD</span> <span class="pl-k">as</span> <span class="pl-smi">Object</span><span class="pl-c1"></span><span class="pl-kos">]</span> <span class="pl-c1">=</span> <span class="pl-s1">anyArray</span><span class="pl-kos">;</span></pre></div>