Skip to content

refactor: collapse duplicate cn helpers into canonical lib/utils/cn.ts (Closes #1421) - #1620

Open
waterWang wants to merge 1 commit into
Remitwise-Org:mainfrom
waterWang:refactor/collapse-cn-helpers-1421
Open

refactor: collapse duplicate cn helpers into canonical lib/utils/cn.ts (Closes #1421)#1620
waterWang wants to merge 1 commit into
Remitwise-Org:mainfrom
waterWang:refactor/collapse-cn-helpers-1421

Conversation

@waterWang

Copy link
Copy Markdown
Contributor

Summary

Collapses the three duplicate Tailwind classnames helpers into a single canonical implementation.

What changed

  • lib/utils/cn.ts — kept as the single source of truth (it already has the best JSDoc/typing).
  • lib/utils.ts — now re-exports cn from ./utils/cn instead of duplicating the twMerge(clsx(...)) body.
  • lib/utils/index.ts — now re-exports cn from ./cn instead of duplicating it.

Previously all three files defined their own cn function with slightly different typing (ClassValue[] vs Parameters<typeof clsx>). This is a runtime no-op: the re-export resolves to the exact same implementation.

Verification

  • lib/utils/cn.test.ts — 3 tests pass
  • tests/unit/utils/utils.test.ts — 2 tests pass
  • Runtime behavior unchanged (diff is a no-op at runtime)

Closes #1421

Closes Remitwise-Org#1421)

Collapse the three identical Tailwind classnames helpers into a single
canonical implementation in lib/utils/cn.ts. lib/utils.ts and
lib/utils/index.ts now re-export from it instead of duplicating the
same twMerge(clsx(...)) logic.

Runtime behavior is unchanged; all cn-related tests pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: collapse two identical Tailwind classnames helpers

1 participant