Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚨 fix linting errors #42

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion fx/parallel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export interface ParallelRet<T> extends Computation<Result<T>[]> {
* }
* ```
*/
export function parallel<T>(operations: Callable<T>[]) {
export function parallel<T>(
operations: Callable<T>[],
): Operation<ParallelRet<T>> {
const sequence = createChannel<Result<T>>();
const immediate = createChannel<Result<T>>();
const results: Result<T>[] = [];
Expand Down
1 change: 1 addition & 0 deletions fx/race.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// deno-lint-ignore-file no-explicit-any
import type { Callable, Operation, Task } from "npm:[email protected]";
import { action, call, resource, spawn } from "npm:[email protected]";

Expand Down
15 changes: 9 additions & 6 deletions fx/request.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { call, useAbortSignal } from "npm:[email protected]";
import { call, type Operation, useAbortSignal } from "npm:[email protected]";

export function* request(url: string | URL | Request, opts?: RequestInit) {
export function* request(
url: string | URL | Request,
opts?: RequestInit,
): Operation<Response> {
const signal = yield* useAbortSignal();
const response = yield* call(fetch(url, { signal, ...opts }));
const response = yield* call(() => fetch(url, { signal, ...opts }));
return response;
}

export function* json(response: Response) {
const result = yield* call(response.json());
return result;
// deno-lint-ignore no-explicit-any
export function* json(response: Response): Operation<any> {
return yield* call(() => response.json());
}
1 change: 1 addition & 0 deletions fx/safe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function isError(error: unknown): error is Error {

export function* safe<T>(operator: Callable<T>): Operation<Result<T>> {
try {
// deno-lint-ignore no-explicit-any
const value = yield* call<T>(operator as any);
return Ok(value);
} catch (error) {
Expand Down
Loading