title: Getting error: Type 'typeof B' is not assignable to type 'typeof A' for class B that extends A
body: <p>Reproducible example <a href="https://cutt.ly/fkFIjaP" rel="nofollow noreferrer">here</a></p>
  <p>My need is: the <code>contentType</code> parameter should accept any class object extended from Content (PublicContent, AdminContent, PrivateContent, etc) and I want to call a static method from this parameter type inside the <code>execute</code> method.</p>
  <p>I have a method with the following signature:</p>
  <pre><code>async execute&lt;U extends ContentProps&gt;(input: {
      contentType: typeof Content;
      contentPropsType: typeof ContentProps; 
  }): Promise&lt;Result&lt;U, Failure&gt;&gt;;
  </code></pre>
  <p>and a class hierarchy as follows:</p>
  <pre><code>// content.entity.ts
  
  export class ContentProps extends EntityProps {}
  
  export class Content&lt;T extends ContentProps&gt; extends Entity&lt;T&gt; {
    public constructor(props: T) {
      super(props);
    }
  }
  
  // public-content.entity.ts
  export class PublicContentProps extends ContentProps {
    readonly title: string;
    readonly text: string;
  }
  
  export class PublicContent extends Content&lt;PublicContentProps&gt; {
    constructor(props: PublicContentProps) {
      super(props);
    }
    // ommited
  }
  </code></pre>
  <p>The issue is that when I call the <code>execute</code> method passing <code>PublicContent</code> as the <code>contentType</code> parameter I'm getting an error saying</p>
  <blockquote>
  <p>Type 'typeof PublicContent' is not assignable to type 'typeof Content'</p>
  </blockquote>
  <p>The method call is:</p>
  <pre><code>const result = await this.getContent.execute({
    contentType: PublicContent,
    contentPropsType: PublicContentProps,
  });
  </code></pre>
  <p>My question is: Why I'm getting this error since <code>PublicContent</code> is extending <code>Content</code>?</p>
  <p><strong>EDIT:</strong> as requested by @Chase, the full types for <code>Entity</code> and <code>EntityProps</code>:</p>
  <pre><code>// entity.ts
  export abstract class EntityProps extends BaseEntityProps {
    id?: string;
    createdAt?: Date;
    updatedAt?: Date;
  }
  
  export abstract class Entity&lt;T extends EntityProps&gt; extends BaseEntity&lt;T&gt; {
    get id(): string {
      return this.props.id;
    }
  
    get createdAt(): Date {
      return this.props.createdAt;
    }
  
    get updatedAt(): Date {
      return this.props.updatedAt;
    }
  
    protected constructor(entityProps: T) {
      super(entityProps);
    }
  }
  
  
  // base.entity.ts
  export abstract class BaseEntityProps {}
  
  export abstract class BaseEntity&lt;T extends BaseEntityProps&gt; extends Equatable {
    protected readonly props: T;
  
    protected constructor(baseEntityProps: T) {
      super();
      this.props = baseEntityProps;
    }
  
    static create&lt;T = BaseEntity&lt;BaseEntityProps&gt;, U = BaseEntityProps&gt;(
      this: {
        new (entityProps: U): T;
      },
      propsType: { new (): U },
      props: U,
    ): Result&lt;T, ValidationFailure&gt; {
      const violations = validateSchemaSync(propsType, props);
  
      return violations?.length
        ? Result.fail(new ValidationFailure(violations))
        : Result.ok(new this({ ...props }));
    }
  
    toJSON(): T {
      return this.props;
    }
  }
  </code></pre>