title: React-Hook-Form: Trying to use recursion in class model in React.js (TS)
body: <p>I'm trying to define a class model that contains itself in react:</p>
  <pre><code>  class CategoryModel {
      id: number;
      name: string;
      parentCategory: CategoryModel;
    }
  
  </code></pre>
  <p>This code works fine. however, when i try to build a form to add a new category i get an error in the register object:</p>
  <pre><code>
  Type of properType of property 'parentCategory' circularly references itself in mapped type '{ [K in keyof CategoryModel]-?: PathImpl&lt;K &amp; string, CategoryModel[K]&gt;; }'.  TS2615
  
      29 |
      30 |                 &lt;TextField
    &gt; 31 |                     {...register(&quot;name&quot;)}
         |                         ^
      32 |                     label=&quot;name&quot;
      33 |                     variant=&quot;standard&quot;
      34 |                     type=&quot;text&quot;
  </code></pre>
  <p>The error isn't part of the name; when i removed it the error simply appear on another part of the form. The problem disappear when i deleted the line &quot;parentCategory: CategoryModel;&quot;.</p>
  <p>thanks for any help!</p>