diff --git a/src/lib/merge-configs.ts b/src/lib/merge-configs.ts index eb7a2573..c3d41dd2 100644 --- a/src/lib/merge-configs.ts +++ b/src/lib/merge-configs.ts @@ -6,16 +6,16 @@ import { Config, ConfigExtension } from './types' */ export function mergeConfigs( baseConfig: Config, - { cacheSize, prefix, separator, extend = {}, ...configOverride }: ConfigExtension, + { cacheSize, prefix, separator, extend = {}, override = {} }: ConfigExtension, ) { overrideProperty(baseConfig, 'cacheSize', cacheSize) overrideProperty(baseConfig, 'prefix', prefix) overrideProperty(baseConfig, 'separator', separator) - for (const configKey in configOverride) { + for (const configKey in override) { overrideConfigProperties( - baseConfig[configKey as keyof typeof configOverride], - configOverride[configKey as keyof typeof configOverride], + baseConfig[configKey as keyof typeof override], + override[configKey as keyof typeof override], ) } diff --git a/src/lib/types.ts b/src/lib/types.ts index d3525733..3bee64a0 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -1,4 +1,6 @@ -export interface Config { +export interface Config extends ConfigStatic, ConfigGroups {} + +interface ConfigStatic { /** * Integer indicating size of LRU cache used for memoizing results. * - Cache might be up to twice as big as `cacheSize` @@ -19,6 +21,13 @@ export interface Config { * Theme scales used in classGroups. * The keys are the same as in the Tailwind config but the values are sometimes defined more broadly. */ +} + +interface ConfigGroups { + /** + * Theme scales used in classGroups. + * The keys are the same as in the Tailwind config but the values are sometimes defined more broadly. + */ theme: ThemeObject /** * Object with groups of classes. @@ -46,15 +55,9 @@ export interface Config { conflictingClassGroupModifiers: Record } -export type ConfigExtend = Partial< - Pick< - Config, - 'theme' | 'classGroups' | 'conflictingClassGroups' | 'conflictingClassGroupModifiers' - > -> - -export interface ConfigExtension extends Partial { - extend?: ConfigExtend +export interface ConfigExtension extends Partial { + override?: Partial + extend?: Partial } export type ThemeObject = Record