Skip to content

Docgen of defaulted properties in a SFC (Typescript 3) #154

@ibrambe

Description

@ibrambe

The default column only specifies if a property is required or not, it doesn't take defaulted properties into account. I known I can work around this with Button.defaultProps = {}, but this shouldn't be required anymore.

import * as React from "react";

interface ButtonProps {
    children: React.ReactNode,
    /** More information about the disabled property */
    disabled?: boolean
}

/**
 * A general purpose button.
 */
export default function Button({children, disabled = false}: ButtonProps) {
    return <button disabled={disabled}>{children}</button>;
}

Output:

schermafbeelding 2018-11-15 om 11 07 47

Expected output:

schermafbeelding 2018-11-15 om 11 10 39

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions