Html-react-parser: attributesToProps 的返回类型错误

创建于 2021-04-16  ·  5评论  ·  资料来源: remarkablemark/html-react-parser

描述

在文件attributes-to-props.d.ts的返回类型attributesToProps功能是ObjectString项目。

https://github.com/remarkablemark/html-react-parser/blob/80bbea06fac6825f2667060f979fbd54b407e748/lib/attributes-to-props.d.ts#L3 -L4

但是在attributesToProps函数中,调用setStylePropCSSInlineStyleObject

https://github.com/remarkablemark/html-react-parser/blob/80bbea06fac6825f2667060f979fbd54b407e748/lib/attributes-to-props.js#L62

函数的返回是StyleObject而不是String

https://github.com/remarkablemark/html-react-parser/blob/80bbea06fac6825f2667060f979fbd54b407e748/lib/utilities.js#L76 -L87

如果您想获得CSSProperty则此错误输入的结果是错误。

Capture d’écran 2021-04-16 à 10 42 51

预期行为

更新attributes-to-props.d.ts为:

export type Attributes = Record<string, string>; 
export type Props = Record<string, string> & {
  style: Record<string, string>;
}; 

所有5条评论

感谢您创建此问题@EoleO。 你想开PR吗?

@EoleO请查看 #245

感谢您的响应

@EoleO当然,如果您仍然遇到问题,请随时重新打开。

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

lhtdesignde picture lhtdesignde  ·  9评论

shiglet picture shiglet  ·  6评论

ollie-o picture ollie-o  ·  3评论

on2air picture on2air  ·  3评论

linkelvin11 picture linkelvin11  ·  4评论