title: TypeScript: Duplicate identifier 'IteratorResult'
body: <p>I'm trying to compile via <code>tsc</code>--which I've installed globally--and I'm getting an error: </p>
  
  <pre class="lang-none prettyprint-override"><code>~/AppData/Roaming/nvm/v11.15.0/node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6 - error TS2300: Duplicate identifier 'IteratorResult'.
  
  41 type IteratorResult&lt;T, TReturn = any&gt; = IteratorYieldResult&lt;T&gt; | IteratorReturnResult&lt;TReturn&gt;;
          ~~~~~~~~~~~~~~
  
    node_modules/@types/node/index.d.ts:170:11
      170 interface IteratorResult&lt;T&gt; { }
                    ~~~~~~~~~~~~~~
      'IteratorResult' was also declared here.
  
  node_modules/@types/node/index.d.ts:170:11 - error TS2300: Duplicate identifier 'IteratorResult'.
  
  170 interface IteratorResult&lt;T&gt; { }
                ~~~~~~~~~~~~~~
  
  ~/AppData/Roaming/nvm/v11.15.0/node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6
      41 type IteratorResult&lt;T, TReturn = any&gt; = IteratorYieldResult&lt;T&gt; | IteratorReturnResult&lt;TReturn&gt;;
              ~~~~~~~~~~~~~~
      'IteratorResult' was also declared here.
  
  
  Found 2 errors.
  </code></pre>
  
  <p>I have <code>@types/node</code> version 10.1.0 installed.  (<code>@latest</code> has its own issues...)</p>
  
  <p><strong>tsconfig.json</strong></p>
  
  <pre class="lang-json prettyprint-override"><code>{
    "compilerOptions": {
      "target": "es2018",
      "moduleResolution": "node",
      "module": "commonjs",
      "jsx": "react",
      "lib": [
        "dom",
        "es2018",
        "dom.iterable",
        "scripthost"
      ],
      "typeRoots": [
        "./node_modules/@types",
        "./types"
      ],
      "types": [],
  
      "alwaysStrict": true,
      "strictNullChecks": true,
      "noImplicitAny": true,
      "noImplicitReturns": true,
      "noImplicitThis": true,
      "noUnusedLocals": true,
  
      "experimentalDecorators": true,
      "emitDecoratorMetadata": true,
      "esModuleInterop": true,
  
      "sourceMap": true,
  
      "outDir": "dist"
    },
    "files": [
      "app/index.tsx"
    ],
    "include": [
      "app/**/*.ts",
      "app/**/*.tsx",
      "test/**/*.ts",
      "test/**/*.tsx",
      "node_modules/@types/**/*.d.ts",
      "./types/**/*.d.ts"
    ],
    "exclude": [
      "dist"
    ]
  }
  </code></pre>
  
  <p>If I uninstall <code>typescript</code> globally and run <code>npx tsc</code> it works, but there should be nothing wrong with installing and running <code>typescript</code> globally.  After all, that's the whole point of installing things globally.</p>
  
  <p>In the meantime I have a workaround which is to just alias tsc (I'm using git bash in Windows).</p>
  
  <pre class="lang-bash prettyprint-override"><code>alias tsc="path/to/project/node_modules/.bin/tsc.cmd"
  </code></pre>