Type error when casting link-like items
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- react, tailwindcss, typescript
- Ambito
- frontend
Direzione di ricerca
Parti dalle definizioni delle prop di SidebarItem e NavbarItem, in particolare dalla sostituzione di ThemingProps mostrata nell’issue, e confrontale con l’esempio di Link personalizzato. Esegui i controlli TypeScript del progetto con un componente simile a un link; il lavoro è completato quando le prop del componente base, come to, vengono accettate senza errori di tipo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
- I have searched the Issues to see if this bug has already been reported
- I have tested the latest version
Steps to reproduce
Create an element like a SidebarItem or NavbarItem and override the base element. For example, Remix/React Router has a custom Link element that enables client-side routing:
<SidebarItem
as={Link}
to="/settings"
>
Settings
</SidebarItem>
Current behavior
While the code itself works, typescript gives an error like the following:
TS2322: Type '{ children: string; as: ForwardRefExoticComponent<LinkProps & RefAttributes<HTMLAnchorElement>>; to: string; icon: ForwardRefExoticComponent<...>; className: string; }' is not assignable to type 'IntrinsicAttributes & SidebarItemProps & RefAttributes<Element>'.
Property 'to' does not exist on type 'IntrinsicAttributes & SidebarItemProps & RefAttributes<Element>'.
Expected behavior
Typescript should allow passing the base components' props without an error.
Context
Typechecking only.
Note, these components' proptypes previously extended Record<string, unknown>, but that was replaced with ThemeingProps<ComponentTheme>.
For example:
export interface SidebarItemProps extends Omit<ComponentProps<"div">, "ref">,
Record<string, unknown> {}
but this has now been replaced with:
export interface SidebarItemProps extends Omit<ComponentProps<"div">, "ref">, ThemingProps<SidebarItemTheme> { };
- Lingua principale
- TypeScript
- Stelle
- 2.2k
- Fork
- 504
- Merge medio
- 19h 16m
- PR unite (30g)
- 2
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di themesberg/flowbite-react
-
fix(Carousel): can't give dynamic children to CarouselForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta:bug: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
themesberg/flowbite-react#1469 · 1 commento ·
-
Pagination is broken if there is only one pageForse già presa @Mukilan1600 l’ha presa 1022 giorni fa. Aperta:bug: bug confirmed good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
themesberg/flowbite-react#1048 · 7 commenti · 1 reazione ·
-
:books: documentation help wanted
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
themesberg/flowbite-react#1696 · 2 commenti ·
-
Add a QRCode componentAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
themesberg/flowbite-react#1693 ·
-
NavbarCollapse closes when toggling a MegaMenuDropdown on mobileForse di nuovo libera @sarthak-11231 l’ha presa 46 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
themesberg/flowbite-react#1686 · 2 commenti ·
Tutte le issue di themesberg/flowbite-react
Issue simili
-
documentation good first issue roadmap
Difficoltà 1/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
resend/react-email#3876 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
siyuan-note/siyuan#21324 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
dmno-dev/varlock#1279 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
himynameisdave/bsky-profanity-counter#59 ·
I maintainer di solito rispondono entro 1 giorno