Skip to content

More specific type for acceptedFiles param #100

@luukvhoudt

Description

@luukvhoudt

Small suggestion to improve the type of the acceptedFiles param.

In my project I use:

type NonEmptyArray<T = unknown> = [T, ...T[]];
type UniqueFileTypeSpecifier = `${string}/${string}` | `.${string}`;
type AcceptedFiles = UniqueFileTypeSpecifier | NonEmptyArray<UniqueFileTypeSpecifier>

Not perfect but it does at least give some indicator. I don't use the comma-separated feature but my type should also allow that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions