@@ -255,8 +255,8 @@ export async function chooseFolder(msg: string, includeArchive?: boolean = false
255255 }
256256 }
257257 }
258- logDebug ( `helpers/userInput` , `chooseFolder folder chosen: "${ folder } "` )
259- return folder
258+ logDebug ( `helpers/userInput` , `chooseFolder folder chosen: "${ folder } "` )
259+ return folder
260260}
261261
262262/**
@@ -361,6 +361,7 @@ export async function datePicker(dateParams: string, config?: { [string]: ?mixed
361361 logDebug ( 'userInput / datePicker' , `params: ${ dateParams } -> ${ JSON . stringify ( paramConfig ) } ` )
362362 // '...' = "gather the remaining parameters into an array"
363363 const allSettings : { [ string ] : mixed } = {
364+ // $FlowIgnore[exponential-spread] known to be very small objects
364365 ...dateConfig ,
365366 ...paramConfig ,
366367 }
@@ -492,7 +493,7 @@ export async function inputMood(moodArray: Array<string>): Promise<string> {
492493 */
493494export const multipleInputAnswersAsArray = async ( question : string , submit : string , showCounter : boolean , minAnswers : number = 0 , maxAnswers ?: number ) : Promise < Array < string >> => {
494495 let input = '-'
495- const answers = [ ]
496+ const answers : Array < string > = [ ]
496497
497498 while ( ( maxAnswers ? answers . length < maxAnswers : true ) && ( input || answers . length < minAnswers ) ) {
498499 const placeholder = maxAnswers && showCounter ? `${ question } (${ answers . length + 1 } /${ maxAnswers } )` : question
@@ -572,7 +573,7 @@ export async function chooseNote(
572573 currentNoteFirst?: boolean = false,
573574 allowNewNoteCreation?: boolean = false,
574575): Promise<TNote | null> {
575- let noteList = []
576+ let noteList: Array<TNote> = []
576577 const projectNotes = DataStore.projectNotes
577578 const calendarNotes = DataStore.calendarNotes
578579 if (includeProjectNotes) {
@@ -599,17 +600,17 @@ export async function chooseNote(
599600 const { note } = Editor
600601 if (allowNewNoteCreation) {
601602 opts.unshift('[New note]')
603+ // $FlowIgnore[incompatible-type] just to keep the indexes matching; won't be used
602604 sortedNoteListFiltered.unshift('[New note]') // just keep the indexes matching
603605 }
604606 if (currentNoteFirst && note) {
605607 sortedNoteListFiltered.unshift(note)
606608 opts.unshift(` [ Current note : "${displayTitleWithRelDate(Editor)}" ] `)
607609 }
608610 const { index } = await CommandBar.showOptions(opts, promptText)
609- let noteToReturn = sortedNoteListFiltered[index]
610- if (noteToReturn === '[New note]') {
611- noteToReturn = await createNewNote()
612- }
611+ const noteToReturn = (opts[index] === '[New note]')
612+ ? await createNewNote()
613+ : sortedNoteListFiltered[index]
613614 return noteToReturn ?? null
614615}
615616
0 commit comments