{"id":607,"hash":"442c8d7540f97a249d87dc2fe1b456a1f9f23b014ccc29c8f7a30fb4dd0b00b3","pattern":"Line 0: Parsing error: Cannot read property &#39;map&#39; of undefined","full_message":"I am currently starting up the server on my client side, the error above is what I have been\ngetting. I am using TypeScript, ReactJS, ESLint. I can't seem to go forward since this error\nhas been haunting me. The GitHub page for ESLint hasn't been of much help either.\n\nThis error went up after I had created the useMutation component and exported it in index.ts.\nNot sure how to get rid of this error.\n\nBelow is my package.json\n\n    {\n    \"name\": \"tinyhouse_client\",\n    \"version\": \"0.1.0\",\n    \"private\": true,\n      \"dependencies\": {\n      \"@testing-library/jest-dom\": \"^4.2.4\",\n      \"@testing-library/react\": \"^9.3.2\",\n      \"@testing-library/user-event\": \"^7.1.2\",\n      \"@types/jest\": \"^24.0.0\",\n      \"@types/node\": \"^12.0.0\",\n      \"@types/react\": \"^16.9.35\",\n      \"@types/react-dom\": \"^16.9.0\",\n      \"@typescript-eslint/parser\": \"^3.0.2\",\n      \"react\": \"^16.13.1\",\n      \"react-dom\": \"^16.13.1\",\n      \"react-scripts\": \"3.4.1\",\n      \"typescript\": \"~2.23.0\"\n      },\n      \"resolutions\": {\n     \"@typescript-eslint/eslint-plugin\": \"^2.23.0\",\n     \"@typescript-eslint/parser\": \"^2.23.0\",\n     \"@typescript-eslint/typescript-estree\": \"^2.23.0\"\n     },\n     \"scripts\": {\n     \"start\": \"react-scripts start\",\n     \" build\": \"react-scripts build\",\n     \"test\": \"react-scripts test\",\n     \"eject\": \"react-scripts eject\"\n     },\n     \"eslintConfig\": {\n     \"extends\": \"react-app\"\n     },\n     \"browserslist\": {\n     \"production\": [\n      \">0.2%\",\n      \"not dead\",\n      \"not op_mini all\"\n    ],\n      \"development\": [\n      \"last 1 chrome version\",\n      \"last 1 firefox version\",\n      \"last 1 safari version\"\n     ]\n     },\n     **strong text** \"proxy\": \"http://localhost:9000\"\n      }\n\nBelow is my index.ts\n\n    export * from './server';\n    export * from './useQuery';\n    export * from './useMutation';\n\nAnd my useMutation.ts\n\n    import { useState } from 'react';\n    import { server } from './server';\n\n    interface State<TData> {\n    data: TData | null;\n    loading: boolean; \n    error: boolean;\n    }\n\n    type MutationTuple<TData, TVariables> = [\n    (variables?: TVariables | undefined) => Promise<void>,\n    State<TData>\n    ];\n\n    export const useMutation = <TData = any, TVariables = any>(\n    query: string\n    ): MutationTuple<TData, TVariables> => { \n    const [state, setState] = useState<State<TData>>({\n    data: null,\n    loading: false,\n    error: false,\n    })\n\n    const fetch = async (variables?: TVariables) => {\n    try {\n      setState({ data: null, loading: true, error: false });\n\n      const { data, errors } = await server.fetch<TData, TVariables>({ query, variables });\n      if (errors && errors.length) {\n        throw new Error(errors[0].message);\n      }\n\n      setState({ data, loading: false, error: false });\n    } catch (err) {\n      setState({ data: null, loading: false, error: true });\n      throw console.error(err);\n    }\n   }\n\n   return [fetch, state];\n};","ecosystem":"npm","package_name":"reactjs","package_version":null,"solution":"Edit: as noted by Meng-Yuan Huang, this issue no longer occurs in react-scripts@^4.0.1\n\nThis error occurs because react-scripts has a direct dependency on the 2.xx range of @typescript-eslint/parser and @typescript-eslint/eslint-plugin.\n\nYou can fix this by adding a resolutions field to your package.json as follows:\n\n\"resolutions\": {\n  \"**/@typescript-eslint/eslint-plugin\": \"^4.1.1\",\n  \"**/@typescript-eslint/parser\": \"^4.1.1\"\n}\n\nNPM users: add the resolutions field above to your package.json but use npx npm-force-resolutions to update package versions in package-lock.json.\n\nYarn users: you don't need to do anything else. See selective dependency resolutions for more info.\n\nNOTE: if you're using a monorepo/Yarn workspaces, the resolutions field must be in the top-level package.json.\n\nNOTE: yarn add and yarn upgrade-interactive don't respect the resolutions field and they can generate a yarn.lock file with incorrect versions as a result. Watch out.","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/62079477/line-0-parsing-error-cannot-read-property-map-of-undefined","votes":163,"created_at":"2026-04-19T04:51:24.117411+00:00","updated_at":"2026-04-19T04:51:24.117411+00:00"}