Skip to content

@minLength for strings inside tuples #283

Open
@HoldYourWaffle

Description

@HoldYourWaffle

Maybe somewhat related to #208.

I can't figure out how to put a minLength constraint on a tuple type like this:

type A = [string, string][]

To be clear: I want the strings inside the tuple to have a minimum length.

I tried using an extra type alias like this:

/**
 * @minLength 1
 */
type S = string;

type A = [S, S][];

But that didn't seem to change anything. Even with --aliasRefs enabled, the S type (which does get the correct minLength constraint) doesn't get referenced in the generated tuple schema.
It should also be noted that (from my testing) tuple types don't respect the --aliasRefs flag when they're used through type aliases. They seem to generate their own Array-like schema as well as 'inlining' one everywhere the alias is referenced.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions