yarn build "Cannot find name" error for typescript

50 views Asked by At

I have the following .tsx component:

const Header = ({ dict: map, lang: string }) => {
  return (
    <header className="flex items-center justify-between py-10">
      <div>
        <Link href={`/${lang}`} aria-label={siteMetadata.headerTitle}>
          <div className="flex items-center justify-between">
          ...

yarn build is giving the following error when linting: Type error: Cannot find name 'lang' referring to the href in the Link component. Why is this the case, when I have already passed in lang in the prop to the component?

1

There are 1 answers

2
Bob On

Is your define error?

const Header = ({ dict: map, lang: string }) => {

I think it should be

const Header = ({dict, lang}: { dict: Map, lang: string }) => {