Skip to content

[expect-type] this param ignored in .toEqualTypeOf #7

@papb

Description

@papb

Repro:

import { expectTypeOf } from 'expect-type'

type NoThisParam = (a: number) => void
type DateThisParam = (this: Date, a: number) => void
type UndefinedThisParam = (this: undefined, a: number) => void
type UnknownThisParam = (this: unknown, a: number) => void
type AnyThisParam = (this: any, a: number) => void

// `NoThisParam` and `UnknownThisParam` are the only ones that should be considered equivalent.

expectTypeOf<NoThisParam>().toEqualTypeOf<NoThisParam>();
expectTypeOf<NoThisParam>().not.toEqualTypeOf<DateThisParam>(); // Fails!
expectTypeOf<NoThisParam>().not.toEqualTypeOf<UndefinedThisParam>(); // Fails!
expectTypeOf<NoThisParam>().toEqualTypeOf<UnknownThisParam>();
expectTypeOf<NoThisParam>().not.toEqualTypeOf<AnyThisParam>(); // Fails!

Playground

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