Skip to content
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
2 changes: 1 addition & 1 deletion @coven/compare/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"exports": "./mod.ts",
"name": "@coven/compare",
"version": "0.9.9"
"version": "0.9.10"
}
2 changes: 1 addition & 1 deletion @coven/constants/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"exports": "./mod.ts",
"name": "@coven/constants",
"version": "0.9.9"
"version": "0.9.10"
}
33 changes: 25 additions & 8 deletions @coven/cron/cronRegExp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import { valueRangeOrListRegExp } from "./valueRangeOrListRegExp.ts";
* new RegExp(cronRegExp).test("1 2 3 4 5"); // true
* ```
*/
export const cronRegExp: "^\\s*(?!(?:\\S+\\s+){2}(?:(?:(?:3[01](?:-3[01])?|(?:(?:3[01](?:-3[01])?,)+3[01](?:-3[01])?))\\s+(?:(?:0?2|feb)(?:-(?:0?2|feb))?|(?:(?:(?:0?2|feb)(?:-(?:0?2|feb))?,)+(?:0?2|feb)(?:-(?:0?2|feb))?)))|(?:(?:31(?:-31)?|(?:(?:31(?:-31)?,)+31(?:-31)?))\\s+(?:(?:0?[2469]|11|feb|apr|jun|sep|nov)|(?:(?:(?:0?[2469]|11|feb|apr|jun|sep|nov),)+(?:0?[2469]|11|feb|apr|jun|sep|nov)))))\\s+\\S+)(?<minute>\\*|(?:(?:0?\\d|[1-5]\\d)(?:-(?:0?\\d|[1-5]\\d))?|(?:(?:(?:0?\\d|[1-5]\\d)(?:-(?:0?\\d|[1-5]\\d))?,)+(?:0?\\d|[1-5]\\d)(?:-(?:0?\\d|[1-5]\\d))?)))\\s+(?<hour>\\*|(?:(?:0?\\d|1\\d|20-3)(?:-(?:0?\\d|1\\d|20-3))?|(?:(?:(?:0?\\d|1\\d|20-3)(?:-(?:0?\\d|1\\d|20-3))?,)+(?:0?\\d|1\\d|20-3)(?:-(?:0?\\d|1\\d|20-3))?)))\\s+(?<dayOfMonth>\\*|(?:(?:0?[1-9]|[12]\\d|3[01])(?:-(?:0?[1-9]|[12]\\d|3[01]))?|(?:(?:(?:0?[1-9]|[12]\\d|3[01])(?:-(?:0?[1-9]|[12]\\d|3[01]))?,)+(?:0?[1-9]|[12]\\d|3[01])(?:-(?:0?[1-9]|[12]\\d|3[01]))?)))\\s+(?<month>\\*|(?:(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|0?[1-9]|1[0-2])(?:-(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|0?[1-9]|1[0-2]))?|(?:(?:(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|0?[1-9]|1[0-2])(?:-(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|0?[1-9]|1[0-2]))?,)+(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|0?[1-9]|1[0-2])(?:-(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|0?[1-9]|1[0-2]))?)))\\s+(?<dayOfWeek>\\*|(?:(?:sun|mon|tue|wed|thu|fri|sat|0?[0-6])(?:-(?:sun|mon|tue|wed|thu|fri|sat|0?[0-6]))?|(?:(?:(?:sun|mon|tue|wed|thu|fri|sat|0?[0-6])(?:-(?:sun|mon|tue|wed|thu|fri|sat|0?[0-6]))?,)+(?:sun|mon|tue|wed|thu|fri|sat|0?[0-6])(?:-(?:sun|mon|tue|wed|thu|fri|sat|0?[0-6]))?)))\\s*$" =
export const cronRegExp: "^\\s*(?!(?:\\S+\\s+){2}(?:(?:(?:3[01](?:-3[01])?|(?:(?:3[01](?:-3[01])?,)+3[01](?:-3[01])?))\\s+(?:(?:0?2|feb)(?:-(?:0?2|feb))?|(?:(?:(?:0?2|feb)(?:-(?:0?2|feb))?,)+(?:0?2|feb)(?:-(?:0?2|feb))?)))|(?:(?:31(?:-31)?|(?:(?:31(?:-31)?,)+31(?:-31)?))\\s+(?:(?:(?:(?:0?2|feb)(?:-(?:0?2|feb))?|(?:(?:(?:0?2|feb)(?:-(?:0?2|feb))?,)+(?:0?2|feb)(?:-(?:0?2|feb))?))|(?:(?:0?4|apr)(?:-(?:0?4|apr))?|(?:(?:(?:0?4|apr)(?:-(?:0?4|apr))?,)+(?:0?4|apr)(?:-(?:0?4|apr))?))|(?:(?:0?6|jun)(?:-(?:0?6|jun))?|(?:(?:(?:0?6|jun)(?:-(?:0?6|jun))?,)+(?:0?6|jun)(?:-(?:0?6|jun))?))|(?:(?:0?9|sep)(?:-(?:0?9|sep))?|(?:(?:(?:0?9|sep)(?:-(?:0?9|sep))?,)+(?:0?9|sep)(?:-(?:0?9|sep))?))|(?:(?:11|nov)(?:-(?:11|nov))?|(?:(?:(?:11|nov)(?:-(?:11|nov))?,)+(?:11|nov)(?:-(?:11|nov))?)))|(?:(?:(?:(?:(?:0?2|feb)(?:-(?:0?2|feb))?|(?:(?:(?:0?2|feb)(?:-(?:0?2|feb))?,)+(?:0?2|feb)(?:-(?:0?2|feb))?))|(?:(?:0?4|apr)(?:-(?:0?4|apr))?|(?:(?:(?:0?4|apr)(?:-(?:0?4|apr))?,)+(?:0?4|apr)(?:-(?:0?4|apr))?))|(?:(?:0?6|jun)(?:-(?:0?6|jun))?|(?:(?:(?:0?6|jun)(?:-(?:0?6|jun))?,)+(?:0?6|jun)(?:-(?:0?6|jun))?))|(?:(?:0?9|sep)(?:-(?:0?9|sep))?|(?:(?:(?:0?9|sep)(?:-(?:0?9|sep))?,)+(?:0?9|sep)(?:-(?:0?9|sep))?))|(?:(?:11|nov)(?:-(?:11|nov))?|(?:(?:(?:11|nov)(?:-(?:11|nov))?,)+(?:11|nov)(?:-(?:11|nov))?))),)+(?:(?:(?:0?2|feb)(?:-(?:0?2|feb))?|(?:(?:(?:0?2|feb)(?:-(?:0?2|feb))?,)+(?:0?2|feb)(?:-(?:0?2|feb))?))|(?:(?:0?4|apr)(?:-(?:0?4|apr))?|(?:(?:(?:0?4|apr)(?:-(?:0?4|apr))?,)+(?:0?4|apr)(?:-(?:0?4|apr))?))|(?:(?:0?6|jun)(?:-(?:0?6|jun))?|(?:(?:(?:0?6|jun)(?:-(?:0?6|jun))?,)+(?:0?6|jun)(?:-(?:0?6|jun))?))|(?:(?:0?9|sep)(?:-(?:0?9|sep))?|(?:(?:(?:0?9|sep)(?:-(?:0?9|sep))?,)+(?:0?9|sep)(?:-(?:0?9|sep))?))|(?:(?:11|nov)(?:-(?:11|nov))?|(?:(?:(?:11|nov)(?:-(?:11|nov))?,)+(?:11|nov)(?:-(?:11|nov))?)))))))\\s+\\S+)(?<minute>\\*|(?:(?:0?\\d|[1-5]\\d)(?:-(?:0?\\d|[1-5]\\d))?|(?:(?:(?:0?\\d|[1-5]\\d)(?:-(?:0?\\d|[1-5]\\d))?,)+(?:0?\\d|[1-5]\\d)(?:-(?:0?\\d|[1-5]\\d))?)))\\s+(?<hour>\\*|(?:(?:0?\\d|1\\d|20-3)(?:-(?:0?\\d|1\\d|20-3))?|(?:(?:(?:0?\\d|1\\d|20-3)(?:-(?:0?\\d|1\\d|20-3))?,)+(?:0?\\d|1\\d|20-3)(?:-(?:0?\\d|1\\d|20-3))?)))\\s+(?<dayOfMonth>\\*|(?:(?:0?[1-9]|[12]\\d|3[01])(?:-(?:0?[1-9]|[12]\\d|3[01]))?|(?:(?:(?:0?[1-9]|[12]\\d|3[01])(?:-(?:0?[1-9]|[12]\\d|3[01]))?,)+(?:0?[1-9]|[12]\\d|3[01])(?:-(?:0?[1-9]|[12]\\d|3[01]))?)))\\s+(?<month>\\*|(?:(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|0?[1-9]|1[0-2])(?:-(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|0?[1-9]|1[0-2]))?|(?:(?:(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|0?[1-9]|1[0-2])(?:-(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|0?[1-9]|1[0-2]))?,)+(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|0?[1-9]|1[0-2])(?:-(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|0?[1-9]|1[0-2]))?)))\\s+(?<dayOfWeek>\\*|(?:(?:sun|mon|tue|wed|thu|fri|sat|0?[0-6])(?:-(?:sun|mon|tue|wed|thu|fri|sat|0?[0-6]))?|(?:(?:(?:sun|mon|tue|wed|thu|fri|sat|0?[0-6])(?:-(?:sun|mon|tue|wed|thu|fri|sat|0?[0-6]))?,)+(?:sun|mon|tue|wed|thu|fri|sat|0?[0-6])(?:-(?:sun|mon|tue|wed|thu|fri|sat|0?[0-6]))?)))\\s*$" =
join(
START,
allow(WHITESPACE),
Expand All @@ -67,13 +67,30 @@ export const cronRegExp: "^\\s*(?!(?:\\S+\\s+){2}(?:(?:(?:3[01](?:-3[01])?|(?:(?
valueOrListRegExp(
group(
disjunction(
paddedRegExp(characterClass(2, 4, 6, 9)),
11,
"feb",
"apr",
"jun",
"sep",
"nov",
valueRangeOrListRegExp(
group(
disjunction(paddedRegExp(2), "feb"),
),
),
valueRangeOrListRegExp(
group(
disjunction(paddedRegExp(4), "apr"),
),
),

valueRangeOrListRegExp(
group(
disjunction(paddedRegExp(6), "jun"),
),
),
valueRangeOrListRegExp(
group(
disjunction(paddedRegExp(9), "sep"),
),
),
valueRangeOrListRegExp(
group(disjunction(11, "nov")),
),
),
),
),
Expand Down
2 changes: 1 addition & 1 deletion @coven/cron/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"exports": "./mod.ts",
"name": "@coven/cron",
"version": "0.9.9"
"version": "0.9.10"
}
3 changes: 1 addition & 2 deletions @coven/cron/isRangeField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ export const isRangeField: <Predicated extends number>(
&& hasFrom(value)
&& hasTo(value)
&& isNumber(value.from)
&& isNumber(value.to)
&& value.from < value.to,
&& isNumber(value.to),
);
6 changes: 6 additions & 0 deletions @coven/cron/nextISODate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import { nextISODates } from "./nextISODates.ts";
/**
* Get next ISO date string for the given date and the given cron expression.
*
* > [!NOTE]
* > This function is expensive because it relies on {@linkcode nextISODates} which is also expensive (it goes minute by minute).
*
* > [!WARNING]
* > If user input will be passed to this function, make sure to validate it first because this has the potential to loop forever.
*
* @example Getting the next ISO Date string corresponding to the given cron expression
* ```typescript
* nextISODate("1989-10-13T10:15:00.000Z")("* * * * *"); // "1989-10-13T10:16:00.000Z"
Expand Down
6 changes: 6 additions & 0 deletions @coven/cron/nextISODates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ const filterIsISODate = filter(
/**
* Get next ISO date string iterator for the given date and the given cron expression.
*
* > [!NOTE]
* > This function is expensive. It goes minute by minute scanning for matches.
*
* > [!WARNING]
* > If user input will be passed to this function, make sure to validate it first because this has the potential to loop forever.
*
* @example Using `take` from `@coven/iterables` to get some ISO Dates following the given one with the given cron expression
* ```typescript
* import { take } from "@coven/iterables";
Expand Down
4 changes: 0 additions & 4 deletions @coven/cron/tests/isRangeField.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,3 @@ Deno.test("Array of numbers returns true", () =>
);

Deno.test("Range returns true", () => assert(isRangeField({ from: 3, to: 5 })));

Deno.test("Range with inverted from and to returns false", () =>
assertFalse(isRangeField({ from: 5, to: 3 })),
);
73 changes: 73 additions & 0 deletions @coven/cron/tests/isValidExpression.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,79 @@ Deno.test("String that is a * returns false", () =>
assertFalse(isValidExpression("*")),
);

const shortMonths = [
[4, "apr"],
[6, "jun"],
[9, "sep"],
[11, "nov"],
] as const;

const getAllVariations = ([number, name]: readonly [
number: number,
name: string,
]) => {
const stringNumber = `${number}`;
const paddedStringNumber = stringNumber.padStart(2, "0");
const ranges = [
`${stringNumber}-${stringNumber}`,
`${stringNumber}-${paddedStringNumber}`,
`${stringNumber}-${name}`,
`${paddedStringNumber}-${stringNumber}`,
`${paddedStringNumber}-${paddedStringNumber}`,
`${paddedStringNumber}-${name}`,
`${name}-${stringNumber}`,
`${name}-${paddedStringNumber}`,
`${name}-${name}`,
];
const lists = [
`${stringNumber},${stringNumber}`,
`${stringNumber},${paddedStringNumber}`,
`${stringNumber},${name}`,
`${paddedStringNumber},${stringNumber}`,
`${paddedStringNumber},${paddedStringNumber}`,
`${paddedStringNumber},${name}`,
`${name},${stringNumber}`,
`${name},${paddedStringNumber}`,
`${name},${name}`,
];

return [stringNumber, paddedStringNumber, name, ...ranges, ...lists];
};

const shortMonthsInvalidExpressions = [
...getAllVariations([2, "feb"]).flatMap(
(month) =>
[
`* * 30 ${month} *`,
`* * 31 ${month} *`,
`* * 30-30 ${month} *`,
`* * 30-31 ${month} *`,
`* * 30,30 ${month} *`,
`* * 30,31 ${month} *`,
`* * 31-31 ${month} *`,
`* * 31,31 ${month} *`,
] as const,
),
...shortMonths
.flatMap(getAllVariations)
.flatMap(
(month) =>
[
`* * 31 ${month} *`,
`* * 31-31 ${month} *`,
`* * 31,31 ${month} *`,
] as const,
),
];

Deno.test("Invalid ranges and lists returns false", () =>
assert(
shortMonthsInvalidExpressions.every(
(expression) => !isValidExpression(expression),
),
),
);

Deno.test("Valid expression returns true", () =>
assert(isValidExpression("* * * * *")),
);
Expand Down
30 changes: 30 additions & 0 deletions @coven/cron/tests/nextISODate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,36 @@ Deno.test(
() => assertStrictEquals(testDate({ dayOfMonth: 31, month: 2 }), undefined),
);

Deno.test(
"* * 31 2-2 * as object returns nothing because it's an invalid date",
() =>
assertStrictEquals(
testDate({ dayOfMonth: 31, month: { from: 2, to: 2 } }),
undefined,
),
);

Deno.test(
"* * 31-31 4 * as object returns nothing because it's an invalid date",
() =>
assertStrictEquals(
testDate({ dayOfMonth: { from: 31, to: 31 }, month: 4 }),
undefined,
),
);

Deno.test(
"* * 31-31 4-4 * as object returns nothing because it's an invalid date",
() =>
assertStrictEquals(
testDate({
dayOfMonth: { from: 31, to: 31 },
month: { from: 4, to: 4 },
}),
undefined,
),
);

Deno.test(
"* * 29,30,31 2 * as an object gets first minute of next february 29",
() =>
Expand Down
2 changes: 1 addition & 1 deletion @coven/expression/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"exports": "./mod.ts",
"name": "@coven/expression",
"version": "0.9.9"
"version": "0.9.10"
}
2 changes: 1 addition & 1 deletion @coven/iterables/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"exports": { ".": "./mod.ts", "./async": "./async/mod.ts" },
"name": "@coven/iterables",
"version": "0.9.9"
"version": "0.9.10"
}
2 changes: 1 addition & 1 deletion @coven/math/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"exports": "./mod.ts",
"name": "@coven/math",
"version": "0.9.9"
"version": "0.9.10"
}
2 changes: 1 addition & 1 deletion @coven/memo/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"exports": "./mod.ts",
"name": "@coven/memo",
"version": "0.9.9"
"version": "0.9.10"
}
12 changes: 6 additions & 6 deletions @coven/pair/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"exports": { "./preact": "./preact/mod.ts", "./react": "./react/mod.ts" },
"imports": {
"@types/react": "npm:@types/react@^19.2.17",
"@types/react-dom": "npm:@types/react-dom@^19.2.3",
"preact": "npm:preact@^10.29.2",
"@types/react": "npm:@types/react@^19.2.18",
"@types/react-dom": "npm:@types/react-dom@^19.2.4",
"preact": "npm:preact@^10.29.8",
"preact-render-to-string": "npm:preact-render-to-string@^6.7.0",
"react": "npm:react@^19.2.7",
"react-dom": "npm:react-dom@^19.2.7"
"react": "npm:react@^19.2.8",
"react-dom": "npm:react-dom@^19.2.8"
},
"name": "@coven/pair",
"version": "0.9.9"
"version": "0.9.10"
}
2 changes: 1 addition & 1 deletion @coven/parsers/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"exports": "./mod.ts",
"name": "@coven/parsers",
"version": "0.9.9"
"version": "0.9.10"
}
2 changes: 1 addition & 1 deletion @coven/predicates/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"exports": "./mod.ts",
"name": "@coven/predicates",
"version": "0.9.9"
"version": "0.9.10"
}
2 changes: 1 addition & 1 deletion @coven/rules/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"exports": "./mod.ts",
"name": "@coven/rules",
"version": "0.9.9"
"version": "0.9.10"
}
2 changes: 1 addition & 1 deletion @coven/template/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"exports": "./mod.ts",
"name": "@coven/template",
"version": "0.9.9"
"version": "0.9.10"
}
2 changes: 1 addition & 1 deletion @coven/terminal/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"exports": "./mod.ts",
"name": "@coven/terminal",
"version": "0.9.9"
"version": "0.9.10"
}
20 changes: 9 additions & 11 deletions @coven/types/EntryOf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ import type { ReadonlyArrayLike } from "./ReadonlyArrayLike.ts";
* @see {@linkcode ReadonlyArrayLike}
* @template Object Object to get the entry from.
*/
export type EntryOf<Object extends object> = Readonly<
{
/**
* @see {@linkcode EntryOf} property that shouldn't be referenced directly
*/
[Property in keyof Object]: Entry<
NormalizeEntryKey<Property>,
Object extends ReadonlyArrayLike ? Object[number] : Object[Property]
>;
}
>[keyof Object];
export type EntryOf<Object extends object> = Readonly<{
/**
* @see {@linkcode EntryOf} property that shouldn't be referenced directly
*/
[Property in keyof Object]: Entry<
NormalizeEntryKey<Property>,
Object extends ReadonlyArrayLike ? Object[number] : Object[Property]
>;
}>[keyof Object];
2 changes: 1 addition & 1 deletion @coven/types/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"exports": "./mod.ts",
"name": "@coven/types",
"version": "0.9.9"
"version": "0.9.10"
}
2 changes: 1 addition & 1 deletion @coven/utils/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"exports": "./mod.ts",
"name": "@coven/utils",
"version": "0.9.9"
"version": "0.9.10"
}
4 changes: 2 additions & 2 deletions @simulcast/core/BroadcastObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ export type BroadcastObject<Events extends EventTypeDictionary> = Readonly<
* Dynamically generated `emit`.
*/
[
Event in keyof Events as `emit${Capitalize<keyof Events & string>}`
Event in keyof Events as `emit${Capitalize<Event & string>}`
]: EventHandler<Events[Event]>;
} & {
/**
* Dynamically generated `on`.
*/
[Event in keyof Events as `on${Capitalize<keyof Events & string>}`]: (
[Event in keyof Events as `on${Capitalize<Event & string>}`]: (
handler: EventHandler<Events[Event]>,
) => Effect;
}
Expand Down
2 changes: 1 addition & 1 deletion @simulcast/core/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"exports": "./mod.ts",
"name": "@simulcast/core",
"version": "0.9.9"
"version": "0.9.10"
}
5 changes: 4 additions & 1 deletion @simulcast/core/tests/broadcast.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { assert, assertStrictEquals } from "@std/assert";
import { broadcast } from "../broadcast.ts";

const { emitTest, onTest, on, emit } = broadcast<{ test: never }>();
const { emitTest, onTest, on, emit } = broadcast<{
test: never;
other: string;
}>();

const customEmitTest = emit("test");
const customOnTest = on("test");
Expand Down
2 changes: 1 addition & 1 deletion @simulcast/preact/UseBroadcastObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type UseBroadcastObject<Events extends EventTypeDictionary> = Readonly<
* @param handler Function to run when event is emitted.
* @param dependencies Passed directly to the underlying effect.
*/
[Event in keyof Events as `on${Capitalize<keyof Events & string>}`]: (
[Event in keyof Events as `on${Capitalize<Event & string>}`]: (
handler: EventHandler<Events[Event]>,
dependencies?: ReadonlyArray<unknown>,
) => void;
Expand Down
Loading