Skip to content

Fix input parameter type for notEquals/notDeepEquals  #71

Open
@soulofmischief

Description

@soulofmischief

Currently, notEquals/notDeepEquals expect type T for the input parameter. They should actually expect anything except for T, and thus throw a TypeScript error when used correctly in a TypeScript environment.

The simple solution is just to do a generic like such:

notEquals<U>(value: U): AssertionDescriber;
notDeepEquals<U>(value: U): AssertionDescriber;

We can also explicitly exclude T somehow like such:

soulofmischief/DefinitelyTyped@d0268d6

but this technique would be overly restrictive for notEquals and I'm unsure how to make it less restrictive without built-in language support. It would additionally require extra boilerplate to handle primitive types, which it currently fails on.

If #47 moves forward then notDeepEquals doesn't need special handling anyway and the simple generic solution proposed above might be the most straightforward fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions