Skip to content

fix(FilePickerBuilder): correctly return array / plain value depending on multiselect#1775

Merged
skjnldsv merged 1 commit into
mainfrom
fix/filepicker-pick-return
May 12, 2025
Merged

fix(FilePickerBuilder): correctly return array / plain value depending on multiselect#1775
skjnldsv merged 1 commit into
mainfrom
fix/filepicker-pick-return

Conversation

@susnux

@susnux susnux commented May 11, 2025

Copy link
Copy Markdown
Contributor

…g on multiselect

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux susnux requested review from ShGKme and artonge May 11, 2025 15:58
@susnux susnux added bug Something isn't working 3. to review labels May 11, 2025
@susnux

susnux commented May 11, 2025

Copy link
Copy Markdown
Contributor Author

/backport to stable6

@rotdrop

rotdrop commented May 11, 2025

Copy link
Copy Markdown

The changed line 101 contains a duplicated check for "multiselect". I suppose this is not intentional?

@susnux

susnux commented May 11, 2025

Copy link
Copy Markdown
Contributor Author

The changed line 101 contains a duplicated check for "multiselect". I suppose this is not intentional?

Not sure what you mean?

@rotdrop

rotdrop commented May 11, 2025

Copy link
Copy Markdown

The changed line 101 contains a duplicated check for "multiselect". I suppose this is not intentional?

Not sure what you mean?

Line 101 after applying your commit:

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

This is already in the code path where multiselect is true. Ok. I suppose this is still needed in order to persuade TypeScript to deduce the correct return type ...

@skjnldsv skjnldsv merged commit eba2e00 into main May 12, 2025
11 checks passed
@skjnldsv skjnldsv deleted the fix/filepicker-pick-return branch May 12, 2025 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants