Skip to content

[expect-type] Clarification on toEqualType versus toMatchType #30

@papb

Description

@papb

Hello!

Thanks for the explanation in this comment. However, it is still not fully clear to me (probably because I'm not familiar with Jest's toMatchObject either).

Please confirm if my understanding is correct:

let a: A;
let b: B;

// Passes if and only if `A` is identical to `B`
expectTypeOf(a).toEqualTypeOf(b)

// Passes if and only if `A extends B`
// In other words, passes if and only if the assignment `b = a` is valid
expectTypeOf(a).toMatchTypeOf(b)

Is this correct?

Thanks!!

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