Skip to content

Duplicate identifier 'Promise' (TS2529) too restrictive. #12323

Closed
@electricessence

Description

@electricessence

Error:(8, 9) TS2529:Duplicate identifier 'Promise'. Compiler reserves name 'Promise' in top level scope of a module containing async functions.

TypeScript Version: 2.1.1 (targeting ES5)
Code

import {Promise} from "myOwnPromiseLib";

What I'm confused about is when I look at the __awaiter code it expects Promise (P) to be available.
In a modular environment, how else am I supposed to inject my own Promise lib so it can use it?

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments)).next());
    });
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions