Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
La propiedad 'cursor' no existe en el tipo X, nulo o indefinido, usando el tipo graphql generado con Svelte #each

Estaba usando SvelteKit sin el sorprendente "strict": true en tsconfig.json hasta hoy.

Tengo este código generado (con codegen ) a partir de un esquema de Graphql que no puedo cambiar:

 export type PlayerListQuery = { __typename?: "Query"; playerList: { __typename?: "PlayerConnection"; edges?: Array<{ __typename?: "PlayerEdge"; cursor: any; node?: { __typename?: "Player"; name?: string | null; age?: number | null; id: string; } | null; } | null> | null; pageInfo: { __typename?: "PageInfo"; hasNextPage: boolean; hasPreviousPage: boolean; startCursor?: any | null; endCursor?: any | null; }; }; };

que viene de esto:

 type PlayerConnection { totalCount: Int! pageInfo: PageInfo! edges: [PlayerEdge] } type PlayerEdge { cursor: Cursor! node: Player }

y lo estoy usando así en Svelte:

 {#each $store.data.playerList.edges || [] as { cursor, node } (cursor)} {node?.name || "No name"} <br> {node?.age || "No age"} {:else} Empty array! {/each}

Ahora con la opción strict el error es:

 (parameter) cursor: any Property 'cursor' does not exist on type '{ __typename?: "PlayerEdge" | undefined; cursor: any; node?: { __typename?: "Player" | undefined; name?: string | null | undefined; ... more ...; | undefined; } | null | undefined; } | null'.ts(2339)

tanto para el cursor como para node porque es correcto, pueden ser null o undefined .

¿Qué sugieres para arreglar esto?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!