diff --git a/types/index.d.ts b/types/index.d.ts
index a8f35f70..5d33cd77 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -1,4 +1,4 @@
-// TypeScript Version: 3.0
+// TypeScript Version: 3.4
import {Node} from 'unist'
import {VFile, VFileContents, VFileOptions} from 'vfile'
@@ -23,15 +23,12 @@ declare namespace unified {
*
* @param plugin unified plugin
* @param settings Configuration for plugin
- * @param extraSettings Additional configuration for plugin
* @typeParam S Plugin settings
- * @typeParam S2 Extra plugin settings
* @returns The processor on which use is invoked
*/
- use(
- plugin: Plugin,
- settings?: S,
- extraSettings?: S2
+ use(
+ plugin: Plugin,
+ ...settings: S
): Processor
/** @@ -39,17 +36,16 @@ declare namespace unified { * * @param preset `Object` with an plugins (set to list), and/or an optional settings object */ - use(preset: Preset
): Processor
+ use(preset: Preset): Processor
/**
* Configure using a tuple of plugin and setting(s)
*
* @param pluginTuple pairs, plugin and settings in an array
* @typeParam S Plugin settings
- * @typeParam S2 Extra plugin settings
*/
- use(
- pluginTuple: PluginTuple
+ use(
+ pluginTuple: PluginTuple
): Processor
/**
@@ -214,13 +210,11 @@ declare namespace unified {
*
* @this Processor context object is set to the invoked on processor.
* @param settings Configuration
- * @param extraSettings Secondary configuration
* @typeParam S Plugin settings
- * @typeParam S2 Extra plugin settings
* @typeParam P Processor settings
* @returns Optional Transformer.
*/
- type Plugin = Attacher
+ type Plugin = Attacher
/**
* Configuration passed to a Plugin or Processor
@@ -235,7 +229,7 @@ declare namespace unified {
*
* @typeParam P Processor settings
*/
- interface Preset
{
+ interface Preset {
plugins: PluggableList
settings?: Settings
}
@@ -253,31 +247,35 @@ declare namespace unified {
* A pairing of a plugin with its settings
*
* @typeParam S Plugin settings
- * @typeParam S2 Extra plugin settings
* @typeParam P Processor settings
*/
- type PluginTuple =
- | [Plugin, S]
- | [Plugin, S, S2]
+ type PluginTuple = [
+ Plugin,
+ /**
+ * NOTE: ideally this would be S instead of any[]
+ * As of TypeScript 3.5.2 generic tuples cannot be spread
+ * See: https://github.com/microsoft/TypeScript/issues/26113
+ */
+ ...any[]
+ ]
/**
* A union of the different ways to add plugins to unified
*
* @typeParam S Plugin settings
- * @typeParam S2 Extra plugin settings
* @typeParam P Processor settings
*/
- type Pluggable =
- | Plugin
- | Preset
- | PluginTuple
+ type Pluggable =
+ | Plugin
+ | Preset
+ | PluginTuple
/**
* A list of plugins and presets
*
* @typeParam P Processor settings
*/
- type PluggableList
= Array = Array , settings?: S, extraSettings?: S2): Transformer | void
+ interface Attacher , ...settings: S): Transformer | void
}
/**
diff --git a/types/unified-tests.ts b/types/unified-tests.ts
index 757d7125..22d34785 100644
--- a/types/unified-tests.ts
+++ b/types/unified-tests.ts
@@ -30,7 +30,7 @@ const settings = {
interface ExamplePluginSettings {
example: string
}
-const typedPlugin: Plugin {
- (this: Processor {
+ (this: Processor