From 783b32305fd0169763b19c67cfaafbf2f11a6ccf Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Fri, 6 Sep 2024 16:10:18 -0400 Subject: [PATCH] Export `Config` type (#14360) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Right now the following does not work and instead produces a type error: ``` import { type Config } from 'tailwindcss' export default { // … config here } satisfies Config ``` We were not exporting a `Config` type but thankfully this already exists in the codebase so we just need to export it. It does _not_ have all properties of an existing config as not all features have been implemented (or in some cases necessary / relevant for v4). Notably missing are: - `important` - `prefix` - `separator` - `safelist` - `blocklist` - `future` - `experimental` - `corePlugins` Also, explicit keys for theme are not currently specified but we should probably bring this back even if just as an auto-complete aid. --- CHANGELOG.md | 1 + packages/tailwindcss/src/index.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 209d999c7..490f1ff42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Support CSS `theme()` functions inside other `@custom-media`, `@container`, and `@supports` rules ([#14358])(https://github.com/tailwindlabs/tailwindcss/pull/14358) +- Export `Config` type from `tailwindcss` for JS config files ([#14360])(https://github.com/tailwindlabs/tailwindcss/pull/14360) ### Fixed diff --git a/packages/tailwindcss/src/index.ts b/packages/tailwindcss/src/index.ts index fe68936ff..87b2b467e 100644 --- a/packages/tailwindcss/src/index.ts +++ b/packages/tailwindcss/src/index.ts @@ -9,6 +9,7 @@ import { buildDesignSystem, type DesignSystem } from './design-system' import { registerPlugins, type CssPluginOptions, type Plugin } from './plugin-api' import { Theme, ThemeOptions } from './theme' import { segment } from './utils/segment' +export type Config = UserConfig const IS_VALID_UTILITY_NAME = /^[a-z][a-zA-Z0-9/%._-]*$/