Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parsing default props #234

Merged
merged 3 commits into from
May 29, 2020

Conversation

normancroan
Copy link

This change addresses a problem I encountered where my component defines defaultProps containing values of type other than string.

ex:

	static defaultProps: TextAreaProps = {
		rows: 5,
		cols: 30,
		name: "Example",
		id: "Another Example",
	};

Storybook threw an error from parseProps.js because the value of defaultValueDesc.value wasn't a string but was passed to clearString which invokes .replace on the arg.

I’ve renamed this function to getClearStringForVal to better convey the expectation of receiving a “clear” string and to support the existing cases where this function receives values other than strings as arguments.

Norman Croan added 3 commits May 28, 2020 18:58
… errors produced by parsing default props where type is anything other than string
…, rename to getClearStringForVal to indicate this function may receive values other than strings and the expectation is to receive a string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants