2.0.6 • Published 5 months ago

@types/react-html-parser v2.0.6

Weekly downloads
44,328
License
MIT
Repository
github
Last release
5 months ago

Installation

npm install --save @types/react-html-parser

Summary

This package contains type definitions for react-html-parser (https://github.com/wrakky/react-html-parser#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-html-parser.

index.d.ts

// Type definitions for react-html-parser 2.0
// Project: https://github.com/wrakky/react-html-parser#readme
// Definitions by: Spencer Elliott <https://github.com/elliottsj>
//                 Wooram Jun <https://github.com/chatoo2412>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8

import { ReactElement } from "react";
import { DomElement } from "htmlparser2";

export interface Transform {
    (node: DomElement, index: number, transform?: Transform): ReactElement | void | null;
}

export interface Options {
    decodeEntities?: boolean | undefined;
    transform?: Transform | undefined;
    preprocessNodes?(nodes: DomElement[]): any;
}

export function convertNodeToElement(
    node: DomElement,
    index: number,
    transform: Transform,
): ReactElement;

export function processNodes(nodes: DomElement[], transform: Transform): ReactElement[];

export default function HtmlParser(html: string, options?: Options): ReactElement[];

Additional Details

Credits

These definitions were written by Spencer Elliott, and Wooram Jun.