Move some .d.ts files to .ts (#4862)

* Move loot-core types to `.ts`

* Add release notes

* PR feedback
This commit is contained in:
Julian Dominguez-Schatz
2025-04-20 22:40:53 -04:00
committed by GitHub
parent 94600731d9
commit 92f444f548
25 changed files with 17 additions and 9 deletions

View File

@@ -64,7 +64,7 @@ handlers['make-filters-from-conditions'] = async function ({
};
handlers['query'] = async function (query) {
if (query.table == null) {
if (query['table'] == null) {
throw new Error('query has no table, did you forgot to call `.serialize`?');
}

View File

@@ -187,5 +187,6 @@ export async function batchUpdateTransactions({
return {
added: resultAdded,
updated: runTransfers ? transfersUpdated : resultUpdated,
deleted: allDeleted,
};
}

View File

@@ -1,3 +1,4 @@
// @ts-strict-ignore
import { ImportTransactionsOpts } from '@actual-app/api';
import type {
@@ -7,10 +8,10 @@ import type {
APIFileEntity,
APIPayeeEntity,
} from '../server/api-models';
import { BudgetFileHandlers } from '../server/budgetfiles/app';
import { type batchUpdateTransactions } from '../server/transactions';
import type { NewRuleEntity, RuleEntity, TransactionEntity } from './models';
import { type ServerHandlers } from './server-handlers';
export interface ApiHandlers {
'api/batch-budget-start': () => Promise<unknown>;
@@ -18,7 +19,7 @@ export interface ApiHandlers {
'api/batch-budget-end': () => Promise<unknown>;
'api/load-budget': (
...args: Parameters<ServerHandlers['load-budget']>
...args: Parameters<BudgetFileHandlers['load-budget']>
) => Promise<void>;
'api/download-budget': (arg: {

View File

@@ -9,7 +9,7 @@ export type TimeFrame = {
type AbstractWidget<
T extends string,
Meta extends Record<string, unknown> = null,
Meta extends Record<string, unknown> | null = null,
> = {
id: string;
type: T;

View File

@@ -81,7 +81,7 @@ export interface DataEntity {
totalTotals: number;
}
type LegendEntity = {
export type LegendEntity = {
name: string;
id: string | null;
color: string;

View File

@@ -15,7 +15,7 @@ export type SimpleFinAccount = {
};
export interface SimpleFinBatchSyncResponse {
[accountId: AccountEntity['account_id']]: BankSyncResponse;
[accountId: NonNullable<AccountEntity['account_id']>]: BankSyncResponse;
}
export type SyncServerSimpleFinAccount = {

View File

@@ -4,9 +4,9 @@ export type StripNever<T> = {
[K in keyof T as T[K] extends never ? never : K]: T[K];
};
export type EverythingButIdOptional<T> = { id: T['id'] } & Partial<
Omit<T, 'id'>
>;
export type EverythingButIdOptional<T extends { id: unknown }> = {
id: T['id'];
} & Partial<Omit<T, 'id'>>;
export type WithRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;

View File

@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [jfdoming]
---
Move some .d.ts files to .ts