Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
k3nsei opened this issue May 9, 2024 · 0 comments
Open

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

k3nsei opened this issue May 9, 2024 · 0 comments

Comments

@k3nsei
Copy link

k3nsei commented May 9, 2024

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

@k3nsei k3nsei changed the title isPending type isn't boxed as Signal [angular] isPending type isn't boxed as Signal May 16, 2024
@k3nsei k3nsei changed the title [angular] isPending type isn't boxed as Signal [angular] isPending type isn't typed as Signal May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant