Skip to content

Inferred type references an inaccessible unique symbol type after updating from 5.61.5 to 5.62.0 #8833

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

Open
antoine-delahaye opened this issue Mar 19, 2025 · 3 comments

Comments

@antoine-delahaye
Copy link

antoine-delahaye commented Mar 19, 2025

Describe the bug

After updating TanStack from version 5.61.5 to 5.62.0 (not solved with 5.69.0), I encountered the following TypeScript error on every function that returns queryOptions or infiniteQueryOptions:

TS2527: The inferred type of 'queryPlan' references an inaccessible 'unique symbol' type. A type annotation is necessary.

Your minimal, reproducible example

https://www.typescriptlang.org/play/?ts=5.7.3#code/JYWwDg9gTgLgBAbwLACg5wI4FcCmUCeA8mDMBAHYDOANKusOQGYPAw4CKuBxpFlqAXziMoEEHADkAARgBDKnIDGAawD08gOZYANrKgBabHnz6cADzB5QOcnO0SA3KlSLdlSnACiZ2eG04AZTwAN2BFHEQ6ODAsACNtMMwuInIcAApzXzB-AEkAEwAuOHIsEFi8AEpItHQ4KBwYLChyJOMeMio05Bra1oIAaRx8IoBtCQkAXVoe2qMCADFyIrSKouCIYDy4AF4APkQBad70G1l4nEK4AEIrzL8cfKPagQqnFAFnFBj4xLn8AFl5PgVtVevVGs04AxmORWBxku0+F0or0-oNhnAxpMnqjkotlmBZBocAAFPS+VZwdabHb7BCHFG1FikWTaMnEslQXxFACMONqxJgJPqoQgWEo7NJ5JAyyqezgfMZ6EFADlzEKiVKuTK4CD5TzGS83h93kA

Steps to reproduce

Inside a Angular's service :

public queryOne(exampleId: number) {
    return queryOptions({
      queryKey: [this.getFetchPath(...)],
      queryFn: (): Promise<ExampleDTO[]> => this.getOne(...),
      enabled: !!exampleId,
    });
}

public queryMany(paramsData) {
    return infiniteQueryOptions({
      queryKey: [...],
      queryFn: (pageParam): Promise<ExampleDTO[]> => this.getMany(...),
      ...,
    });
}

Expected behavior

The code should compile without any TypeScript errors without any type annotation.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: Windows
  • Framework: Angular v19.2.2

Tanstack Query adapter

angular-query

TanStack Query version

v5.62.0

TypeScript version

v5.7.3

Additional context

I managed to get rid of this error by annotating queryOptions and function return type :

public queryMany(...): CreateQueryOptions<ExampleDTO[]> {
    return queryOptions<ExampleDTO[]>(...);
}

However, unable to annotate properly infiniteQueryOptions because I got another type error :

public queryManyWithPagination(...): CreateInfiniteQueryOptions<ExampleDTO[]> {
    return infiniteQueryOptions<ExampleDTO[]>(...);
  }

TS2322: Type CreateInfiniteQueryOptions<StopPointResponseDTO[], Error, InfiniteData<StopPointResponseDTO[], unknown>, StopPointResponseDTO[], readonly unknown[], unknown> & { ...; } & { ...; } is not assignable to type CreateInfiniteQueryOptions<StopPointResponseDTO[], Error, StopPointResponseDTO[], StopPointResponseDTO[], readonly unknown[], unknown>
@jeroenpg
Copy link

Doesn't seem to be an angular-query specific issue. Same issue occurs for @tanstack/solid-query

@arnoud-dv
Copy link
Collaborator

This may be the same problem as #8453 which isn't fully solved

@TkDodo FYI

@birkskyum birkskyum changed the title Angular: Inferred type references an inaccessible unique symbol type after updating from 5.61.5 to 5.62.0 Inferred type references an inaccessible unique symbol type after updating from 5.61.5 to 5.62.0 Mar 31, 2025
@arnoud-dv
Copy link
Collaborator

@antoine-delahaye Could you re-check your TypeScript playground reproduction if there's still any problem? I currently do not see a type error there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants