Skip to content

Commit 350ed9d

Browse files
authored
Fix next in types of transformer signature
Closes GH-149. Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
1 parent 6ef3933 commit 350ed9d

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

types/index.d.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,7 @@ export type Attacher<S extends any[] = [Settings?], P = Settings> = (
313313
export type Transformer = (
314314
node: Node,
315315
file: VFile,
316-
next: (
317-
error: Error | null,
318-
tree?: Node,
319-
file?: VFile
320-
) => Record<string, unknown>
316+
next: (error?: Error | null, tree?: Node, file?: VFile) => void
321317
) => Error | Node | Promise<Node> | void | Promise<void>
322318

323319
/**

types/unified-tests.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,24 +165,27 @@ processor.use(
165165
(
166166
tree: Node,
167167
file: VFile,
168-
next: (error: Error | null, tree: Node, file: VFile) => {}
168+
next: (error: Error | null, tree: Node, file: VFile) => void
169169
) => {}
170170
)
171171
processor.use(
172172
() =>
173173
(
174174
tree: Node,
175175
file: VFile,
176-
next: (error: Error | null, tree: Node) => {}
176+
next: (error: Error | null, tree: Node) => void
177177
) => {}
178178
)
179179
processor.use(
180-
() => (tree: Node, file: VFile, next: (error: Error | null) => {}) => {}
180+
() => (tree: Node, file: VFile, next: (error: Error | null) => void) => {}
181181
)
182182
processor.use(
183183
// $ExpectError
184184
() => (tree: Node, file: VFile, next: () => {}) => {}
185185
)
186+
processor.use(() => (tree: Node, file: VFile, next: () => void) => {
187+
next()
188+
})
186189

187190
processor.use(pluginWithTwoSettings)
188191
processor.use(pluginWithTwoSettings).use(pluginWithTwoSettings)

0 commit comments

Comments
 (0)