Skip to content

[expect-type] expectTypeOf(this).to{Equal,Match}TypeOf(this) fails #4

@NullVoxPopuli

Description

@NullVoxPopuli

Here is a TS Playground link and related StackOverflow post

And the sample code:

export class B {
  b = "b";
  
  get foo() {
    expectTypeOf(this).toEqualTypeOf(this); // errors
    expectTypeOf(this).toMatchTypeOf(this); // errors
  }
}

Hovering over the toEqualTypeOf call provides this information:

(property) ExpectTypeOf<this, true>.toEqualTypeOf: <unknown>(...MISMATCH: MismatchArgs<And<[Extends<DeepBrand<this>, {
    type: "special";
    never: false;
    any: false;
    unknown: true;
}>, {
    type: "special";
    never: false;
    any: false;
    unknown: true;
} extends DeepBrand<...> ? true : false]>, true>) => true (+1 overload)

--- 

No overload matches this call.
  Argument of type '[this]' is not assignable to parameter of type 
    'MismatchArgs<
      And<
        [
          Extends<
            DeepBrand<this>, 
            { 
              type: "special"; 
              never: false; 
              any: false; 
              unknown: true; 
            }
          >, 
          { 
            type: "special"; 
            never: false; 
            any: false; 
            unknown: true; 
          } extends DeepBrand<...> 
            ? true 
            : false
        ]
      >, 
      true
    >'.
  
Argument of type '[]' is not assignable to parameter of type   
  'MismatchArgs<
    And<
      [
        Extends<DeepBrand<this>, DeepBrand<this>>, 
        Extends<DeepBrand<this>, DeepBrand<this>>
      ]
    >, 
    true
  >'.(2769)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions