Skip to content

Commit

Permalink
refactor: add type validation for the cssVariables configuration pa…
Browse files Browse the repository at this point in the history
…rameter
  • Loading branch information
cheton committed Nov 29, 2024
1 parent 6b4e3e8 commit 398f5e7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/react/src/theme/createTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ const createTheme = (options = {}, ...args) => {
theme = args.reduce((acc, arg) => merge(acc, arg), theme);

if (cssVariableConfig) {
if (typeof cssVariableConfig !== 'boolean' && typeof cssVariableConfig !== 'object') {
throw new Error('The `cssVariables` config must be a boolean or an object');

Check warning on line 30 in packages/react/src/theme/createTheme.js

View check run for this annotation

Codecov / codecov/patch

packages/react/src/theme/createTheme.js#L30

Added line #L30 was not covered by tests
}

// Determine the prefix for CSS variables:
// - Uses the `prefix` property if provided (e.g., `createTheme({ cssVariables: { prefix: 'tonic' } })`).
// - Defaults to `defaultCSSVariablePrefix` if no custom prefix is specified.
Expand Down

0 comments on commit 398f5e7

Please sign in to comment.