From 4996c21351181228c0e2f08b42f79213199cb04d Mon Sep 17 00:00:00 2001 From: Alvin Leung Date: Thu, 18 Nov 2021 14:31:24 +0000 Subject: [PATCH 1/2] Fix FrozenProcessor.run 3rd overload signature --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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> From 0d589002b9211efc9e33f6798d82bf1eb7f514c7 Mon Sep 17 00:00:00 2001 From: Alvin Leung Date: Thu, 18 Nov 2021 16:58:22 +0000 Subject: [PATCH 2/2] Add tests for FrozenProcessor.run promise variant --- index.test-d.ts | 6 ++++++ 1 file changed, 6 insertions(+) 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) )