DEV Community

Discussion on: How to setup GatsbyJS starter with Typescript, ESLint, Prettier

 
wbali profile image
Balázs • Edited

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>
</>
)