Skip to content

Issues compiling CDK projects ("TS2300: Duplicate identifier 'IteratorResult'") #3839

Closed
@RomainMuller

Description

@RomainMuller

Applications created using the current "init templates" for TypeScript may fail building with the following error message:

node_modules/@types/node/index.d.ts:97:11 - error TS2300: Duplicate identifier 'IteratorResult'.

97 interface IteratorResult<T> { }
             ~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6
    41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
            ~~~~~~~~~~~~~~
    'IteratorResult' was also declared here.

node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6 - error TS2300: Duplicate identifier 'IteratorResult'.

41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
        ~~~~~~~~~~~~~~

  node_modules/@types/node/index.d.ts:97:11
    97 interface IteratorResult<T> { }
                 ~~~~~~~~~~~~~~
    'IteratorResult' was also declared here.

This can be fixed by removing the @types/node dependency declared in package.json, or upgrading it from 8.10.45 to 8.10.52, by running the following command:

$ npm install @types/node@8
+ @types/[email protected]
updated 1 package and audited 558 packages in 2.961s
found 0 vulnerabilities

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.package/toolsRelated to AWS CDK Tools or CLI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions