// @flow
export type TagValue = string | string[];

export type Tag = {
    (...values: string[]): Tag,
    +tagDescriptionGenerator: (tag: TagConfiguration, value: string) => string,
} & TagConfiguration;

export type TagConfiguration = {
    +name: string,
    +description: string,
    +values: string[],
    +parentTags: Tag[],
    +prependName: boolean,
};

type BuildTagOptions = {
    description: string,
    style: string,
    values: string[],
    parentTags: Tag[],
    prependName: boolean,
    tagDescriptionGenerator: (tag: TagConfiguration, value: string) => string,
};
export function buildTag(
    name: string,
    {
        description = '',
        style = '',
        values = [],
        parentTags = [],
        prependName = false,
        tagDescriptionGenerator = ({ description }) => description,
    }: $Shape<BuildTagOptions> = {}
): Tag {
    const tag = (...values: string[]) => {
        const buildTagOptions: BuildTagOptions = {
            description,
            style,
            values,
            parentTags,
            prependName,
            tagDescriptionGenerator,
        };
        return buildTag(name, buildTagOptions);
    };
    tag.name = name;
    tag.description = tag.description;
    tag.values = values;
    tag.parentTags = parentTags;
    tag.prependName = prependName;
    tag.tagDescriptionGenerator = tagDescriptionGenerator;

    return tag;
}

@@ -238,17 +238,20 @@
  %7B%0A    +
-n
+tagN
 ame: str
@@ -611,17 +611,20 @@
 ag(%0A    
-n
+tagN
 ame: str
@@ -1147,17 +1147,20 @@
 uildTag(
-n
+tagN
 ame, bui
@@ -1193,16 +1193,22 @@
 tag.
-n
+tagN
 ame = 
-n
+tagN
 ame;

Fix name collision with function.name