我不確定為什么它在這里抱怨TBH,這個錯誤讓我感到困惑。createLinkSetsForCountryfunction createLinkSetsForCountry(country: Country, companies: Array<Company>) { let companyLinks: Array<LinkItem> = []; const companyLinkSets = []; for (const company of companies) { companyLinks.push(<LinkItem company={company} key={company.id} />); companyLinkSets.push( <LinkSet className="ft-link-set" country={country} key={company.id} links={companyLinks} /> ); companyLinks = []; } return ( <div> <ListHeader country={country} /> <div>{companyLinkSets}</div> </div> );}鏈接項(xiàng)export class LinkItem extends Component<{ company: Company, key: number }> { render() { const { company } = this.props, hasApp = (company.interview && company.interview.app && company.interview.app.hasAppp), uri = company.notInterviewed ? `companies/${company.id}/details` : `/interviews/companies/${company.id}`, className = `margin-top-10 margin-bottom-10 ${ company.notInterviewed ? 'ft-company-not-interviewed' : '' }`; const link = ( <Link className={className} id={company.id.toString()} to={uri}> <span id="company-name">{company.name}</span> </Link> );
React Component 上的 Typescript 錯誤:
臨摹微笑
2022-12-22 14:38:58