diff --git a/types/index.d.ts b/types/index.d.ts index 42e945a2..62560ded 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -36,7 +36,7 @@ export interface Processor
extends FrozenProcessor
{
* @typeParam S Plugin settings
*/
use(
- pluginTuple: PluginTuple
+ pluginTuple: PluginTuple | [Plugin, boolean]
): Processor
/** @@ -221,10 +221,7 @@ export interface FrozenProcessor
{
* @typeParam P Processor settings
* @returns Optional Transformer.
*/
-export type Plugin<
- S extends any[] = [Settings?],
- P = Settings
-> = Attacher
+export type Plugin = Attacher
/**
* Configuration passed to a Plugin or Processor
@@ -259,10 +256,10 @@ export interface ProcessorSettings
{
* @typeParam S Plugin settings
* @typeParam P Processor settings
*/
-export type PluginTuple<
- S extends any[] = [Settings?],
- P = Settings
-> = [Plugin, ...S]
+export type PluginTuple = [
+ Plugin,
+ ...S
+]
/**
* A union of the different ways to add plugins to unified
diff --git a/types/unified-tests.ts b/types/unified-tests.ts
index 89652f0d..9b9699e1 100644
--- a/types/unified-tests.ts
+++ b/types/unified-tests.ts
@@ -79,6 +79,8 @@ processor.use([
])
processor.use(plugin, true)
processor.use(plugin, false)
+processor.use([plugin, true])
+processor.use([plugin, false])
processor.use([
[plugin, true],
[plugin, false]
@@ -124,6 +126,14 @@ processor.use([typedPlugin, typedSetting])
processor.use([typedPlugin, typedSetting, settings])
// $ExpectError
processor.use([typedPlugin, settings])
+processor.use(typedPlugin, true)
+processor.use(typedPlugin, false)
+processor.use([typedPlugin, true])
+processor.use([typedPlugin, false])
+processor.use([
+ [typedPlugin, true],
+ [typedPlugin, false]
+])
processor.use(implicitlyTypedPlugin)
processor.use(implicitlyTypedPlugin).use(implicitlyTypedPlugin)