<h2 dir="auto">Bug Report</h2>
<p dir="auto"><strong>Current Behavior</strong><br>
when using babel with plugin-transform-flow-strip-types type imports like <code class="notranslate">import { type MyType } from '...'</code> are not stripped out. Instead they are transformed to <code class="notranslate">require('math');</code></p>
<p dir="auto"><strong>Input Code</strong><br>
<a href="https://babeljs.io/repl/#?babili=false&amp;browsers=&amp;build=&amp;builtIns=false&amp;spec=false&amp;loose=true&amp;code_lz=JYWwDg9gTgLgBAbzjAnmApnAsgQxgCzgF84AzKCEOAchD32oG4g&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=react%2Cenv&amp;prettier=false&amp;targets=Node-8.9&amp;version=6.26.0&amp;envVersion=1.6.2" rel="nofollow">https://babeljs.io/repl/#?babili=false&amp;browsers=&amp;build=&amp;builtIns=false&amp;spec=false&amp;loose=true&amp;code_lz=JYWwDg9gTgLgBAbzjAnmApnAsgQxgCzgF84AzKCEOAchD32oG4g&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=react%2Cenv&amp;prettier=false&amp;targets=Node-8.9&amp;version=6.26.0&amp;envVersion=1.6.2</a></p>
<p dir="auto"><strong>Expected behavior/code</strong><br>
strip out type declaration</p>
<p dir="auto"><strong>Additional context/</strong><br>
Why don't I just use the usual <code class="notranslate">import type { MyType } from '...'</code>  you ask...<br>
My form is accepted by flow &amp; intelliSence in VS Code, giving tooltip info on the types, whereas the usual form is accepted, but does not show any type information...</p>
<p dir="auto"><code class="notranslate">import { type </code> is accepted fine by flow...</p>
<h3 dir="auto">Bug</h3>
<p dir="auto">Named type imports are stripped differently based on which syntax is used. <code class="notranslate">import { type X } from 'X'</code> results in <code class="notranslate">import 'X'</code>, while <code class="notranslate">import type { X } from 'X'</code> is stripped completely. As a result, the two statements are not equivalent.</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="import { type X } from 'X';
import type { Y } from 'Y';"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-s1">type</span> <span class="pl-v">X</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">'X'</span><span class="pl-kos">;</span>
<span class="pl-k">import</span> <span class="pl-s1">type</span> <span class="pl-kos">{</span> <span class="pl-v">Y</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">'Y'</span><span class="pl-kos">;</span></pre></div>
<h3 dir="auto">Babel Configuration (.babelrc, package.json, cli command)</h3>

<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;presets&quot; : [&quot;babel-preset-flow&quot;]
}"><pre class="notranslate"><span class="pl-kos">{</span>
  <span class="pl-s">"presets"</span> : <span class="pl-kos">[</span><span class="pl-s">"babel-preset-flow"</span><span class="pl-kos">]</span>
<span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Expected Behavior</h3>


<p dir="auto">At the minimum I expect both imports to be treated equally, i.e. either both are stripped or both result in an import. My intuition says that it should be the empty output, since I don't expect types to have runtime behaviour, but flow itself currently doesn't seem to have a stance on this (ref: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="259501453" data-permission-text="Title is private" data-url="https://github.com/facebook/flow/issues/4935" data-hovercard-type="issue" data-hovercard-url="/facebook/flow/issues/4935/hovercard" href="https://github.com/facebook/flow/issues/4935">facebook/flow#4935</a>).</p>
<h3 dir="auto">Current Behavior</h3>


<p dir="auto">Output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import 'X';
"><pre class="notranslate"><code class="notranslate">import 'X';

</code></pre></div>
<h3 dir="auto">Possible Solution</h3>


<p dir="auto">Strip <code class="notranslate">import { type X }</code> statements completely.</p>
<h3 dir="auto">Context</h3>


<p dir="auto">I ran into this issue while trying to resolve a circular dependency, where an <code class="notranslate">import { type X }</code> completed the circle (to my surprise). After a long debugging session I noticed that this circle got broken by just replacing <code class="notranslate">import { type X }</code> with <code class="notranslate">import type { X }</code>, something which isn't documented anywhere nor very intuitive.</p>
<p dir="auto">(The actual context for the circular dependency is quite complicated. If necessary I can still provide it on request)</p>
<h3 dir="auto">Your Environment</h3>

<table role="table">
<thead>
<tr>
<th>software</th>
<th>version(s)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Babel</td>
<td>v6.26.0</td>
</tr>
<tr>
<td>babel-preset-flow</td>
<td>v6.23.0</td>
</tr>
<tr>
<td>node</td>
<td>v8.4.0</td>
</tr>
<tr>
<td>npm</td>
<td>v5.3.0</td>
</tr>
<tr>
<td>Operating System</td>
<td>Linux (Fedora 25 64-bit)</td>
</tr>
</tbody>
</table>