Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
bug fix
问题描述
在使用时发现
typescript
的类型推论无法正常运作,如下图可见泛型
M
按规范传入之后,并未在Promise<M>
中正确返回,并且在实际情况中,我看到返回都是any
问题调查
sequelize/types/lib/promise.d.ts
使用了@types/bluebird
,这个描述文件覆写了Promise
的描述sequelize/types/lib/model.d.ts
中大量引入了sequelize/types/lib/promise.d.ts
的Promise
@types/bluebird
时,sequelize/types/lib/promise.d.ts
使用的Promise
就会找不到,变成了any
,也就重现了上图的情况解决途径
@types/bluebird
依赖,并将其设置为dependencies
,保证用户在使用此依赖时同时也安装@types/bluebird
描述文件@types/bluebird
,链接如下 sequelize-typescript#installation