Skip to content

bug(withResource and Mutations): hasValue() does not narrow the respective value signal #235

@michael-small

Description

@michael-small

Regular resources have hasValue to narrow undefined out of the value

const value = someResource.value(); // string | undefined

if (someResource.hasValue()) {
    const valueNarrowed = someResource.value(); // string
}

withResource and the Mutations (httpMutation and rxMutation) both have a hasValue(), but upon doing some work recently, we noticed that the type narrowing does not work.

Until fix: use usual narrowing strategies that invoke the signal before trying to conditionally use them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions