Html-react-parser: Falsche Rückgabetypen für AttributeToProps

Erstellt am 16. Apr. 2021  ·  5Kommentare  ·  Quelle: remarkablemark/html-react-parser

Beschreibung

In der Datei attributes-to-props.d.ts der Rückgabetyp der Funktion attributesToProps ein Object mit String Elementen.

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

Aber in der Funktion attributesToProps wird setStyleProp aufgerufen, um CSSInline in StyleObject umzuwandeln.

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

Die Rückgabe der Funktion ist ein StyleObject und kein String .

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

Das Ergebnis dieser Fehleingabe ist ein Fehler, wenn Sie CSSProperty möchten.

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

Erwartetes Verhalten

attributes-to-props.d.ts mit:

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

Alle 5 Kommentare

Danke für die Erstellung dieses Problems @EoleO. Möchten Sie eine PR eröffnen?

@EoleO bitte überprüfen #245

Veröffentlicht v1.2.6 :

npm :

npm i [email protected]

Garn :

yarn add [email protected]

Vielen Dank für Ihre Reaktionsfähigkeit

@EoleO Natürlich können Sie auftritt .

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen

Verwandte Themen

rgavinc picture rgavinc  ·  4Kommentare

frontendpm picture frontendpm  ·  4Kommentare

linkurzweg picture linkurzweg  ·  8Kommentare

danielimmke picture danielimmke  ·  4Kommentare

shiglet picture shiglet  ·  6Kommentare