Html-react-parser: Types de retour incorrects sur les attributsToProps

Créé le 16 avr. 2021  ·  5Commentaires  ·  Source: remarkablemark/html-react-parser

La description

Dans le fichier attributes-to-props.d.ts le type de retour de la fonction attributesToProps est un Object avec des éléments String .

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

Mais dans la fonction attributesToProps , setStyleProp est appelé pour transformer CSSInline en StyleObject .

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

Le retour de la fonction est un StyleObject et non un String .

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

Le résultat de cette erreur de frappe est une erreur si vous souhaitez obtenir un CSSProperty .

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

Comportement prévisible

Mettre attributes-to-props.d.ts jour

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

Tous les 5 commentaires

Merci d'avoir créé ce numéro @EoleO. Souhaitez-vous ouvrir un PR?

@EoleO s'il vous plaît revoir #245

Publié v1.2.6 :

npm :

npm i [email protected]

Fil :

yarn add [email protected]

Merci pour votre réactivité

@EoleO Bien sûr, n'hésitez pas à rouvrir si vous rencontrez toujours un problème.

Cette page vous a été utile?
0 / 5 - 0 notes

Questions connexes

linkurzweg picture linkurzweg  ·  8Commentaires

alizeaiter picture alizeaiter  ·  3Commentaires

christianfredh picture christianfredh  ·  5Commentaires

jerome-diver picture jerome-diver  ·  9Commentaires

danielimmke picture danielimmke  ·  4Commentaires