typescript-optional icon indicating copy to clipboard operation
typescript-optional copied to clipboard

Implement async functions

Open benkeil opened this issue 4 years ago • 6 comments

First of all, I love what you did!

It would be nice to use async functions in e.g. ifPresent and wait for them with async

benkeil avatar Jul 06 '21 02:07 benkeil

Thank you for your support!

Do you mean something like the following?

const optional: Optional<string> = Optional.ofNullable("foo");

optional.ifPresent(async (value) => console.log(value));
optional.ifPresentOrElse(async (value) => console.log(value), async () => console.log("empty"));

bromne avatar Jul 08 '21 07:07 bromne

Correct

benkeil avatar Jul 21 '21 13:07 benkeil

Any chance to doing this? I can also participate.

benkeil avatar Aug 23 '21 12:08 benkeil

@benkeil Sorry for no updates... I welcome your participation.

bromne avatar Aug 24 '21 19:08 bromne

Would be very nice to have this feature, it's almost 'mandatory' for any backend developments.

mgohin avatar Jan 03 '24 10:01 mgohin

That would be very nice, any update on this?

hamidouikene avatar May 03 '24 08:05 hamidouikene