Cannot redeclare block scoped variable

The best explanation I could get is from Tamas Piro’s post.

TypeScript uses the DOM typings for the global execution environment. In your case there is a ‘co’ property on the global window object.

To solve this:

  1. Rename the variable, or

  2. Use TypeScript modules, and add an empty export{}:

    export {};


  3. Configure your compiler options by not adding DOM typings:

Edit tsconfig.json in the TypeScript project directory.

    "compilerOptions": {
        "lib": ["es6"]

Leave a Comment