Html-react-parser: أنواع الإرجاع الخاطئة في attributesToProps

تم إنشاؤها على ١٦ أبريل ٢٠٢١  ·  5تعليقات  ·  مصدر: remarkablemark/html-react-parser

وصف

في الملف attributes-to-props.d.ts أنواع الإرجاع للوظيفة attributesToProps هي Object مع String العناصر.

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

ولكن في الدالة attributesToProps ، فإن setStyleProp هو استدعاء لتحويل CSSInline إلى StyleObject .

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

ال 5 كومينتر

شكرًا على إنشاء هذه المشكلةEoleO. هل ترغب في فتح علاقات عامة؟

EoleO يرجى مراجعة # 245

شكرا لاستجابتك

EoleO بالطبع ، لا تتردد في إعادة

هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات