unified()
.use(remarkParse)
.use(remarkShikiTwoslash)
.use(remarkRehype)
// ^^^^^^^^^^^^
// Argument of type 'Plugin<[] | [Processor<any, any, any, any>, (Options | undefined)?] | [null | undefined, (Options | undefined)?] | [Options], Root, Root>' is not assignable to parameter of type 'Preset | PluggableList'.ts(2345)
.use(rehypeStringify)
.process("# Hello World");
According to the unified document, remarkShikiTwoslash function should be declared as a Plugin type, which returns a Transformer type, so that subsequent use methods can correctly infer the type.
Example code:
According to the unified document,
remarkShikiTwoslash
function should be declared as aPlugin
type, which returns aTransformer
type, so that subsequentuse
methods can correctly infer the type.Source code from unified: https://github.com/unifiedjs/unified/blob/main/index.d.ts#L527