Skip to content
This repository has been archived by the owner on Jul 2, 2022. It is now read-only.

Failed to compile #112

Closed
TylerJKing opened this issue Apr 14, 2019 · 2 comments
Closed

Failed to compile #112

TylerJKing opened this issue Apr 14, 2019 · 2 comments

Comments

@TylerJKing
Copy link

When running 'yarn start' for this portion of the project, it gives "Starting the development server". After a while, it says "Compiling" before failing with the following error:

Failed to compile.

/home/tking/work/src/github.com/TylerJKing/react-social-network/src/components/post/PostComponent.tsx
(415,50): Argument of type '(match: string, i: string) => Element' is not assignable to parameter of type '(match: string, index: number) => string | Element'.
Types of parameters 'i' and 'index' are incompatible.
Type 'number' is not assignable to type 'string'.


Below is what I have on line 415 in the postcomponent.tsx file:

    <CardContent className={classes.postBody}>
      <Linkify properties={{ target: '_blank', style: { color: 'blue' } }}>
        {reactStringReplace(body, /#(\w+)/g, (match: string, i: string) => (
          <NavLink
            style={{ color: 'green' }}
            key={match + i}
            to={`/tag/${match}`}
            onClick={evt => {
              evt.preventDefault()
              goTo!(`/tag/${match}`)
              setHomeTitle!(`#${match}`)
            }}
          >

Thanks!

@Qolzam
Copy link
Member

Qolzam commented Apr 15, 2019

Could you run the project by npm. Following below command to reinstall node modules too :

rm -rf node_modules && npm i && npm start

@TylerJKing
Copy link
Author

Thanks, works now!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants