diff --git a/packages/desktop-client/src/components/autocomplete/SavedFilterAutocomplete.tsx b/packages/desktop-client/src/components/autocomplete/SavedFilterAutocomplete.tsx index 989e0b17123..684cdbb54f5 100644 --- a/packages/desktop-client/src/components/autocomplete/SavedFilterAutocomplete.tsx +++ b/packages/desktop-client/src/components/autocomplete/SavedFilterAutocomplete.tsx @@ -74,7 +74,6 @@ export default function SavedFilterAutocomplete({ suggestions={filters} renderItems={(items, getItemProps, highlightedIndex) => ( unknown> = export type BoundActions = { [Key in keyof typeof actions]: ( ...args: Parameters<(typeof actions)[Key]> - ) => ActionReturnType<(typeof actions)[Key]>; + ) => // @ts-expect-error temporarily disabling this TS error; eventually the `useActions` hook should be removed + ActionReturnType<(typeof actions)[Key]>; }; // https://react-redux.js.org/api/hooks#recipe-useactions +/** + * @deprecated please use actions directly with `useDispatch` + * @see https://github.com/reduxjs/react-redux/issues/1252#issuecomment-488160930 + **/ export function useActions() { const dispatch = useDispatch(); return useMemo(() => { diff --git a/packages/loot-core/src/platform/server/sqlite/index.electron.ts b/packages/loot-core/src/platform/server/sqlite/index.electron.ts index 146e8ac192c..0374f34d8b5 100644 --- a/packages/loot-core/src/platform/server/sqlite/index.electron.ts +++ b/packages/loot-core/src/platform/server/sqlite/index.electron.ts @@ -98,9 +98,11 @@ export function openDatabase(pathOrBuffer: string | Buffer) { const db = new SQL(pathOrBuffer); // Define Unicode-aware LOWER and UPPER implementation. // This is necessary because better-sqlite3 uses SQLite build without ICU support. + // @ts-expect-error @types/better-sqlite3 does not support setting strict 3rd argument db.function('UNICODE_LOWER', { deterministic: true }, (arg: string | null) => arg?.toLowerCase(), ); + // @ts-expect-error @types/better-sqlite3 does not support setting strict 3rd argument db.function('UNICODE_UPPER', { deterministic: true }, (arg: string | null) => arg?.toUpperCase(), ); diff --git a/packages/loot-core/src/server/aql/compiler.ts b/packages/loot-core/src/server/aql/compiler.ts index ade3d1d0200..29b437ec38b 100644 --- a/packages/loot-core/src/server/aql/compiler.ts +++ b/packages/loot-core/src/server/aql/compiler.ts @@ -989,10 +989,21 @@ export function isAggregateQuery(queryState) { }); } -type SchemaConfig = { - tableViews?: Record | ((...args: unknown[]) => unknown); +export type SchemaConfig = { + tableViews?: + | Record + | ((name: string, config: { withDead; isJoin; tableOptions }) => unknown); tableFilters?: (name: string) => unknown[]; - customizeQuery?: (queryString: T) => T; + customizeQuery?: ( + queryString: T, + ) => T; + views?: Record< + string, + { + fields?: Record; + [key: `v_${string}`]: string | ((internalFields, publicFields) => string); + } + >; }; export function compileQuery( queryState, diff --git a/packages/loot-core/src/server/aql/schema/index.ts b/packages/loot-core/src/server/aql/schema/index.ts index 26af5205b07..1af6735bdc4 100644 --- a/packages/loot-core/src/server/aql/schema/index.ts +++ b/packages/loot-core/src/server/aql/schema/index.ts @@ -1,3 +1,5 @@ +import { SchemaConfig } from '../compiler'; + function f(type: string, opts?: Record) { return { type, ...opts }; } @@ -140,7 +142,7 @@ export const schema = { }, }; -export const schemaConfig = { +export const schemaConfig: SchemaConfig = { // Note: these views *must* represent the underlying table that we // are mapping here. The compiler makes optimizations with this // assumption diff --git a/tsconfig.json b/tsconfig.json index 844bcaf11c4..a426766d86a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,8 +15,7 @@ "downlevelIteration": true, // TODO: enable once every file is ts // "strict": true, - // TODO: enable once the violations are fixed - // "strictFunctionTypes": true, + "strictFunctionTypes": true, "noFallthroughCasesInSwitch": true, "skipLibCheck": true, "jsx": "preserve", diff --git a/upcoming-release-notes/2072.md b/upcoming-release-notes/2072.md new file mode 100644 index 00000000000..edad616bb1f --- /dev/null +++ b/upcoming-release-notes/2072.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [MatissJanis] +--- + +Fixing TypeScript issues when enabling `strictFunctionTypes` (pt.5).