Search code examples
reactjstypescriptelectronprimereactocticons

Usage of GitHub Primer React Components with Octions


From the next example (provided by the documentation):

<TextInput ml={4} icon={Search} aria-label="Zipcode" name="zipcode" placeholder="Find user" autoComplete="postal-code" />

I get this error:

Type 'FunctionComponent<{}> & { size: [16, 16]; }' is missing the following properties from type 'ReactElement ReactElement Component)>) | (new (props: any) => Component)>': type, props, key

I'm developing a ElectronJS, React, Typescript application, and I would like to add the icon/octicon to the TextInput (is where the error comes from).

Any idea about how to solve this error? I didn't find any solution.

Thanks in advance.


Solution

  • Seems a bug that will be fixed in the next minor release: https://github.com/primer/components/pull/808

    Workaround until release:

    <TextInput icon={Search as any} />