happy-rusty
    Preparing search index...

    Type Alias IOResult<T>

    IOResult: Result<T, Error>

    Represents a synchronous operation that yields a Result<T, Error>. This is a result that is either Ok(T) if the operation was successful, or Err(Error) if there was an error.

    Type Parameters

    • T

      The type of the value that is produced by a successful operation.

    1.0.0

    function parseJSON<T>(json: string): IOResult<T> {
    try {
    return Ok(JSON.parse(json));
    } catch (e) {
    return Err(e as Error);
    }
    }