Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
NullVoxPopuli opened this issue Sep 5, 2022 · 1 comment · Fixed by #16
Closed

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

NullVoxPopuli opened this issue Sep 5, 2022 · 1 comment · Fixed by #16

Comments

@NullVoxPopuli
Copy link

NullVoxPopuli commented Sep 5, 2022

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)
@NullVoxPopuli NullVoxPopuli changed the title [expectexpectTypeOf(this).to{Equal,Match}TypeOf(this) fails [expect-type] expectTypeOf(this).to{Equal,Match}TypeOf(this) fails Sep 5, 2022
@mmkal mmkal transferred this issue from mmkal/ts Sep 25, 2022
@mmkal
Copy link
Owner

mmkal commented Oct 1, 2023

@NullVoxPopuli thanks for this report. I'm not sure why this would be but I doubt it'll be possible to resolve. #16 will add some docs covering this.

mmkal added a commit that referenced this issue Oct 1, 2023
@mmkal mmkal mentioned this issue Oct 1, 2023
2 tasks
@mmkal mmkal closed this as completed in #16 Oct 3, 2023
@mmkal mmkal closed this as completed in fd718dd Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants