-
-
Couldn't load subscription status.
- Fork 136
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
In the file attributes-to-props.d.ts the return types of attributesToProps function is a Object with String items.
html-react-parser/lib/attributes-to-props.d.ts
Lines 3 to 4 in 80bbea0
| export type Attributes = Record<string, string>; | |
| export type Props = Attributes; |
But in the attributesToProps function, setStyleProp is call to transform CSSInline to StyleObject.
| setStyleProp(attributes.style, props); |
The return of the function is an StyleObject and not a String.
html-react-parser/lib/utilities.js
Lines 76 to 87 in 80bbea0
| /** | |
| * Sets style prop. | |
| * | |
| * @param {null|undefined|string} style | |
| * @param {object} props | |
| */ | |
| function setStyleProp(style, props) { | |
| if (style === null || style === undefined) { | |
| return; | |
| } | |
| props.style = styleToJS(style, styleToJSOptions); | |
| } |
The result of this miss-typing is an error if you would like to get an CSSProperty.
Expected Behavior
Update attributes-to-props.d.ts with :
export type Attributes = Record<string, string>;
export type Props = Record<string, string> & {
style: Record<string, string>;
}; amehat, ludovicmnji and apascal
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
