A
A
Alexander risok2021-10-07 10:04:22
typescript
Alexander risok, 2021-10-07 10:04:22

What is different in TS return Promise.resolve(); from a simple return;?

It seems to return both, Promise<void>
but eslint swears at no consistent return if in one place return; and in anotherreturn Promise.race<void>([])

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Bannikov, 2021-10-07
@vabka

if all this is written in an asynchronous function, then you need to writereturn await Promise.race<void>([])

A
Aetae, 2021-10-07
@Aetae

Inside async functions - nothing.
Typescript-eslint simply doesn't have a corresponding rule, and the standard rule doesn't know anything about types.
Either disable this rule, or indulge it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question