diff --git a/index.d.ts b/index.d.ts index 0412600c..7fdbb721 100644 --- a/index.d.ts +++ b/index.d.ts @@ -316,7 +316,7 @@ export interface FrozenProcessor< * Promise that resolves to the resulting tree. */ run( - node: Specific, + node: Specific, file?: VFileCompatible | undefined ): Promise> diff --git a/index.test-d.ts b/index.test-d.ts index ede2233b..e5cf2211 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -360,13 +360,19 @@ expectType( ) // A parser plugin defines the input of `.run`: +expectType>(unified().use(remarkParse).run(someMdast)) expectType(unified().use(remarkParse).runSync(someMdast)) +expectError(unified().use(remarkParse).run(someHast)) expectError(unified().use(remarkParse).runSync(someHast)) // A compiler plugin defines the input/output of `.run`: +expectError(unified().use(rehypeStringify).run(someMdast)) expectError(unified().use(rehypeStringify).runSync(someMdast)) // As a parser and a compiler are set, it can be assumed that the input of `run` // is the result of the parser, and the output is the input of the compiler. +expectType>( + unified().use(remarkParse).use(rehypeStringify).run(someMdast) +) expectType( unified().use(remarkParse).use(rehypeStringify).runSync(someMdast) )