Skip to content

Commit

Permalink
Make the returned layers resolver typed
Browse files Browse the repository at this point in the history
  • Loading branch information
rcj-siteimprove committed Dec 12, 2024
1 parent f4521be commit 2430748
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
5 changes: 1 addition & 4 deletions packages/alfa-style/src/property/mask-position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ export default Longhand.of<Specified, Computed>(
List.of([initialItem], ", "),
parseList,
(value, style) => {
const layers = Resolver.layers<Position.PartiallyResolved>(
style,
"mask-image",
);
const layers = Resolver.layers(style, "mask-image");

return value.map((positions) =>
layers(
Expand Down
2 changes: 1 addition & 1 deletion packages/alfa-style/src/property/mask-size.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default Longhand.of<Specified, Computed>(
List.of([initialItem], ", "),
parseList,
(value, style) => {
const layers = Resolver.layers<Specified.Item>(style, "mask-image");
const layers = Resolver.layers(style, "mask-image");

return value.map((sizes) =>
layers(
Expand Down
6 changes: 3 additions & 3 deletions packages/alfa-style/src/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ export namespace Resolver {
*
* @internal
*/
export function layers<V extends Value>(
export function layers(
style: Style,
name: "mask-image" | "background-image",
): Mapper<List<V>, List<V>> {
return (value) =>
) {
return <V extends Value>(value: List<V>): List<V> =>
value.cutOrExtend(Math.max(style.computed(name).value.size, 1));
}
}

0 comments on commit 2430748

Please sign in to comment.