hans001
#frontend #programowanie #typescript #react

Jest na tagu jakiś mirek obeznany w typescript i react ? Mam parę błędów których nie potrafie ogarnąć a dopiero się ucze. Fajnie by było popisać na pw.
  • Najlepsze
  • Wszystkie komentarze
laki1
laki1
6
@hans001: 200zl/h
doee
doee
2
@hans001: Spróbuj React.ComponentPropsWithoutRef np. interface Props extends React.ComponentPropsWithoutRef<"input"> { ... }
https://codesandbox.io/s/angry-ganguly-1o8ll
t.....k
t.....k
@hans001 możesz wyexportować propsy komponentu do którego chcesz je przekazać i je rozszerzyć, albo wydobyć je przez inferencje: ComponentProps
hans001
hans001 Autor
1
@doee: działa pięknie <3 dzięki wielkie
hans001
hans001 Autor
0
@laki1: wow
sokytsinolop
@hans001: jest
Pesio
Pesio
0
@hans001: pisz tu, to zostanie dla potomnych
hans001
hans001 Autor
0
Mam coś takiego :

import React from 'react';
import { ReactComponent as SearchIcon } from '../../assets/images/icons/search-icon.svg';
import { StyledContainer, StyledInput } from './TextInput.style';

interface
t.....k
t.....k
@hans001 albo wklej błąd, też może pomóc, bo może być tak że propsy nie są złego typu tylko jest ich zbyt dużo czy coś
hans001
hans001 Autor
0
Dobra wkleje cały błąd XD

No overload matches this call.
Overload 1 of 2, '(props: Pick, HTMLInputElement>, "form" | ... 284 more ... | "key"> & { ...; } & HTMLProps<...>, "form" | ... 359 more ... | "key"> & Partial<...>, "form" | ... 359 more ... | "key"> & { ...; } & { ...; }): ReactElement<...>', gave the following error.
Type '{ accept?: string; acceptCharset?: string; action?: string; allowFullScreen?: boolean;