Skip to content

Commit

Permalink
Add const modifiers on patterns constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
zoontek committed Dec 6, 2023
1 parent c70482f commit c0c50ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/AsyncData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ const Loading = <A = never>(): AsyncData<A> => LOADING as Loading<A>;
const NotAsked = <A = never>(): AsyncData<A> => NOT_ASKED as NotAsked<A>;

const asyncDataPattern = {
Done: <A>(value: A) => ({ tag: "Done", value }) as const,
Done: <const A>(value: A) => ({ tag: "Done", value }) as const,
NotAsked: { tag: "NotAsked" } as const,
Loading: { tag: "Loading" } as const,
};
Expand Down
6 changes: 3 additions & 3 deletions src/OptionResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const NONE = (() => {
const None = <A = never>(): Option<A> => NONE as None<A>;

const optionPattern = {
Some: <A>(value: A) => ({ tag: "Some", value }) as const,
Some: <const A>(value: A) => ({ tag: "Some", value }) as const,
None: { tag: "None" } as const,
};

Expand Down Expand Up @@ -465,8 +465,8 @@ const Error = <A = never, E = never>(value: E): Result<A, E> => {
};

const resultPattern = {
Ok: <A>(value: A) => ({ tag: "Ok", value }) as const,
Error: <E>(value: E) => ({ tag: "Error", value }) as const,
Ok: <const A>(value: A) => ({ tag: "Ok", value }) as const,
Error: <const E>(value: E) => ({ tag: "Error", value }) as const,
};

export const Result = {
Expand Down

0 comments on commit c0c50ce

Please sign in to comment.