Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Typescript] Server event types #4110

Merged
merged 2 commits into from
Jan 9, 2025
Merged

[Typescript] Server event types #4110

merged 2 commits into from
Jan 9, 2025

Conversation

joel-jeremy
Copy link
Contributor

No description provided.

@actual-github-bot actual-github-bot bot changed the title [Typescript] Server event types [WIP] [Typescript] Server event types Jan 7, 2025
Copy link

netlify bot commented Jan 7, 2025

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 7e8bb62
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/677dad127fbde30008fa864c
😎 Deploy Preview https://deploy-preview-4110.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

github-actions bot commented Jan 7, 2025

Bundle Stats — desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
10 5.66 MB → 5.66 MB (+265 B) +0.00%
Changeset
File Δ Size
src/components/mobile/budget/CategoryTransactions.tsx 📈 +32 B (+1.07%) 2.91 kB → 2.94 kB
home/runner/work/actual/actual/packages/loot-core/src/client/query-helpers.ts 📈 +59 B (+0.86%) 6.73 kB → 6.79 kB
src/components/budget/index.tsx 📈 +60 B (+0.65%) 9.07 kB → 9.13 kB
src/components/mobile/budget/index.tsx 📈 +54 B (+0.46%) 11.47 kB → 11.52 kB
src/components/mobile/accounts/AccountTransactions.tsx 📈 +32 B (+0.42%) 7.49 kB → 7.52 kB
home/runner/work/actual/actual/packages/loot-core/src/client/shared-listeners.ts 📈 +23 B (+0.28%) 8.06 kB → 8.08 kB
src/components/Titlebar.tsx 📈 +4 B (+0.05%) 8.13 kB → 8.13 kB
src/components/payees/ManagePayeesWithData.tsx 📈 +1 B (+0.03%) 3.74 kB → 3.74 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/index.js 3.72 MB → 3.72 MB (+179 B) +0.00%
static/js/narrow.js 84.22 kB → 84.3 kB (+86 B) +0.10%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/useAccountPreviewTransactions.js 1.63 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/workbox-window.prod.es5.js 5.69 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/AppliedFilters.js 10.24 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/wide.js 104.59 kB 0%
static/js/ReportRouter.js 1.58 MB 0%

Copy link
Contributor

github-actions bot commented Jan 7, 2025

Bundle Stats — loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
1 1.33 MB → 1.33 MB (-16 B) -0.00%
Changeset
File Δ Size
packages/loot-core/src/server/main-app.ts 📈 +2 B (+0.92%) 217 B → 219 B
packages/loot-core/src/server/schedules/app.ts 📉 -48 B (-0.27%) 17.16 kB → 17.11 kB
packages/loot-core/src/server/app.ts 📉 -230 B (-12.40%) 1.81 kB → 1.59 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

Asset File Size % Changed
kcab.worker.js 1.33 MB → 1.33 MB (-16 B) -0.00%

Unchanged

No assets were unchanged

@@ -117,8 +117,8 @@ function SyncButton({ style, isMobile = false }: SyncButtonProps) {
>(null);

useEffect(() => {
const unlisten = listen('sync-event', ({ type, subtype, syncDisabled }) => {
if (type === 'start') {
const unlisten = listen('sync-event', event => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to event so typescript can infer discrimanted type better vs destructured.

@joel-jeremy joel-jeremy changed the title [WIP] [Typescript] Server event types [Typescript] Server event types Jan 7, 2025
Copy link
Contributor

coderabbitai bot commented Jan 7, 2025

Walkthrough

The pull request introduces a series of modifications across multiple files in the desktop client and core packages, focusing on streamlining event handling and improving type safety. The changes primarily involve simplifying event listener parameter handling by transitioning from destructured parameters to using a single event parameter and accessing its properties directly. This approach is consistently applied across various components and functions, including SyncButton, BudgetInner, TransactionListWithPreviews, and others.

In the loot-core package, additional type definitions were added to enhance type safety, such as introducing more specific event types and refining the ServerEvents interface. The modifications aim to create more explicit and predictable event handling mechanisms while maintaining the existing functional logic of the components.

Possibly related PRs

Suggested labels

sparkles: Merged

Suggested reviewers

  • MikesGlitch
  • youngcw

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/loot-core/src/types/server-events.d.ts (1)

46-68: Consider documenting event types.

While the type definitions are clear, adding JSDoc comments for each event type would improve maintainability by documenting the purpose and usage of each event.

Example:

+/** Event emitted when backups are updated */
 type BackupUpdatedEvent = Backup[];

+/** Event emitted when cell values change */
 type CellsChangedEvent = Array<{
   name: string;
   value: string | number | boolean;
 }>;
packages/desktop-client/src/global-events.ts (1)

30-40: Consider using optional chaining for better null safety.

The code accesses nested properties without null checks. Consider using optional chaining to make the code more robust.

-    if (prefs && prefs.id) {
+    if (prefs?.id) {
🧰 Tools
🪛 Biome (1.9.4)

[error] 35-35: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a5d591f and 31b4cb4.

⛔ Files ignored due to path filters (1)
  • upcoming-release-notes/4110.md is excluded by !**/*.md
📒 Files selected for processing (15)
  • packages/desktop-client/src/components/Titlebar.tsx (2 hunks)
  • packages/desktop-client/src/components/budget/index.tsx (1 hunks)
  • packages/desktop-client/src/components/mobile/accounts/AccountTransactions.tsx (1 hunks)
  • packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx (1 hunks)
  • packages/desktop-client/src/components/mobile/budget/index.tsx (1 hunks)
  • packages/desktop-client/src/components/payees/ManagePayeesWithData.tsx (1 hunks)
  • packages/desktop-client/src/global-events.ts (1 hunks)
  • packages/loot-core/src/client/query-helpers.ts (3 hunks)
  • packages/loot-core/src/client/shared-listeners.ts (7 hunks)
  • packages/loot-core/src/platform/server/connection/index.d.ts (1 hunks)
  • packages/loot-core/src/server/accounts/transactions.ts (2 hunks)
  • packages/loot-core/src/server/app.ts (1 hunks)
  • packages/loot-core/src/server/main-app.ts (1 hunks)
  • packages/loot-core/src/server/schedules/app.ts (2 hunks)
  • packages/loot-core/src/types/server-events.d.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/loot-core/src/server/main-app.ts
🧰 Additional context used
🪛 Biome (1.9.4)
packages/desktop-client/src/global-events.ts

[error] 35-35: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Functional
  • GitHub Check: Visual regression
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (ubuntu-latest)
🔇 Additional comments (18)
packages/loot-core/src/platform/server/connection/index.d.ts (1)

12-12: LGTM! Fixed case-sensitivity in generic type parameter.

The change from ServerEvents[k] to ServerEvents[K] correctly matches the generic type parameter K defined in the extends clause, fixing a potential type error.

packages/loot-core/src/server/app.ts (2)

12-15: LGTM! Well-structured event type definitions.

The Events type alias provides clear type definitions for sync and load-budget events, enhancing type safety.


18-18: LGTM! Improved type safety for events property.

The events property is now properly typed with Emitter<Events>, ensuring type-safe event handling.

packages/loot-core/src/types/server-events.d.ts (3)

4-18: LGTM! Comprehensive sync state definitions.

The SyncSubtype type provides a clear and extensible list of sync states. The inclusion of string type allows for future additions without breaking changes.


20-44: LGTM! Well-structured sync event type definitions.

The SyncEvent type effectively uses discriminated unions to define different sync events with their specific payloads. The inclusion of optional meta field provides flexibility for additional context.


71-85: LGTM! Consistent event interface updates.

The ServerEvents interface effectively uses the newly defined types, providing a clear contract for event handling throughout the application.

packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx (1)

65-67: LGTM! Improved event handling pattern.

The change to use a single event parameter instead of destructuring improves type safety by leveraging the newly defined SyncEvent type. This change maintains the same functionality while making the code more maintainable.

packages/desktop-client/src/global-events.ts (1)

24-25: LGTM! Event handler simplified.

The simplified event handler improves code clarity by removing unused parameters.

packages/desktop-client/src/components/payees/ManagePayeesWithData.tsx (1)

52-54: LGTM! Improved TypeScript type inference.

The change to use direct event property access allows TypeScript to better infer discriminated union types.

packages/loot-core/src/server/accounts/transactions.ts (1)

4-4: LGTM! Enhanced type safety with explicit types.

The addition of PayeeEntity import and explicit Set type annotation improves type safety and code maintainability.

Also applies to: 58-58

packages/desktop-client/src/components/Titlebar.tsx (1)

Line range hint 120-145: LGTM! Improved TypeScript type inference for sync events.

The changes to use direct event property access consistently improve TypeScript's ability to infer discriminated union types, making the code more type-safe.

packages/desktop-client/src/components/mobile/accounts/AccountTransactions.tsx (1)

270-272: LGTM! Clean event handling pattern.

The change to use a single event parameter improves type safety and follows TypeScript best practices for event handling.

packages/loot-core/src/client/shared-listeners.ts (1)

11-11: LGTM! Consistent event handling pattern.

The changes standardize event parameter naming and access patterns across the codebase, improving type safety and maintainability while preserving the existing error handling and notification logic.

Also applies to: 18-18, 29-30, 50-50, 58-58, 257-257, 268-268, 292-292

packages/loot-core/src/client/query-helpers.ts (1)

65-65: Great type safety improvements!

The changes enhance type safety by:

  1. Restricting _supportedSyncTypes to specific literal types ('applied' | 'success').
  2. Ensuring type-safe event handling in the sync event listener.

This helps catch potential errors at compile time and makes the code more maintainable.

Also applies to: 110-111, 165-165, 172-176

packages/desktop-client/src/components/budget/index.tsx (1)

111-120: LGTM! Consistent with codebase-wide improvements.

The changes align with the standardized event handling pattern seen across other files, improving type safety while maintaining the existing functionality.

packages/desktop-client/src/components/mobile/budget/index.tsx (1)

72-82: LGTM! Event handling implementation looks good.

The changes improve type safety by accessing properties directly from the event object instead of destructuring. The logic for checking sync success and table updates remains intact.

packages/loot-core/src/server/schedules/app.ts (2)

544-545: LGTM! Improved type safety for syncDisabled.

Changed syncDisabled from string 'false' to boolean false, which is the correct type for this property.


536-536: Verify client-side handling of schedules-offline event.

The removal of the payees array from the event payload might affect client components that expect this data.

Let's verify the client-side handling:

@joel-jeremy
Copy link
Contributor Author

/update-vrt

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (6)
packages/loot-core/src/server/app.ts (1)

1-1: Consider enabling TypeScript strict mode.

The @ts-strict-ignore directive disables TypeScript's strict mode for the entire file. Consider addressing the type issues and enabling strict mode for better type safety.

packages/loot-core/src/types/server-events.d.ts (3)

4-18: Consider documenting sync subtypes and making the type more strict

The SyncSubtype type includes well-named literals for various sync states, but lacks documentation explaining each case. Additionally, the catch-all string type at the end makes the type less strict, potentially hiding typos or invalid states.

Consider:

  1. Adding JSDoc comments to document each sync subtype
  2. Removing the catch-all string type unless there's a specific need for extensibility
+/** Represents different synchronization states and error conditions */
 type SyncSubtype =
+  /** Data is out of sync with the server */
   | 'out-of-sync'
+  /** Failed to apply sync changes */
   | 'apply-failure'
   // ... add docs for other subtypes
-  | string;

20-44: Improve type safety of meta and data properties

The SyncEvent type uses loose types for meta and data properties which could be made more type-safe.

Consider:

  1. Using a more specific type for meta instead of Record<string, unknown>
  2. Creating specific types for data and prevData Maps based on the table types
 type SyncEvent = {
-  meta?: Record<string, unknown>;
+  meta?: {
+    timestamp?: number;
+    // Add other known meta properties
+  };
 } & (
   | {
       type: 'applied';
       tables: string[];
-      data?: Map<string, unknown>;
-      prevData?: Map<string, unknown>;
+      data?: Map<string, TableData>;
+      prevData?: Map<string, TableData>;
     }
   // ...
 );

+/** Represents the structure of table data */
+type TableData = {
+  // Define known table data structure
+};

53-56: Consider using Record<never, never> for events without data

Several event types are defined as undefined, which works but isn't as explicit as it could be about the intent.

Consider using Record<never, never> or an empty object type {} to explicitly indicate these events don't carry data:

-type FallbackWriteErrorEvent = undefined;
+type FallbackWriteErrorEvent = Record<never, never>;
-type FinishImportEvent = undefined;
+type FinishImportEvent = Record<never, never>;
// Apply similar changes to other undefined event types

This makes it more explicit that these are events that intentionally carry no data, rather than potentially undefined events.

Also applies to: 62-68

packages/desktop-client/src/global-events.ts (2)

Line range hint 30-41: Use optional chaining for safer property access

The code could benefit from using optional chaining to safely access the prefs.id property.

-    if (prefs && prefs.id) {
+    if (prefs?.id) {
       if (event.type === 'applied') {
         const tables = event.tables;
         if (tables.includes('payees') || tables.includes('payee_mapping')) {
🧰 Tools
🪛 Biome (1.9.4)

[error] 35-35: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


Line range hint 30-41: Consider consolidating sync event handlers

There are two separate handlers for the 'sync-event' type. This could lead to confusion about the order of execution and make the code harder to maintain.

Consider consolidating the handlers into a single function:

-  listen('sync-event', async event => {
-    const prefs = store.getState().prefs.local;
-    if (prefs && prefs.id) {
-      if (event.type === 'applied') {
-        const tables = event.tables;
-        if (tables.includes('payees') || tables.includes('payee_mapping')) {
-          actions.getPayees();
-        }
-      }
-    }
-  });
-
-  listen('sync-event', async ({ type }) => {
-    if (type === 'unauthorized') {
-      actions.addNotification({
-        type: 'warning',
-        message: 'Unable to authenticate with server',
-        sticky: true,
-        id: 'auth-issue',
-      });
-    }
-  });
+  listen('sync-event', async event => {
+    const prefs = store.getState().prefs.local;
+    
+    if (event.type === 'unauthorized') {
+      actions.addNotification({
+        type: 'warning',
+        message: 'Unable to authenticate with server',
+        sticky: true,
+        id: 'auth-issue',
+      });
+      return;
+    }
+
+    if (prefs?.id && event.type === 'applied') {
+      const tables = event.tables;
+      if (tables.includes('payees') || tables.includes('payee_mapping')) {
+        actions.getPayees();
+      }
+    }
+  });

Also applies to: 44-55

🧰 Tools
🪛 Biome (1.9.4)

[error] 35-35: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 31b4cb4 and 7e8bb62.

⛔ Files ignored due to path filters (1)
  • upcoming-release-notes/4110.md is excluded by !**/*.md
📒 Files selected for processing (15)
  • packages/desktop-client/src/components/Titlebar.tsx (2 hunks)
  • packages/desktop-client/src/components/budget/index.tsx (1 hunks)
  • packages/desktop-client/src/components/mobile/accounts/AccountTransactions.tsx (1 hunks)
  • packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx (1 hunks)
  • packages/desktop-client/src/components/mobile/budget/index.tsx (1 hunks)
  • packages/desktop-client/src/components/payees/ManagePayeesWithData.tsx (1 hunks)
  • packages/desktop-client/src/global-events.ts (1 hunks)
  • packages/loot-core/src/client/query-helpers.ts (3 hunks)
  • packages/loot-core/src/client/shared-listeners.ts (7 hunks)
  • packages/loot-core/src/platform/server/connection/index.d.ts (1 hunks)
  • packages/loot-core/src/server/accounts/transactions.ts (2 hunks)
  • packages/loot-core/src/server/app.ts (1 hunks)
  • packages/loot-core/src/server/main-app.ts (1 hunks)
  • packages/loot-core/src/server/schedules/app.ts (2 hunks)
  • packages/loot-core/src/types/server-events.d.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (12)
  • packages/desktop-client/src/components/mobile/budget/index.tsx
  • packages/loot-core/src/server/main-app.ts
  • packages/desktop-client/src/components/payees/ManagePayeesWithData.tsx
  • packages/desktop-client/src/components/mobile/accounts/AccountTransactions.tsx
  • packages/loot-core/src/client/shared-listeners.ts
  • packages/desktop-client/src/components/mobile/budget/CategoryTransactions.tsx
  • packages/desktop-client/src/components/Titlebar.tsx
  • packages/loot-core/src/server/accounts/transactions.ts
  • packages/loot-core/src/platform/server/connection/index.d.ts
  • packages/loot-core/src/server/schedules/app.ts
  • packages/desktop-client/src/components/budget/index.tsx
  • packages/loot-core/src/client/query-helpers.ts
🧰 Additional context used
🪛 Biome (1.9.4)
packages/desktop-client/src/global-events.ts

[error] 35-35: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Visual regression
  • GitHub Check: Functional
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (ubuntu-latest)
🔇 Additional comments (5)
packages/loot-core/src/server/app.ts (3)

2-2: LGTM! Import changes improve type safety.

The addition of the Emitter type import and ServerEvents import enhances type safety for event handling.

Also applies to: 5-5


12-15: LGTM! Well-structured event type definitions.

The Events type provides clear typing for both server events and application-specific events, improving type safety and maintainability.


18-18: Verify event handler implementations match the new type.

The events property type is now properly constrained with Emitter<Events>. Let's verify that all event handlers in the codebase conform to these types.

✅ Verification successful

Event handler implementations verified and type-safe

All event handler implementations in the codebase correctly conform to the Emitter<Events> type constraint. Both 'sync' and 'load-budget' events are used with proper type signatures throughout the application.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for event handler implementations to verify type conformance
rg -t typescript "events\.(on|emit)\('(sync|load-budget)" --no-heading

Length of output: 110


Script:

#!/bin/bash
# Search for all event handler implementations in .ts and .tsx files
rg "events\.(on|emit)\(" -t ts -t tsx -A 2

# Find Events type definition
ast-grep --pattern 'type Events = {
  $$$
}'

Length of output: 367


Script:

#!/bin/bash
# Search for event usages with simple file extension
rg "events\.(on|emit)\(" --type-add 'ts:*.{ts,tsx}' -t ts -A 2

# Find ServerEvents type definition
ast-grep --pattern 'type ServerEvents = {
  $$$
}'

# Search specifically for sync and load-budget event usages
rg "(sync-event|load-budget)" --type-add 'ts:*.{ts,tsx}' -t ts -A 2

Length of output: 18524

packages/loot-core/src/types/server-events.d.ts (1)

70-86: LGTM! Well-structured event type definitions

The ServerEvents interface is well-organized with consistent use of defined types and follows good practices for event naming.

packages/desktop-client/src/global-events.ts (1)

24-26: LGTM! Correctly simplified event handler

The removal of the unused payees parameter aligns with the SchedulesOfflineEvent type definition.

Copy link
Member

@MatissJanis MatissJanis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@joel-jeremy joel-jeremy merged commit 92c93b3 into master Jan 9, 2025
20 checks passed
@joel-jeremy joel-jeremy deleted the server-event-types branch January 9, 2025 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants