Skip to content

Commit

Permalink
Make Config completely optional for plugins (#9502)
Browse files Browse the repository at this point in the history
* Make `Config` completely optional for plugins

Right now the `Config` type requires a `content` key. However, for plugins, this should be completely optional. There’s little reason for a plugin to override content. All other keys are already optional by virtue of using `Partial<…>` so we’ll do the same for the `Config` type used by plugins.

* Update changelog
  • Loading branch information
thecrypticace committed Oct 7, 2022
1 parent e7b4d33 commit 56d9c43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -44,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Ignore unset values (like `null` or `undefined`) when resolving the classList for intellisense ([#9385](https://github.com/tailwindlabs/tailwindcss/pull/9385))
- Implement fallback plugins when arbitrary values result in css from multiple plugins ([#9376](https://github.com/tailwindlabs/tailwindcss/pull/9376))
- Improve type checking for formal syntax ([#9349](https://github.com/tailwindlabs/tailwindcss/pull/9349), [#9448](https://github.com/tailwindlabs/tailwindcss/pull/9448))
- Don't require `content` key in custom plugin configs ([#9502](https://github.com/tailwindlabs/tailwindcss/pull/9502))

## [3.1.8] - 2022-08-05

Expand Down
6 changes: 3 additions & 3 deletions plugin.d.ts
Expand Up @@ -2,9 +2,9 @@ import type { Config, PluginCreator } from './types/config'
type Plugin = {
withOptions<T>(
plugin: (options: T) => PluginCreator,
config?: (options: T) => Config
): { (options: T): { handler: PluginCreator; config?: Config }; __isOptionsFunction: true }
(plugin: PluginCreator, config?: Config): { handler: PluginCreator; config?: Config }
config?: (options: T) => Partial<Config>
): { (options: T): { handler: PluginCreator; config?: Partial<Config> }; __isOptionsFunction: true }
(plugin: PluginCreator, config?: Partial<Config>): { handler: PluginCreator; config?: Partial<Config> }
}

declare const plugin: Plugin
Expand Down

0 comments on commit 56d9c43

Please sign in to comment.