Skip to content

expectError strict behaviour #40

@SamVerschueren

Description

@SamVerschueren

I need feedback on the behaviour of the expectError assertion.

The expectType assertion is strict. Which means that expectType<string | number>(concat('a', 'b')) will fail because string | number is defined too wide. See the docs.

I didn't change anything for expectError as I wasn't sure on the exact behaviour.

@cartant asked if it would behave like this (see ReactiveX/rxjs#4871 (comment)).

expectError<string | number>(add(1, 2));
//=> no error

The reason behind it could be that because the type is too wide, the assertion is an error and that's what you expect.

I also discussed this with @sindresorhus and he indicated that maybe we should hard fail on that assertion.

I definitely could use feedback on this topic here :).

// @BendingBender

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededquestionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions