Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redefinition of Promise

Promise is now a global reserved word in es6 and linters throw a error. So what are the pitfalls of doing this

var Promise = require("bluebird");

or should i do

var BluebirdPromise = require("bluebird");
like image 521
aWebDeveloper Avatar asked Apr 05 '16 14:04

aWebDeveloper


1 Answers

Looks like there isn't a problem to redeclaring promise as long as it's not global. But second one is a better approach

Many of us do that. There's no problem. You're just using a faster implementation, that's all. But note that you may use more and more promises given by various libraries, so this is a very limited replacement (there are discussions in the node world about ways to define a library as a global promise provider). – Denys Séguret

like image 72
aWebDeveloper Avatar answered Oct 01 '22 00:10

aWebDeveloper