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.
0
  • Najlepsze
  • Wszystkie komentarze
laki1
@hans001: 200zl/h
6
doee
@hans001: Spróbuj React.ComponentPropsWithoutRef np. interface Props extends React.ComponentPropsWithoutRef<"input"> { ... }
https://codesandbox.io/s/angry-ganguly-1o8ll
2
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
1
hans001
@doee: działa pięknie <3 dzięki wielkie
1
hans001
@laki1: wow
0
sokytsinolop
@hans001: jest
0
Pesio
@hans001: pisz tu, to zostanie dla potomnych
0
hans001
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
0
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ś
0
hans001
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;
0