<p dir="auto">Test.ts:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="declare module &quot;test&quot; {
    module A {
        class C {
        }
    }
    class B extends E {
    }
    import E = A.C;
}"><pre class="notranslate"><code class="notranslate">declare module "test" {
    module A {
        class C {
        }
    }
    class B extends E {
    }
    import E = A.C;
}
</code></pre></div>
<p dir="auto">Command line:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="node tsc Test.ts --declaration --module commonjs --target ES5"><pre class="notranslate"><code class="notranslate">node tsc Test.ts --declaration --module commonjs --target ES5
</code></pre></div>
<p dir="auto">Error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TypeError: Cannot read property 'indent' of undefined
    at /Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:7839:63
    at Object.forEach (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:1794:30)
    at writeAsychronousImportDeclarations (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:7836:20)
    at Object.writeSymbol (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:7852:25)
    at writeType (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:9323:28)
    at writeTypeToTextWriter (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:9314:20)
    at Object.writeTypeAtLocation (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:14383:13)
    at emitTypeOfTypeReference (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:8081:30)
    at emitCommaList (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:7880:21)
    at emitHeritageClause (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:8077:21)"><pre class="notranslate"><code class="notranslate">TypeError: Cannot read property 'indent' of undefined
    at /Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:7839:63
    at Object.forEach (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:1794:30)
    at writeAsychronousImportDeclarations (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:7836:20)
    at Object.writeSymbol (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:7852:25)
    at writeType (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:9323:28)
    at writeTypeToTextWriter (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:9314:20)
    at Object.writeTypeAtLocation (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:14383:13)
    at emitTypeOfTypeReference (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:8081:30)
    at emitCommaList (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:7880:21)
    at emitHeritageClause (/Users/meir/Source/TypeScript-1.1/TypeScript/bin/tsc.js:8077:21)
</code></pre></div>
<p dir="auto">The following used to work in TS 1.0.3, but crashes the compiler in 1.1 (and current master).</p>
<p dir="auto">test.ts:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export function bar(a: foo.Foo) { }
import foo = require(&quot;foo&quot;);"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-k">function</span> <span class="pl-en">bar</span><span class="pl-kos">(</span><span class="pl-s1">a</span>: <span class="pl-s1">foo</span><span class="pl-kos">.</span><span class="pl-smi">Foo</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> <span class="pl-kos">}</span>
<span class="pl-k">import</span> <span class="pl-s1">foo</span> <span class="pl-c1">=</span> require<span class="pl-kos">(</span><span class="pl-s">"foo"</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">foo.ts:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export class Foo { }"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-k">class</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span> <span class="pl-kos">}</span></pre></div>
<p dir="auto">Using the latest master (<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/microsoft/TypeScript/commit/30a49db96e15bc7c768e6797d2863ad8eb4667ac/hovercard" href="https://github.com/microsoft/TypeScript/commit/30a49db96e15bc7c768e6797d2863ad8eb4667ac"><tt>30a49db</tt></a>):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ node ../TypeScript/built/local/tsc.js -m commonjs -d test.ts

c:\Source\TypeScript\built\local\tsc.js:8255
                    for (var declarationIndent = aliasEmitInfo.indent; declara
                                                              ^
TypeError: Cannot read property 'indent' of undefined
    at c:\Source\TypeScript\built\local\tsc.js:8255:63
    at Object.forEach (c:\Source\TypeScript\built\local\tsc.js:1873:30)
    at writeAsychronousImportDeclarations (c:\Source\TypeScript\built\local\tsc.js:8252:20)
    at Object.trackSymbol (c:\Source\TypeScript\built\local\tsc.js:8267:25)
    at buildSymbolDisplay (c:\Source\TypeScript\built\local\tsc.js:9786:24)
    at writeType (c:\Source\TypeScript\built\local\tsc.js:9826:25)
    at Object.buildTypeDisplay (c:\Source\TypeScript\built\local\tsc.js:9817:24)
    at Object.writeTypeAtLocation (c:\Source\TypeScript\built\local\tsc.js:15679:39)
    at emitParameterDeclaration (c:\Source\TypeScript\built\local\tsc.js:8779:30)
    at emitCommaList (c:\Source\TypeScript\built\local\tsc.js:8295:21)"><pre class="notranslate"><code class="notranslate">$ node ../TypeScript/built/local/tsc.js -m commonjs -d test.ts

c:\Source\TypeScript\built\local\tsc.js:8255
                    for (var declarationIndent = aliasEmitInfo.indent; declara
                                                              ^
TypeError: Cannot read property 'indent' of undefined
    at c:\Source\TypeScript\built\local\tsc.js:8255:63
    at Object.forEach (c:\Source\TypeScript\built\local\tsc.js:1873:30)
    at writeAsychronousImportDeclarations (c:\Source\TypeScript\built\local\tsc.js:8252:20)
    at Object.trackSymbol (c:\Source\TypeScript\built\local\tsc.js:8267:25)
    at buildSymbolDisplay (c:\Source\TypeScript\built\local\tsc.js:9786:24)
    at writeType (c:\Source\TypeScript\built\local\tsc.js:9826:25)
    at Object.buildTypeDisplay (c:\Source\TypeScript\built\local\tsc.js:9817:24)
    at Object.writeTypeAtLocation (c:\Source\TypeScript\built\local\tsc.js:15679:39)
    at emitParameterDeclaration (c:\Source\TypeScript\built\local\tsc.js:8779:30)
    at emitCommaList (c:\Source\TypeScript\built\local\tsc.js:8295:21)
</code></pre></div>
<p dir="auto">The same crash occurs when using 1.1.0-1 from npm.<br>
When removing the <code class="notranslate">-d</code> or using the 1.0.3 compiler from VS, it works fine.</p>
<p dir="auto">Admittedly, it's more logical to have the import before the function, but a construct like this happened to be present in our sources.</p>