HiveBrain v1.2.0
Get Started
← Back to all entries
debugtypescriptreactMinor

Line 0: Parsing error: Cannot read property 'map' of undefined

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
errorpropertylineparsingundefinedcannotreadmap

Problem

I am currently starting up the server on my client side, the error above is what I have been
getting. I am using TypeScript, ReactJS, ESLint. I can't seem to go forward since this error
has been haunting me. The GitHub page for ESLint hasn't been of much help either.

This error went up after I had created the useMutation component and exported it in index.ts.
Not sure how to get rid of this error.

Below is my package.json

{
    "name": "tinyhouse_client",
    "version": "0.1.0",
    "private": true,
      "dependencies": {
      "@testing-library/jest-dom": "^4.2.4",
      "@testing-library/react": "^9.3.2",
      "@testing-library/user-event": "^7.1.2",
      "@types/jest": "^24.0.0",
      "@types/node": "^12.0.0",
      "@types/react": "^16.9.35",
      "@types/react-dom": "^16.9.0",
      "@typescript-eslint/parser": "^3.0.2",
      "react": "^16.13.1",
      "react-dom": "^16.13.1",
      "react-scripts": "3.4.1",
      "typescript": "~2.23.0"
      },
      "resolutions": {
     "@typescript-eslint/eslint-plugin": "^2.23.0",
     "@typescript-eslint/parser": "^2.23.0",
     "@typescript-eslint/typescript-estree": "^2.23.0"
     },
     "scripts": {
     "start": "react-scripts start",
     " build": "react-scripts build",
     "test": "react-scripts test",
     "eject": "react-scripts eject"
     },
     "eslintConfig": {
     "extends": "react-app"
     },
     "browserslist": {
     "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
      "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
     ]
     },
     **strong text** "proxy": "http://localhost:9000"
      }


Below is my index.ts

export * from './server';
    export * from './useQuery';
    export * from './useMutation';


And my useMutation.ts

```
import { useState } from 'react';
import { server } from './server';

interface State {
data: TData | null;
loading: boolean;
e

Solution

Is this coming from eslint-typescript? If so, check that your version of typescript is not a dev/nightly build.

Context

Stack Overflow Q#62079477, score: 18

Revisions (0)

No revisions yet.