Skip to content

Commit

Permalink
fix: refactor TypeScript declaration file for index.d.ts
Browse files Browse the repository at this point in the history
The script `npm run dtslint` was returning the error:

```
ERROR: 5:1  expect  TypeScript@next expected type to be:
  string | DetailedReactHTMLElement<{}, HTMLElement> | DetailedReactHTMLElement<{}, HTMLElement>[]
got:
  string | ReactElement | ReactElement[]
```
  • Loading branch information
remarkablemark committed Oct 3, 2019
1 parent b49ee28 commit f1fc00b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ import { DomElement } from 'domhandler';
import domToReact from './lib/dom-to-react';
import htmlToDOM from 'html-dom-parser';

export { DomElement };

type ReactElement = React.DetailedReactHTMLElement<{}, HTMLElement>;

export interface HTMLReactParserOptions {
// TODO: Replace `object` by type for objects like `{ type: 'h1', props: { children: 'Heading' } }`
replace(domNode: DomElement): React.ReactElement | object | undefined | false;
Expand All @@ -24,7 +20,11 @@ export interface HTMLReactParserOptions {
declare function HTMLReactParser(
html: string,
options?: HTMLReactParserOptions
): ReactElement | ReactElement[] | string;
):
| string
| React.DetailedReactHTMLElement<{}, HTMLElement>
| Array<React.DetailedReactHTMLElement<{}, HTMLElement>>;

export { DomElement, domToReact, htmlToDOM };

export { domToReact, htmlToDOM };
export default HTMLReactParser;

0 comments on commit f1fc00b

Please sign in to comment.