typescript - 承诺方法后缺少属性
问题描述
我在使用 .get 和 .set Redis 方法时遇到问题。
const getAsync: Promise<string> = promisify(client.get).bind(client)
const setAsync: Promise<void> = promisify(client.set).bind(client)
这给出了以下错误:
Type '(arg1: string) => Promise<string | null>' is missing the following properties from type 'Promise<string>': then, catch, finally, [Symbol.toStringTag]ts(2739)
我应该怎么做?
解决方案
推荐阅读
- css - 如何将带有参数的变量传递给mixin?
- c# - 在日历中显示特定月份的日期时出错 System.Collections.Generic.Dictionary2.get_Item(Tkey key)
- javascript - 在链接库和工作区应用程序之间链接反应版本
- tensorflow - 尝试使用 tensorflow 从 hdfs 读取时如何修复“RPC 响应超出最大数据长度”错误?
- angular - 当添加更多条时,d3js 负和正条形图会失去对齐
- c - 我们何时在 C 中声明 ADT 的指针,为什么?
- excel - 通过VBT编译报错
- javascript - 使用 contenteditable 属性更改段落中文本的对齐方式为 true
- c# - 在 ASP.NET MVC 中使用 web.config 保护内容安全策略标头列表
- java - 当实例将“this”作为参数时,我如何验证对模拟实例的调用