diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f1a3a96f39e..a450dc6b7200 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix `foo-[abc]/[def]` not being handled correctly ([#9866](https://github.com/tailwindlabs/tailwindcss/pull/9866)) - Add container queries plugin to standalone CLI ([#9865](https://github.com/tailwindlabs/tailwindcss/pull/9865)) - Support renaming of output files by `PostCSS` plugin. ([#9944](https://github.com/tailwindlabs/tailwindcss/pull/9944)) +- Improve return value of `resolveConfig`, unwrap `ResolvableTo` ([#9972](https://github.com/tailwindlabs/tailwindcss/pull/9972)) ## [3.2.4] - 2022-11-11 diff --git a/resolveConfig.d.ts b/resolveConfig.d.ts index e2f5f0f9f3f0..2402a267e8cd 100644 --- a/resolveConfig.d.ts +++ b/resolveConfig.d.ts @@ -1,3 +1,12 @@ -import type { Config } from './types/config' -declare function resolveConfig(config: Config): Config +import type { Config, ResolvableTo } from './types/config' + +type UnwrapResolvables = { + [K in keyof T]: T[K] extends ResolvableTo ? R : T[K] +} + +type ResolvedConfig = Omit & { + theme: UnwrapResolvables +} + +declare function resolveConfig(config: T): ResolvedConfig export = resolveConfig diff --git a/types/config.d.ts b/types/config.d.ts index 34e1621cf069..b4b24a4a0809 100644 --- a/types/config.d.ts +++ b/types/config.d.ts @@ -11,7 +11,7 @@ type KeyValuePair = Record interface RecursiveKeyValuePair { [key: string]: V | RecursiveKeyValuePair } -type ResolvableTo = T | ((utils: PluginUtils) => T) +export type ResolvableTo = T | ((utils: PluginUtils) => T) type CSSRuleObject = RecursiveKeyValuePair interface PluginUtils {