Skip to content

Commit 08c1779

Browse files
committed
Flow fixes
1 parent 58798e3 commit 08c1779

5 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎helpers/HTMLView.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ export async function themeHasChanged(windowID: string, overrideThemeName?: stri
831831
const currentTheme = overrideThemeName ? overrideThemeName : notePlanThemeName || editorThemeName
832832

833833
if (!currentTheme) {
834-
logError('themeHasChanged', `Could not find currentTheme: "${currentTheme}", overrideThemeName: "${overrideThemeName || ''}", themeInReactWindow: "${themeInWindow}"`)
834+
logError('themeHasChanged', `Could not find currentTheme: "${String(currentTheme)}", overrideThemeName: "${overrideThemeName || ''}", themeInReactWindow: "${themeInWindow}"`)
835835
return false
836836
}
837837
if (currentTheme !== themeInWindow) {

‎helpers/NPEditor.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,8 @@ function openNoteInMainEditorViaCallback(
537537
* @returns {boolean}
538538
*/
539539
function isEditorOpenNoteApiAvailable(): boolean {
540+
// Testing for an API method trips [method-unbinding]; a function-typed property in flow-typed/Noteplan.js would avoid it.
541+
// $FlowFixMe[method-unbinding]
540542
return typeof Editor !== 'undefined' && typeof Editor.openNoteByFilename === 'function'
541543
}
542544

‎helpers/NPdateTime.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// @jgclark except where shown
55
//-------------------------------------------------------------------------------
66

7-
import { endOfWeek as dfEndOfWeek, format, startOfWeek as dfStartOfWeek } from 'date-fns'
7+
import { endOfWeek as dfEndOfWeek, format, startOfWeek as dfStartOfWeek, type Locale } from 'date-fns'
88
import moment from 'moment/min/moment-with-locales'
99
import { trimAnyQuotes } from './dataManipulation'
1010
import * as dt from './dateTime'
@@ -872,7 +872,8 @@ function coerceBridgedDate(value: mixed): Date | null {
872872
*/
873873
function weekBoundariesFromFirstDayOfWeek(date: Date, weekStartsOn: number): {| startDate: Date, endDate: Date |} {
874874
const startsOn = ((Math.floor(weekStartsOn) % 7) + 7) % 7
875-
const options = { weekStartsOn: (startsOn: any) }
875+
// Annotate so the missing optional `locale` is allowed. date-fns types that property invariantly.
876+
const options: {| locale?: Locale, weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 |} = { weekStartsOn: (startsOn: any) }
876877
return {
877878
startDate: dfStartOfWeek(date, options),
878879
endDate: dfEndOfWeek(date, options),

‎jgclark.Dashboard/src/react/components/Section/useSectionSortAndFilter.jsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ const useSectionSortAndFilter = (
376376
limitToApply,
377377
)
378378
if (priorityFilterFooter) {
379-
const messageItem = {
379+
const messageItem: TSectionItem = {
380380
itemType: priorityFilterFooter.itemType,
381381
ID: priorityFilterFooter.itemType === 'offerToFilter' ? `${section.ID}-FilterOffer` : `${section.ID}-FilterIndicator`,
382382
// Note: ideally indicate here that the display of offerToFilter shouldn't start with the + icon

‎jgclark.Dashboard/src/react/components/WebView.jsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export function WebView({ data, dispatch, reactSettings, setReactSettings }: Pro
169169
*/
170170
const addPassthroughVars = (data: PassedData): PassedData => {
171171
const newData = { ...data }
172-
if (!newData?.passThroughVars) newData.passThroughVars = { lastWindowScrollTop: 0 }
172+
if (!newData?.passThroughVars) newData.passThroughVars = { lastWindowScrollTop: (0: number) }
173173
newData.passThroughVars.lastWindowScrollTop = getDashboardScrollTop()
174174
return newData
175175
}

0 commit comments

Comments
 (0)