rtfeldman/seamless-immutable

Incorrectly identifying promises

开放

#208 创建于 2017年3月18日

 (6 条评论) (0 个反应) (0 位负责人)JavaScript (221 个派生)batch import
bughelp wanted

仓库指标

星标
 (5,367 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

I've encountered an issue in the latest (7.1.0) release relating to commit 492d53e705acb6c

The issue is that isPromise makes a huge assumption that any object with a then method is a Promise. If the object is not a Promise, then will be called which may not be desirable.

This can be demonstrated very simply

Immutable({then:function() { console.log("should not be called") }});

I encountered this when using superagent which provides a thenable interface but is not technically a Promise. I suspect there may well be other libraries with a similar approach.

贡献者指南