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: interface UnCancel(#57) #58

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions packages/core/src/core/UnCancelToken.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe("core:UnCancelToken", () => {
cancel("Operation has been canceled.");
expect(token.reason).toEqual(expect.any(UnCanceledError));
expect(token.reason?.message).toBe("Operation has been canceled.");
expect(token.reason?.isUnCanceledError).toBe(true);
});

it("returns undefined if cancellation has not been requested", () => {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/core/UnCancelToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { UnCanceledError } from "./UnCanceledError";

export interface UnCancel {
message?: string;
isUnCanceledError: true;
}

export interface UnCancelStatic {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/core/UnCanceledError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { UnConfig, UnData, UnTask } from "../types";
import { UnError } from "./UnError";

class UnCanceledError<T = UnData, D = UnData> extends UnError<T, D> {
isUnCanceledError = true;
isUnCanceledError: true = true;

constructor(message?: string, config?: UnConfig<T, D>, task?: UnTask) {
super(message ?? "canceled");
Expand Down