happy-rusty
    Preparing search index...

    Variable ASYNC_NONEConst

    ASYNC_NONE: Promise<None> = ...

    Async Option constant for None. A pre-resolved Promise<None> that can be reused to avoid creating new Promise instances when returning None from async functions.

    Since None extends Option<never>, this constant can be assigned to any AsyncOption<T> (i.e., Promise<Option<T>>) due to TypeScript's covariance.

    1.8.0

    async function findUser(id: number): AsyncOption<User> {
    if (id < 0) {
    return ASYNC_NONE;
    }
    const user = await db.findUser(id);
    return user ? Some(user) : ASYNC_NONE;
    }
    // Useful in conditional async returns
    function maybeLoadAsync(shouldLoad: boolean): AsyncOption<Data> {
    if (!shouldLoad) {
    return ASYNC_NONE;
    }
    return loadDataAsync();
    }