Skip to content

fix: simplify mergeStyles argument type#36215

Open
15MariamS wants to merge 1 commit into
microsoft:masterfrom
15MariamS:fix/31477-merge-styles-ts2589
Open

fix: simplify mergeStyles argument type#36215
15MariamS wants to merge 1 commit into
microsoft:masterfrom
15MariamS:fix/31477-merge-styles-ts2589

Conversation

@15MariamS
Copy link
Copy Markdown
Contributor

@15MariamS 15MariamS commented May 18, 2026

Previous Behavior

mergeStyles defined its public style argument type as a union of IStyle, IStyleBaseArray, and falsey values. IStyle already includes those same falsey values and recursively includes IStyleBaseArray, so TypeScript had duplicate recursive paths to expand.

New Behavior

mergeStyles now aliases its style argument type directly to IStyle, preserving the same accepted inputs while reducing unnecessary recursive type expansion. This helps avoid excessive type instantiation errors from the public overloads.

Validation

  • PATH=/opt/homebrew/Cellar/node@22/22.22.0/bin:$PATH node node_modules/typescript/bin/tsc -p packages/merge-styles/tsconfig.json --noEmit --skipLibCheck
  • git diff --check

Note: beachball check and the Jest command could not run in this local checkout because the dependency install left missing files inside node_modules.

Related Issue(s)

@15MariamS 15MariamS marked this pull request as ready for review May 20, 2026 20:40
@15MariamS 15MariamS requested review from a team and dzearing as code owners May 20, 2026 20:40
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.

[Bug]: mergeStyles types lead to "error TS2589: Type instantiation is excessively deep and possibly infinite"

1 participant