You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The return type for handleUnaryCall should be void, not Promise<void>.
So we should change the puppet-implementation methods to this. Take contactAlias as example:
contactAlias: (call,callback)=>{void(async()=>{log.verbose('PuppetServiceImpl','contactAlias()')constid=call.request.getId()/** * Set */if(call.request.hasAlias()){try{awaitpuppet.contactAlias(id,call.request.getAlias())returncallback(null,newgrpcPuppet.ContactAliasResponse())}catch(e){returngrpcError('contactAlias',e,callback)}}/** * Get */try{constalias=awaitpuppet.contactAlias(id)constresponse=newgrpcPuppet.ContactAliasResponse()response.setAlias(alias)returncallback(null,response)}catch(e){returngrpcError('contactAlias',e,callback)}})()},
This ensures that the implicit return of the callback remains undefined, rather than being a promise.
In current puppet-implementation.ts, there are lots of
@typescript-eslint/no-misused-promises
problems.According to https://stackoverflow.com/questions/63488141/promise-returned-in-function-argument-where-a-void-return-was-expected, and handleUnaryCall definition
The return type for handleUnaryCall should be
void
, notPromise<void>
.So we should change the puppet-implementation methods to this. Take contactAlias as example:
This ensures that the implicit return of the callback remains undefined, rather than being a promise.
refs:
https://typescript-eslint.io/rules/no-misused-promises/
https://stackoverflow.com/questions/63488141/promise-returned-in-function-argument-where-a-void-return-was-expected
The text was updated successfully, but these errors were encountered: