Skip to content

pick() always will return an array even for multiselect === true even if the TypeScript typing is tuned to claim this different. #1773

@rotdrop

Description

@rotdrop

In my NC instance the calendar attachments do not work, as this uses the file-picker in single-select mode, however, looking at the following line of code in the dialogs package

return nodes.map((node) => node.path) as (IsMultiSelect extends true ? string[] : string)

reveals that pick() always will return an array of strings (JS Array.map() will return an array, there is nothing to argue about), but the TS types in that line are tuned to lie about this fact.

The return value in the transpiled code will always be an array. So either the TS type-hints should be adjusted accordingly, or the code should be fixed to act as intended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions