html-react-parser 5.0.0 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -437,6 +437,20 @@ Migrated to TypeScript. CommonJS imports require the `.default` key:
437
437
  const parse = require('html-react-parser').default;
438
438
  ```
439
439
 
440
+ If you're getting the error:
441
+
442
+ ```
443
+ Argument of type 'ChildNode[]' is not assignable to parameter of type 'DOMNode[]'.
444
+ ```
445
+
446
+ Then use type assertion:
447
+
448
+ ```ts
449
+ domToReact(domNode.children as DOMNode[], options);
450
+ ```
451
+
452
+ See [#1126](https://github.com/remarkablemark/html-react-parser/issues/1126#issuecomment-1784188447).
453
+
440
454
  ### v4
441
455
 
442
456
  [htmlparser2](https://github.com/fb55/htmlparser2) has been upgraded to [v9](https://github.com/fb55/htmlparser2/releases/tag/v9.0.0).
@@ -2662,9 +2662,8 @@
2662
2662
  var hasReplace = typeof (options === null || options === void 0 ? void 0 : options.replace) === 'function';
2663
2663
  var transform = (options === null || options === void 0 ? void 0 : options.transform) || utilities_1.returnFirstArg;
2664
2664
  var _a = (options === null || options === void 0 ? void 0 : options.library) || React, cloneElement = _a.cloneElement, createElement = _a.createElement, isValidElement = _a.isValidElement;
2665
- var index = 0;
2666
2665
  var nodesLength = nodes.length;
2667
- for (; index < nodesLength; index++) {
2666
+ for (var index = 0; index < nodesLength; index++) {
2668
2667
  var node = nodes[index];
2669
2668
  // replace with custom React element (if present)
2670
2669
  if (hasReplace) {
@@ -2709,7 +2708,7 @@
2709
2708
  else if (element.attribs) {
2710
2709
  props = (0, attributes_to_props_1.default)(element.attribs, element.name);
2711
2710
  }
2712
- var children = null;
2711
+ var children = void 0;
2713
2712
  switch (node.type) {
2714
2713
  case 'script':
2715
2714
  case 'style':