Skip to content

Commit b6a3b10

Browse files
refactor(themes): Improve createTheme to use themeParams and update types (#6778)
1 parent 428cd57 commit b6a3b10

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

.changeset/young-beds-sing.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/themes': patch
3+
---
4+
5+
Improve return type of createTheme

packages/themes/src/createTheme.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Temp way to import the type. We will clean this up when we extract
22
// theming into its own package
3-
import type { Appearance, BaseTheme, DeepPartial, Elements, Theme } from '@clerk/types';
3+
import type { BaseTheme, DeepPartial, Elements, Theme } from '@clerk/types';
44

55
import type { InternalTheme } from '../../clerk-js/src/ui/foundations';
66

7-
interface CreateClerkThemeParams extends DeepPartial<Theme> {
7+
interface CreateClerkThemeParams extends DeepPartial<Theme>, Pick<BaseTheme, 'cssLayerName'> {
88
/**
99
* Optional name for the theme, used for telemetry and debugging.
1010
* @example 'shadcn', 'neobrutalism', 'custom-dark'
@@ -17,10 +17,10 @@ interface CreateClerkThemeParams extends DeepPartial<Theme> {
1717
elements?: Elements | ((params: { theme: InternalTheme }) => Elements);
1818
}
1919

20-
export const experimental_createTheme = (appearance: Appearance<CreateClerkThemeParams>): BaseTheme => {
20+
export const experimental_createTheme = (themeParams: CreateClerkThemeParams) => {
2121
// Placeholder method that might hande more transformations in the future
2222
return {
23-
...appearance,
24-
__type: 'prebuilt_appearance',
23+
...themeParams,
24+
__type: 'prebuilt_appearance' as const,
2525
};
2626
};

0 commit comments

Comments
 (0)