Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

RightPanel/RelatedDesigns: patternsPerUser type is stricter than the getPatterns response it is filled from

Aperta
#1,873 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

Start with the PatternsPerUser interface and the patternsPerUser prop in the RightPanel and RelatedDesigns components, then check CustomCatalogCard and the onSuggestedPatternClick argument type. Compare them with GetPatternsApiResponse from @meshery/schemas 1.3.44. Done when patternsPerUser is optional, typed from the canonical response, and a host passing the getPatterns data type-checks without casts.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

What is wrong

RightPanel and RelatedDesigns declare patternsPerUser as required and typed { patterns: Pattern[] }:

interface PatternsPerUser {
  patterns: Pattern[];
}

Hosts fill this prop from the canonical getPatterns operation in @meshery/schemas. Its response (GetPatternsApiResponse) has patterns optional, and its items do not guarantee every field Pattern requires (avatarUrl, user, and the metric counts). So a host that passes the operation's data straight through gets a type error. This happens even against the @meshery/schemas 1.3.44 that Sistent itself depends on:

Type 'GetPatternsApiResponse | undefined' is not assignable to type 'PatternsPerUser'.

The component already treats the data as optional at runtime. RelatedDesigns reads patternsPerUser?.patterns?.filter((pattern) => pattern.id !== details.id) || [], and uses only id plus fields the card already treats as optional. The declared type is stricter than the code, so the only ways a host can satisfy it are inventing values or casting.

Proposed change

  • Make patternsPerUser optional on RightPanelProps and RelatedDesignsProps.
  • Type it from the canonical response, for example Pick<GetPatternsApiResponse, 'patterns'>, rather than requiring Pattern[].
  • Narrow onSuggestedPatternClick's argument and CustomCatalogCard's pattern to the fields they actually read.

Context

This surfaced when layer5labs/meshery-extensions moved to @sistent/sistent 0.23.0. Sistent 0.22.6's type declarations did not export RightPanel at all, so this mismatch was hidden behind a missing-export error. Kanvas records the one remaining error in its typecheck baseline, linked to this issue, until a Sistent release fixes the type.

Lingua principale
TypeScript
Stelle
140
Fork
243
Merge medio
6g 23h
PR unite (30g)
13

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di layer5io/sistent

Tutte le issue di layer5io/sistent

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.