'(typescript) facing problem trying to pass font-awsome icon as object to child component

Error: Type 'object' is not assignable to type 'IconProp'. Type 'object' is not assignable to type '[IconPrefix, IconName]'.ts(2322) index.d.ts(25, 3): The expected type comes from property 'icon' which is declared here on type 'IntrinsicAttributes & FontAwesomeIconProps'

interface Props {
  img: object;
}

Parent Component:

import { faBriefcaseMedical } from "@fortawesome/free-solid-svg-icons";
<MissionCards img={faBriefcaseMedical} />

Child Component:

import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
<FontAwesomeIcon icon={Props.img} />


Solution 1:[1]

I think you can import that type like so

import { IconProp } from '@fortawesome/fontawesome-svg-core';
interface Props {
   img: IconProp;
}

source

Solution 2:[2]

You can simply sort it out as follows:

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { IconProp } from '@fortawesome/fontawesome-svg-core'
import { faSearch } from '@fortawesome/free-solid-svg-icons'

<FontAwesomeIcon icon={faSearch as IconProp} />

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Oussama Bouchareb
Solution 2 Tshepo Shere