Explain "export =" and "export as namespace" syntax in TypeScript : <p>I am trying to make use of the type declarations files in the <a href="https://github.com/DefinitelyTyped/DefinitelyTyped" rel="noreferrer">DefinitelyTyped</a> repository. Many of these files use the following pattern:</p>

<pre><code>export = React;
export as namespace React;
</code></pre>

<p>Googling around, I've found references to this being used to make a declaration file usable in both module-based and non-module-based systems. However, I'm struggling to find a clear explanation of (a) what each of these lines exactly does individually and (b) how exactly this combination works to support both types of consumers.</p>
