Skip to content

Typing problem for the variadic function arguments #5

Description

@acgrid

Thanks for your awesome library!
See this typing at

export default function shellEncode(...cmds: string | string[] | IShellOptions): string;

At least cmds shall be an array of arguments because of the preceded three dots, but changing to...cmds: (string | string[] | IShellOptions)[] only works at a few situations and need casting to IShellOptions explicitly by as.
Suggestion:
For our circumstance, the quantity of arguments shall be 1-3: (string) (string, string[]) (string, string[], IShellOptions) (string, IShellOptions). Maybe https://www.typescriptlang.org/docs/handbook/2/functions.html#function-overloads will fit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions