编写TypeORM @Transaction方法,使用此方法时,IDE报告错误为“参数数量无效,期望2”

问题描述 投票:1回答:1

我将交易方法编写为正式文档(https://github.com/typeorm/typeorm/blob/master/docs/decorator-reference.md#transaction-transactionmanager-and-transactionrepository

下面的代码:

@Transaction('some-db-connection')
public async savePhoto(record: DeepPartial<Photo>, 
                       @TransactionManager() manager: EntityManager) {
    return await manager.save<DeepPartial<Photo>>(record)
}

当我在以下某些地方使用此方法时:

await someRepo.savePhoto(record)

VS代码和WebStorm都将错误报告为“参数数量无效,期望2”。谁知道如何让IDE不报告此错误?谢谢!

P.S。

尽管IDE报告错误,但是代码可以执行而没有错误

我所有的代码都是.ts文件中的TypeScript代码

transactions visual-studio-code ide webstorm typeorm
1个回答
0
投票
[两种解决方案对我有用:
© www.soinside.com 2019 - 2024. All rights reserved.