Skip to content

Arg.is predicate type should match specified generic type #106

Description

@psxvoid

Is there a reason why Arg.is<MyType> is any inside the callback? It feels like we are missing a hand from typescript here - it can verify strongly typed arguments and give a compile-time error. With any argument type typescript is useless and we won't receive a compile-time error, for example on misspelled property.

Here is how type definition looks like right now:

static is<T>(predicate: (input: any) => boolean): Argument<T> & T;

and here is how it "should" look like (possibly):

static is<T>(predicate: (input: T) => boolean): Argument<T> & T;

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