Fix Plugin type issue (#14668)
This is a quick fix to an issue where the types for PluginsConfig don't match those used in plugins like [`@tailwindcss/container-queries`](https://github.com/tailwindlabs/tailwindcss-container-queries). This was caught by TypeScript with [`exactOptionalPropertyTypes`]( https://www.typescriptlang.org/tsconfig/exactOptionalPropertyTypes.html) enabled, where TypeScript checks if `undefined` can be supplied as a value for optional types. I felt that it made more sense to fix this here, as it makes the core types more flexible, as opposed to each plugin needing to fix this when/if they hit it. --------- Co-authored-by: Philipp Spiess <hello@philippspiess.com>
This commit is contained in:
parent
6069a81187
commit
2702cfcc2c
2 changed files with 8 additions and 3 deletions
|
|
@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
- Nothing yet!
|
||||
### Fixed
|
||||
|
||||
- Ensure the TypeScript types for `PluginsConfig` allow `undefined` values ([#14668](https://github.com/tailwindlabs/tailwindcss/pull/14668))
|
||||
|
||||
## [3.4.15] - 2024-11-14
|
||||
|
||||
|
|
|
|||
7
types/config.d.ts
vendored
7
types/config.d.ts
vendored
|
|
@ -344,9 +344,12 @@ export interface PluginAPI {
|
|||
export type PluginCreator = (api: PluginAPI) => void
|
||||
export type PluginsConfig = (
|
||||
| PluginCreator
|
||||
| { handler: PluginCreator; config?: Partial<Config> }
|
||||
| { handler: PluginCreator; config?: Partial<Config> | undefined }
|
||||
| {
|
||||
(options: any): { handler: PluginCreator; config?: Partial<Config> }
|
||||
(options: any): {
|
||||
handler: PluginCreator;
|
||||
config?: Partial<Config> | undefined;
|
||||
};
|
||||
__isOptionsFunction: true
|
||||
}
|
||||
)[]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue