Skip to content

Commit c4fe54a

Browse files
authored
fix: Fix TypeScript type declaration (#516)
- Export the react-element-to-jsx-string options type - Fix the `filterProps` parameters
1 parent e583fa6 commit c4fe54a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

index.d.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
declare module 'react-element-to-jsx-string' {
22
import { ReactNode } from 'react';
33

4+
type FilterPropsFunction = (value: any, key: string) => boolean
5+
46
interface ReactElementToJSXStringOptions {
57
displayName?: (element: ReactNode) => string;
6-
filterProps?: string[];
8+
filterProps?: string[] | FilterPropsFunction;
79
showDefaultProps?: boolean;
810
showFunctions?: boolean;
911
functionValue?: (fn: any) => any;
@@ -15,5 +17,8 @@ declare module 'react-element-to-jsx-string' {
1517
}
1618

1719
const reactElementToJSXString: (element: ReactNode, options?: ReactElementToJSXStringOptions) => string;
18-
export = reactElementToJSXString;
20+
21+
export { ReactElementToJSXStringOptions as Options };
22+
23+
export default reactElementToJSXString;
1924
}

0 commit comments

Comments
 (0)