Skip to content

Commit

Permalink
fix: interface UnCancel(#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
Banana-energy committed Dec 8, 2024
1 parent 1146aa3 commit 8406d90
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
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

0 comments on commit 8406d90

Please sign in to comment.