material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

Cannot find name 'Map' error

Open mhafer opened this issue 8 years ago • 5 comments

I get this error (shown in red text at bottom of image) when I hit compile. The error is only shown in the node module.

I did an npm install material-ui-next@latest just now to make sure I had the latest version.

I'm using TypeScript and Material-UI beta version.

Thanks image

mhafer avatar Jan 19 '18 19:01 mhafer

@mhafer From what I can understand, you are using an old browser than doesn't support the Map object. It's supported by the following browsers: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map. Here are the browsers we are supporting: https://material-ui.com/getting-started/supported-platforms/#browser

oliviertassinari avatar Jan 19 '18 19:01 oliviertassinari

Hey, I got the same issue but my Chrome have the right version Version 64.0.3282.119 (Build officiel) (64 bits). Any Idea ?

Paul-Vandell avatar Feb 04 '18 13:02 Paul-Vandell

I have no clue.

oliviertassinari avatar Feb 04 '18 13:02 oliviertassinari

Ok find it ! It is cause by tsconfig.json. we need to specified the es6 instead es5.

{
  "compilerOptions": {
    "outDir": "./dist/",
    "sourceMap": true,
    "noImplicitAny": true,
    "module": "commonjs",
    "target": "es6", <===  it was "es5" before : my bad
    "jsx": "react",
    "allowJs": true
  },
  "include": ["./src/**/*"]
}

Paul-Vandell avatar Feb 04 '18 13:02 Paul-Vandell

To solve this you only need to import map method in your ts file like this: import { map } from 'rxjs/operators';

OusamaELIDRISSI avatar May 10 '20 21:05 OusamaELIDRISSI