Skip to content

[angular] isPending type isn't typed as Signal #7401

Closed
@k3nsei

Description

@k3nsei

Describe the bug

When I want to use isPending from mutation I'm getting wrong type. It's returning calculated signal but type is wrongly resolved to boolean. It's also happening to some other properties but I'm using only isPending in my project also I don't remember what others were that weren't working correctly.

Your minimal, reproducible example

https://stackblitz.com/edit/stackblitz-starters-1t77xr?file=src%2Fmain.ts

Steps to reproduce

import { Injectable, Signal } from "@angular/core";
import { injectMutation } from "@tanstack/angular-query-experimental";

@Injectable()
export class Service {
  protected readonly mutation = injectMutation(() => ({
    mutationFn: () => Promise.resolve({}),
  }));

  // TypeScript Error: `boolean` is not assignable to type `Signal<boolean>`
  public readonly isProcessing: Signal<boolean> = this.mutation.isPending;
}

Expected behavior

isPending should be resolved to type Signal<boolean>

How often does this bug happen?

Every time

Screenshots or Videos

image

Platform

  • OS: Windows
  • Browser: not important
  • Version: not important

Tanstack Query adapter

angular-query

TanStack Query version

v5.35.3

TypeScript version

v5.4.5

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions