Hi. First of all thanks for a great library which react-hook-form is.
const StyledErrorMessage = styled(ErrorMessage)`
color: #f76479;
font-size: 10px;
`;
<StyledErrorMessage errors={errors} name="avatarUrl" as="span" />
No overload matches this call.
Overload 1 of 2, '(props: Pick<Pick<Assign<{ as?: "symbol" | "object" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | ... 160 more ... | undefined; errors?: DeepMap<...> | undefined; name: string; message?: string | undefined; render?: ((data: { ...; }) => ReactNode) | undefined; }, any>, string | ... 1 more ... | symbol> & Partial<...>, string | ... 1 more ... | symbol> & { ...; } & { ...; }): ReactElement<...>', gave the following error.
Type 'string' is not assignable to type 'undefined'.
Overload 2 of 2, '(props: StyledComponentPropsWithAs<"span", any, {}, never>): ReactElement<StyledComponentPropsWithAs<"span", any, {}, never>, string | ... 1 more ... | (new (props: any) => Component<...>)>', gave the following error.
Type '{ errors: DeepMap<Record<string, any>, FieldError>; name: string; as: "span"; }' is not assignable to type 'IntrinsicAttributes & Pick<Pick<Pick<DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "slot" | ... 253 more ... | "onTransitionEndCapture"> & { ...; }, "slot" | ... 254 more ... | "onTransitionEndCapture"> & Partial<...>, "slot" | ... 254 more ... | "onTransitionEndCapture"> & { ...; } & { ...; }'.
Property 'errors' does not exist on type 'IntrinsicAttributes & Pick<Pick<Pick<DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "slot" | ... 253 more ... | "onTransitionEndCapture"> & { ...; }, "slot" | ... 254 more ... | "onTransitionEndCapture"> & Partial<...>, "slot" | ... 254 more ... | "onTransitionEndCapture"> & { ...; } & { ...; }'. TS2769
52 | Avatar URL
53 | <Input name="avatarUrl" ref={register({ required: 'Avatar URL is required' })} />
> 54 | <StyledErrorMessage errors={errors} name="avatarUrl" as="span" />
| ^
55 | </Label>
56 | </FormControl>
57 | <FormControl>
const StyledErrorMessage = styled(ErrorMessage).attrs({ as: 'span' })`
color: #f76479;
font-size: 10px;
`;
To be honest I'm not sure it's really a bug. Just two libraries exposing similar api ๐
I thought you should know about as styled-components are pretty popular.