Sorry, yes. The TypeScript way is to set a type (or any) for your props like so: type DataProps = { siteTitle: string } const SomeComponent: React.FC<DataProps> = ({ siteTitle } => { ... }
Edit: For pages you should also use Gatsby's PageProps: const SomePage: React.FC<PageProps<DataProps>> = ({ data, path }) => (
<>
<h1>{data.siteTitle}</h1>
<span>current page path {path}</span>
</>
)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Add
"noImplicitAny": false
to your tsconfig file, insidecompilerOptions
.This would just disable the notification, not fix the actual problem. Is this correct?
Sorry, yes. The TypeScript way is to set a type (or
any
) for your props like so:type DataProps = { siteTitle: string }
const SomeComponent: React.FC<DataProps> = ({ siteTitle } => { ... }
Edit: For pages you should also use Gatsby's
PageProps
:const SomePage: React.FC<PageProps<DataProps>> = ({ data, path }) => (
<>
<h1>{data.siteTitle}</h1>
<span>current page path {path}</span>
</>
)