Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import formatTree from './formatter/formatTree';
import parseReactElement from './parser/parseReactElement';
import type { Element as ReactElement } from 'react';
import type { Options } from './options';
import type { OptionParams } from './options';

const reactElementToJsxString = (
element: ReactElement<any>,
Expand All @@ -18,7 +18,7 @@ const reactElementToJsxString = (
sortProps = true,
maxInlineAttributesLineLength,
displayName,
}: Options = {}
}: OptionParams = {}
) => {
if (!element) {
throw new Error('react-element-to-jsx-string: Expected a ReactElement');
Expand Down
16 changes: 15 additions & 1 deletion src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,25 @@

import * as React from 'react';

export type OptionParams = {|
filterProps?: string[],
showDefaultProps?: boolean,
showFunctions?: boolean,
functionValue?: Function,
tabStop?: number,
useBooleanShorthandSyntax?: boolean,
useFragmentShortSyntax?: boolean,
sortProps?: boolean,

maxInlineAttributesLineLength?: number,
displayName?: (element: React.Element<*>) => string,
|};

export type Options = {|
filterProps: string[],
showDefaultProps: boolean,
showFunctions: boolean,
functionValue: Function,
functionValue?: Function,
tabStop: number,
useBooleanShorthandSyntax: boolean,
useFragmentShortSyntax: boolean,
Expand Down
Loading