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

Bug: Problem with deep filtering of the fields #12

Open
marekbrze opened this issue Dec 2, 2024 · 0 comments
Open

Bug: Problem with deep filtering of the fields #12

marekbrze opened this issue Dec 2, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@marekbrze
Copy link

marekbrze commented Dec 2, 2024

Description of the bug

When trying to deep filter translation fields I get this type error:

Type '{ _filter: { languages_code: { _eq: Locale; }; }; }' is not assignable to type '{ [x: string]: (... & { _sort?: string | string[] | undefined; _filter?: QueryFilter<CustomDirectusTypes, any> | undefined; _search?: string | undefined; _limit?: number | undefined; _offset?: number | undefined; _page?: number | undefined; }) | undefined; } & { ...; }'.

My code for filtering:

const devlogPosts = await directus.request(
  readItems("devlog", {
    fields: [
      "date_published",
      { translations: ["title", "languages_code", "slug"] },
    ],
    deep: {
      translations: {  <-- ERROR POPS HERE
        _filter: {
          languages_code: { _eq: locale },
        },
      },
    },
    sort: ["-date_published"],
  }),
);

Steps To Reproduce

  1. Try to use deep filter for languages (or probably for any related field)

Additional Information

Filtering works as intended when using the code above. I only have a problem with the type error.

@marekbrze marekbrze added the bug Something isn't working label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants