export type Styles = Either.Either<TokenError, CSSObjectWithTokens>;
export const mergeStyles = (...styles: Styles[]): Styles =>
styles.reduce(
(acc, item) =>
pipe(
acc,
Either.flatMap((unpackedA) =>
pipe(
item,
Either.map((unpackedB) => ({ ...unpackedA, ...unpackedB }))
)
)
),
Either.right({}) as Styles
);
export type Styles = Either.Either<TokenError, CSSObjectWithTokens>;
export const mergeStyles = (...styles: Styles[]): Styles =>
styles.reduce(
(acc, item) =>
pipe(
acc,
Either.flatMap((unpackedA) =>
pipe(
item,
Either.map((unpackedB) => ({ ...unpackedA, ...unpackedB }))
)
)
),
Either.right({}) as Styles
);