Skip to content

Commit

Permalink
add const modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
uzmoi committed Jan 25, 2024
1 parent 0ac5aee commit d8df0dd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/parser-by-do.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const between = <T, S>(parser: Parser<T, S>, pre: Parser<unknown, S>, post = pre
const or = <T, U, S>(left: Parser<T, S>, right: Parser<U, S>) =>
qo<T | U, S>(perform => {
const [success, result] = perform.try(
[false] as const,
[false],
() => [true, perform(left)] as const,
);
return success ? result : perform(right);
Expand Down
2 changes: 1 addition & 1 deletion src/do.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type PerformOptions = {

export type Perform<S> = {
<T>(parser: Parser<T, S>, options?: PerformOptions): T;
try<T, U = T>(defaultValue: T, runner: () => U): T | U;
try<const T, U = T>(defaultValue: T, runner: () => U): T | U;
};

export const qo = <T, S>(
Expand Down
2 changes: 1 addition & 1 deletion src/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export const regexGroup = (re: RegExp): Parser<RegExpExecArray, string> => {
export const regex: {
(re: RegExp): Parser<string, string>;
(re: RegExp, groupId: number | string): Parser<string | undefined, string>;
<T>(
<const T>(
re: RegExp,
groupId: number | string,
defaultValue: T,
Expand Down

0 comments on commit d8df0dd

Please sign in to comment.