<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Typescript on</title><link>https://codeinfocus.com/tags/typescript/</link><description>Recent content in Typescript on</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 06 Sep 2021 11:22:18 +0300</lastBuildDate><atom:link href="https://codeinfocus.com/tags/typescript/index.xml" rel="self" type="application/rss+xml"/><item><title>Circular Dependencies</title><link>https://codeinfocus.com/blog/2021-09/circular-dependencies/</link><pubDate>Mon, 06 Sep 2021 11:22:18 +0300</pubDate><guid>https://codeinfocus.com/blog/2021-09/circular-dependencies/</guid><description>&lt;p>&lt;em>Updated on January 3, 2023&lt;/em>&lt;/p>
&lt;h2 id="what-are-circular-dependencies">What are Circular Dependencies?&lt;/h2>
&lt;p>A circular dependency is when one of your modules imports another modules, which directly or via other modules imports the first module.&lt;/p>
&lt;p>&lt;em>Examples:&lt;/em>
Direct reference: &lt;code>A -&amp;gt; B -&amp;gt; A&lt;/code>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// a.js
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">import&lt;/span> { &lt;span style="color:#a6e22e">b&lt;/span> } &lt;span style="color:#a6e22e">from&lt;/span> &lt;span style="color:#e6db74">&amp;#39;./b.js&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// b.js
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">import&lt;/span> { &lt;span style="color:#a6e22e">a&lt;/span> } &lt;span style="color:#a6e22e">from&lt;/span> &lt;span style="color:#e6db74">&amp;#39;./a.js&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Indirect reference: &lt;code>A -&amp;gt; B -&amp;gt; C -&amp;gt; A&lt;/code>&lt;/p></description></item></channel></rss>