mirror of
https://github.com/hanzoai/postcss.git
synced 2026-09-24 17:01:56 +00:00
Explain how to type plugin options
This commit is contained in:
@@ -108,7 +108,11 @@ In TypeScript, type the creator as `PluginCreator` so `postcss = true` is valid:
|
||||
```ts
|
||||
import type { PluginCreator } from 'postcss'
|
||||
|
||||
const plugin: PluginCreator<object> = (opts = {}) => {
|
||||
export interface PluginNameOptions {
|
||||
// Types for plugin options
|
||||
}
|
||||
|
||||
const plugin: PluginCreator<PluginNameOptions> = (opts = {}) => {
|
||||
return {
|
||||
postcssPlugin: 'PLUGIN NAME'
|
||||
// Plugin listeners
|
||||
|
||||
Reference in New Issue
Block a user