Matching API Response with Schema Using Effect Typescript

how can I match with schema? the api returns either { result: <type> } or { error: <error> }
      const responseAsEither = yield* pipe(
        Match.value(response),
        Match.when(Schema.is(resultSchema), Either.right),
        Match.when(Schema.is(errorSchema), (error) => Either.left(error)),
        Match.exhaustive,
      );
      return responseAsEither;
Was this page helpful?