Skip to content

Wrong return types on attributesToProps #242

Closed
@EoleO

Description

@EoleO

Description

In the file attributes-to-props.d.ts the return types of attributesToProps function is a Object with String items.

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.

/**
* 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.

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

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>;
}; 

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions