nuxt-modules / nuxt-modules/strapi

Problem - Populate with field selection

Open
#259 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
717
Forks
89
Avg merge
7h 3m
Merged PRs (30d)
6

Description

Populate with field selection

@nuxtjs/strapi: 1.3.2
nuxt: 3.0.0-rc.4

https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/populating-fields.html#combining-population-with-other-operators
image

but typescript strapi-module is: populate?: string | Array

export interface Strapi4RequestParams {
  fields?: Array<string>
  populate?: string | Array<string>
  sort?: string | Array<string>
  pagination?: PaginationByOffset | PaginationByPage
  filters?: Record<string, unknown>
  publicationState?: 'live' | 'preview'
  locale?: StrapiLocale
}

populate: {namePopulate: {fields: [''populateFiled']}} -> it's working but typescript shouts at me.

  • please fix it but or how to do it differently(better) ?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Strapi4RequestParams interface shown in the issue and compare its populate type with Strapi's documented nested population syntax. Update the typing so the demonstrated field-selection shape is accepted, then verify the example with TypeScript type-checking; done means valid nested populate options no longer produce an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, typescript
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.