-
Notifications
You must be signed in to change notification settings - Fork 39
feat(frontend): Define types for custom events #10645
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
feat(frontend): Define types for custom events #10645
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request successfully addresses the overdue TODO by introducing type safety for custom events in the frontend. The changes replace generic any types with specific, well-defined types for custom event details, improving type safety across the application.
Key Changes:
- Defined custom event types in a centralized location (
custom-events.ts) - Updated event handler declarations to use specific types instead of
any - Updated event handler implementations in Svelte components to use the new types
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/frontend/src/lib/types/custom-events.ts |
Added type definitions for custom events: NoParamEvent, OisySyncStatusEvent, OisyIndexCanisterBalanceOutOfSyncEvent |
src/frontend/src/custom-events.d.ts |
Removed TODO comment and replaced all any types with specific custom event types from the new type definitions |
src/frontend/src/icp/components/transactions/IcTransactionsEthereumStatus.svelte |
Updated event handlers to use OisySyncStatusEvent type instead of SyncState directly |
src/frontend/src/icp/components/transactions/IcTransactionsBitcoinStatusBalance.svelte |
Updated event handler to use OisySyncStatusEvent type for consistency |
src/frontend/src/icp/components/transactions/IcIndexCanisterStatus.svelte |
Updated event handler to use OisyIndexCanisterBalanceOutOfSyncEvent type instead of raw boolean |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Motivation
Overdue TODO, we decide to be type-safe in the custom events.