我在我的react项目中使用了typescript,但是当我使用这个代码片段时,我得到了一个错误
<ReactMarkdown rehypePlugins={[rehypeRaw]}>
{content}
</ReactMarkdown>
Type '(options?: void | Options | undefined) => void | Transformer<Root, Root>' is not assignable to type 'Pluggable<any[], Settings>'.
Type '(options?: void | Options | undefined) => void | Transformer<Root, Root>' is not assignable to type 'Plugin<any[], Settings>'.
Type 'void | Transformer<Root, Root>' is not assignable to type 'void | Transformer'.
Type 'Transformer<Root, Root>' is not assignable to type 'void | Transformer'.
Type 'Transformer<Root, Root>' is not assignable to type 'Transformer'.
Types of parameters 'node' and 'node' are incompatible.
字符串
有什么想法关于这个类型的错误吗?
1条答案
按热度按时间1cosmwyk1#
我得到了同样的错误。我通过为
rehypePlugins
添加类型Assertas any
来修复它。字符串
它现在起作用了。希望它对你也起作用。