Skip to content

InstanceOf narrowing #314

@Njiallu

Description

@Njiallu

Is your feature request related to a problem? Please describe.
I'm having issues handling specific errors cases. For example:

const err = new Error() // Imagine this could be an AxiosError

match(err)
  .with(P.instanceOf(AxiosError).and({ response: { status: 404 } }), () => ...)
  ...

This would result in an error on response since the chaining only resolves the Error type and response doesn't exist.

Describe the solution you'd like
For the chaining to work when narrowing(/widening ?) with P.instanceOf

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions