腾讯云
开发者社区
文档
建议反馈
控制台
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
登录/注册
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
文章
问答
(1442)
视频
沙龙
2
回答
ESlint
错误
,
类型
'() =>
Promise
<
void
>‘
缺少
来自
类型
’
Promise
<
ESlint
>‘
的
以下
属性
: then,
catch
,[
Symbol.toStringTag
],
finally
javascript
、
typescript
、
eslint
、
typescript-eslint
export const dbConnections: any = {}; if (, err);}; 这会抛出一个
错误
, export const connectDb:
Promise
<
void
> = async () => {^^^^^^^^^^^^^ Type '() =>
Promise
<<e
浏览 448
提问于2020-09-29
得票数 3
2
回答
能想出如何让TypeScript得到回报
的
快乐
typescript
、
typescript-typings
我已经将我
的
代码简化为这个简单
的
例子,它只返回一个诺言函数。TypeScript 3.2给出
的
错误
是:
错误
:(1,7) TS2739: Type '() =>
Promise
<{}>‘“
类型
'
Promise
<{ hasErrored: boolean;}>’中
缺少
以下
属性
:然后,
catch
,
Symbol.toString
浏览 0
提问于2019-02-12
得票数 4
回答已采纳
1
回答
返回Promises数组
的
函数
类型
应该是什么
javascript
、
reactjs
、
typescript
、
types
函数
的
返回
类型
应该是什么?下面是代码const labelPath});}; 它给出了这个
错误
-
类型
'(selectedNode: NodeKind[]) =>
Promise
浏览 0
提问于2019-08-26
得票数 1
3
回答
如何在Node+Typescript+VSCode中查找缺失
的
等待异步函数调用?
node.js
、
typescript
、
async-await
、
visual-studio-code
、
vscode-extensions
users = getUsers(); // <<< missing await}; 有没有一种简单
的
方法可以找到
缺少
await关键字
的
异步函数调用?如果做不到这一点,编写一个自动标记这些
的
Visual Studio代码扩展需要多大
的
努力呢?(如果有人能给我指出正确
的
方向,我随时准备解决)。
浏览 0
提问于2017-10-18
得票数 16
2
回答
什么是AsyncGenerator TypeScript
类型
产生
的
承诺?
typescript
、
generator
、
iterable
let n = 0; yield new
Promise
(resolve => resolve(n++)); for await (const i of sleepyNumbers())})();生成器正在产生一种向number解析
的
承诺将
类型
设置为
Promise
<number>将失败,此
错误</
浏览 16
提问于2020-03-14
得票数 6
回答已采纳
2
回答
最后如何履行另一项承诺?
javascript
、
typescript
、
eslint
、
typescript-eslint
据我所见,
finally
接受作为返回
类型
的
承诺:但是看看我
的
代码,
eslint
似乎不喜欢它: return this.downloadProject(data) return fse
浏览 4
提问于2021-08-26
得票数 0
回答已采纳
1
回答
处理承诺范围内
的
错误
javascript
我有一个异步函数,它返回允诺--在这个承诺中,我有范围函数;在这个函数中,我有另外两个作用域函数,如果我试图向函数a抛出
错误
,代码将继续它
的
执行 return new
Promise
((resolve, reject) => { //
eslint
-disable-next-line @typescript-
eslint
浏览 1
提问于2022-01-10
得票数 0
1
回答
类型
错误
: jest.spyOn()中
的
mockReturnValueOnce将参数
类型
推断为空
typescript
、
jestjs
、
backend
我正在尝试模拟bcrypt
的
compare方法
的
返回值。compare方法
的
返回
类型
是一个
Promise
。当我写这行"jest.spyOn(bcrypt,'compare').mockReturnValueOnce()“时,推断给mockReturnValueOnce
的
参数
类型
是空
的
,而不是
Promise
。因此,我不能用这个"new
Promise
(resolve =>
浏览 65
提问于2021-07-23
得票数 1
回答已采纳
2
回答
字符串文字作为数据
类型
的
语义
typescript
、
types
这是lib.es2015.symbol.wellknown.d.ts
的
摘录 readonly [
Symbol.toStringTag
]: "
Promise
";只读
的
含义是不言而喻
的
,[
Symbol.toStringTag
]大概是指“toString
的
函数
属性
”。令我困惑
的
是使用字符串文字作为
类型
。我不认为这和
浏览 0
提问于2017-08-22
得票数 1
回答已采纳
1
回答
如何通过
类型
记录实现承诺界面?
typescript
export interface CarElement {} class CarResult implements
Promise
<CarElement
浏览 5
提问于2021-11-12
得票数 0
1
回答
ESLint
:意外
的
any。指定不同
的
类型
。(@typescript-
eslint
/no-explicit any)
reactjs
、
typescript
、
function
、
firebase-authentication
、
react-hooks
我有这行代码,它是一个包装器函数,尽管它工作得很好,const to = (
promise
: any) =>
promise
.then((data: any) => data).
catch
((err:any) => err); 但是,如果我不包含
eslint
-disable-next-line,
eslint
会提示意外
的
任何
错误
ESLint
: Unexpected any.(@typescript-
eslint
浏览 257
提问于2021-09-14
得票数 0
1
回答
(
eslint
unbound-method error)
node.js
、
typescript
、
eslint
、
apollo-server
、
apollo-server-testing
我
的
测试服务器和客户机是这样设置
的
:import { ApolloServer } from 'apollo-server-express'; }你知道如何输入变量query和mutate来避免implicit any
错误
吗似乎有一些
类型
推断,但我似乎不能从apo
浏览 0
提问于2021-04-23
得票数 1
2
回答
异步函数返回
类型
强制
Promise
< T= undefined>而不是承诺
的
<T>
typescript
、
promise
我很难理解异步函数
的
返回
类型
。在这里,我希望只返回
Promise
<Glslang >
类型
,而不返回
Promise
<Glslang\ undefined>
类型
。
以下
是代码: compileGLSL( type: 'vertex' | 'fragment' |dist/web-devel/g
浏览 0
提问于2021-03-06
得票数 1
回答已采纳
2
回答
在nestjs应用程序中使用新阿波罗服务器版本
的
类型
记录
错误
typescript
、
nestjs
、
apollo-server
我在我
的
apollo-server-plugin-base应用程序中将nestJS更新为v3.2,现在我得到了这个简单
的
nestjs插件
的
两个
类型
记录
错误
:willSend
浏览 5
提问于2021-08-28
得票数 1
回答已采纳
1
回答
类型
“”
Promise
<
void
>“”
缺少
类型
的
以下
属性
reactjs
、
typescript
、
promise
我不太理解下面的
错误
: Type '
Promise
<
void
>' is missing the following properties from type 'InventoryModel[]': lengthTS2740 我有
以下
功能组件: import React, { useEffect, useState } from "react"; import { Grid, TextField } frominventory, inventoryIte
浏览 445
提问于2020-12-11
得票数 0
3
回答
TypeScript/
Eslint
在Express路由器异步路由上抛出一个“允诺返回”
错误
node.js
、
typescript
、
eslint
、
typeorm
、
express-router
在测试运行后,我有
以下
端点设置来重置数据库:import express from 'express'; const connection = getConnection=> { await resetTestDataba
浏览 5
提问于2021-04-15
得票数 11
回答已采纳
1
回答
TypeScript异步/等待箭头函数:右语法(在反应中)
reactjs
、
typescript
、
asynchronous
、
async-await
一个值
来自
另一个函数,该函数从获取值。我希望使用等待/异步风格,而不是承诺(.then、.
catch
、.finaly)。compareValues:
Promise
<boolean> = async () => { const value1 = false;(error) {} export interface IInterface
浏览 0
提问于2020-10-29
得票数 0
回答已采纳
1
回答
类型
记录节点表示控制器。什么样
的
回报?
typescript
、
express
节点表达式中
的
返回函数是什么
类型
的
?我读到我可以写任何或
void
。在这种情况下,
void
就是而不是。有什么建议吗?现在我看到我可以像这个
Promise
<Response<any>>一样使用了,我应该关掉这个规则“@typescript-
eslint
/no--
eslint
any”,但是我不想关掉它。//Here:
Promise
<Response<any>>
浏览 1
提问于2021-01-11
得票数 1
回答已采纳
1
回答
如何用
ESlint
验证
promise
(JS)语法?
javascript
、
atom-editor
、
eslint
我希望验证
promise
语法,如下所示: console.log(value); console.log(value); 例如,如果then拼写
错误
或
catch
。我使用
的
是Atom文本编辑器,但我认为它适用于所有编辑器。
浏览 3
提问于2018-04-02
得票数 1
1
回答
如何在typescript / javascript中将异步const分配给对象
的
属性
javascript
、
angular
、
typescript
在下面的示例中,我试图将异步const函数赋值为父对象
的
属性
,因此可以在进一步
的
代码中延迟访问它,例如示例中
的
fn:异步函数getItem()。但是,当将const-s分配给
属性
'subItems‘时,我得到了
错误
:请你解释一下我错过了什么:
Promise
<ItemI
浏览 1
提问于2021-11-04
得票数 1
回答已采纳
点击加载更多
扫码
添加站长 进交流群
领取专属
10元无门槛券
手把手带您无忧上云
相关
资讯
JS错误和异常处理
javascript入门到进阶-javascript流程控制与错误处理
ES6之Promise的使用
从一个优质开源项目来看前端架构
深入理解Promise
热门
标签
更多标签
活动推荐
运营活动
广告
关闭
领券