Closed tsiq-swyx closed 6 years ago
Hello,
There was an oversight on my part. I need to fix the plugin to support it. The loader version supports it.
In the prop description:
interface Props {
/**
* @default green
*/
color?: "blue" | "green";
}
ok so if i read that right this is something to fix as I currently don't see this working in my version. i'll leave this issue open in case you want to track it. thanks again, you're awesome
I've uploaded v1.1 that has the support.
Let me know if it works for you
yes!!
Will default values always be surrounded by quotes? I feel for the above delay1
, the default value shoudl be 250
, not "250"
. Is it possible to accomplish that?
@city41 I opened a new issue to track this. I don't like those quotes either.
@strothj can't we automatically infer the default, in components such as the one below?
const Component: FunctionComponent<
Props
> = ({ optionalPropWithDefault = [] }) => {
[...]
}
I'm also very interested in ability that @GabrielDuarteM mentioned.
Without it I'm forced to violate Don't Repeat Yourself principle because I have to write same value in two places. In such circumstances It's too easy to change values in the code but forget to change it in documentations. Especially for components with significant amount of props.
Situation may get even worse if you have some props interface which is built from extending another interface. With functional components I'm defining defaults inside function signature (it's most natural way for me). When doing this, default in docstring and function signature inside different files.
Moreover, some people like to store types (and proptypes) inside separate from component's one file.
hello! i have a very basic question... how do i make default props show up in here?
the styledguidist folks dont document this either and i was just hoping for a pointer!
thank you again!