feat: complete Priority 1 type safety improvements
- Fix remaining any types in test apps (Android, iOS, shared TypeScript)
- Replace non-null assertions with proper null checks
- Improve type safety in EndorserAPIClient and TimeSafariNotificationManager
- Enhanced error handling with explicit null checks
Linting status: ✅ 0 errors, 329 warnings (down from 436 warnings)
Priority 1 improvements: 107 warnings fixed (25% reduction)
Type safety: 34 fewer any types, 10 non-null assertions fixed
This commit is contained in:
@@ -243,7 +243,7 @@ export interface UserNotificationConfig {
|
||||
badge?: boolean;
|
||||
actions?: NotificationAction[];
|
||||
category?: string;
|
||||
userInfo?: Record<string, any>;
|
||||
userInfo?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface NotificationAction {
|
||||
@@ -271,7 +271,7 @@ export interface ContentFetchResult {
|
||||
contentAge: number;
|
||||
error?: string;
|
||||
retryCount: number;
|
||||
metadata?: Record<string, any>;
|
||||
metadata?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface DualScheduleStatus {
|
||||
@@ -358,7 +358,7 @@ export interface DailyNotificationPlugin {
|
||||
resumeDualSchedule(): Promise<void>;
|
||||
|
||||
// Content management methods
|
||||
getContentCache(): Promise<Record<string, any>>;
|
||||
getContentCache(): Promise<Record<string, unknown>>;
|
||||
clearContentCache(): Promise<void>;
|
||||
getContentHistory(): Promise<ContentFetchResult[]>;
|
||||
|
||||
@@ -415,7 +415,7 @@ export interface OfferSummaryRecord {
|
||||
amountGivenConfirmed: number;
|
||||
objectDescription: string;
|
||||
validThrough?: string;
|
||||
fullClaim?: Record<string, any>;
|
||||
fullClaim?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface OffersToPlansResponse {
|
||||
@@ -443,7 +443,7 @@ export interface PlansLastUpdatedResponse {
|
||||
|
||||
export interface PlanSummaryWithPreviousClaim {
|
||||
plan: PlanSummary;
|
||||
wrappedClaimBefore?: Record<string, any>;
|
||||
wrappedClaimBefore?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface PlanSummary {
|
||||
@@ -507,7 +507,7 @@ export interface TimeSafariProjectNotification {
|
||||
project: PlanSummary;
|
||||
changes?: {
|
||||
fields: string[];
|
||||
previousValues?: Record<string, any>;
|
||||
previousValues?: Record<string, unknown>;
|
||||
};
|
||||
relevantOffers?: OfferSummaryRecord[];
|
||||
notificationPriority: 'high' | 'medium' | 'low';
|
||||
@@ -519,7 +519,7 @@ export interface TimeSafariPersonNotification {
|
||||
personDid: string;
|
||||
changes?: {
|
||||
fields: string[];
|
||||
previousValues?: Record<string, any>;
|
||||
previousValues?: Record<string, unknown>;
|
||||
};
|
||||
relevantProjects?: PlanSummary[];
|
||||
notificationPriority: 'high' | 'medium' | 'low';
|
||||
@@ -531,7 +531,7 @@ export interface TimeSafariItemNotification {
|
||||
itemId: string;
|
||||
changes?: {
|
||||
fields: string[];
|
||||
previousValues?: Record<string, any>;
|
||||
previousValues?: Record<string, unknown>;
|
||||
};
|
||||
relevantContext?: 'project' | 'offer' | 'person';
|
||||
notificationPriority: 'high' | 'medium' | 'low';
|
||||
|
||||
@@ -299,7 +299,7 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
||||
/**
|
||||
* Update dual schedule configuration (web implementation)
|
||||
*/
|
||||
async updateDualScheduleConfig(config: any): Promise<void> {
|
||||
async updateDualScheduleConfig(config: Record<string, unknown>): Promise<void> {
|
||||
console.log('Dual schedule config updated (web mock):', config);
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
||||
console.log('DNP-WEB-INDEX: Setting up activeDid change listener');
|
||||
|
||||
// Set up event listener for activeDidChanged events
|
||||
document.addEventListener('activeDidChanged', async (event: any) => {
|
||||
document.addEventListener('activeDidChanged', async (event: Event) => {
|
||||
try {
|
||||
const eventDetail = event.detail;
|
||||
if (eventDetail && eventDetail.activeDid) {
|
||||
@@ -565,7 +565,7 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
||||
}
|
||||
|
||||
// Static Daily Reminder Methods
|
||||
async scheduleDailyReminder(options: any): Promise<void> {
|
||||
async scheduleDailyReminder(options: Record<string, unknown>): Promise<void> {
|
||||
console.log('Schedule daily reminder called on web platform:', options);
|
||||
// Mock implementation for web
|
||||
}
|
||||
@@ -575,12 +575,12 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
||||
// Mock implementation for web
|
||||
}
|
||||
|
||||
async getScheduledReminders(): Promise<any[]> {
|
||||
async getScheduledReminders(): Promise<Record<string, unknown>[]> {
|
||||
console.log('Get scheduled reminders called on web platform');
|
||||
return []; // Mock empty array for web
|
||||
}
|
||||
|
||||
async updateDailyReminder(reminderId: string, options: any): Promise<void> {
|
||||
async updateDailyReminder(reminderId: string, options: Record<string, unknown>): Promise<void> {
|
||||
console.log('Update daily reminder called on web platform:', reminderId, options);
|
||||
// Mock implementation for web
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user