-
Notifications
You must be signed in to change notification settings - Fork 96
Add focused type-safe boundaries for analytics mock data #385
Copy link
Copy link
Closed
Labels
Third CampaignOfficial FWC26 campaign issue — eligible for campaign scoring and rewardsOfficial FWC26 campaign issue — eligible for campaign scoring and rewardsintermediateIntermediate difficulty tasks requiring solid experience and some contextIntermediate difficulty tasks requiring solid experience and some contextstructureCode structural organization, architecture changes, and module boundary improvementsCode structural organization, architecture changes, and module boundary improvementstype-safetyTypeScript type system improvements and strict type enforcementTypeScript type system improvements and strict type enforcement
Description
Activity
Metadata
Metadata
Assignees
Labels
Third CampaignOfficial FWC26 campaign issue — eligible for campaign scoring and rewardsOfficial FWC26 campaign issue — eligible for campaign scoring and rewardsintermediateIntermediate difficulty tasks requiring solid experience and some contextIntermediate difficulty tasks requiring solid experience and some contextstructureCode structural organization, architecture changes, and module boundary improvementsCode structural organization, architecture changes, and module boundary improvementstype-safetyTypeScript type system improvements and strict type enforcementTypeScript type system improvements and strict type enforcement
Difficulty
Intermediate
Type
type-safety, structure, consistency
Background
The reported parser failure occurs in the analytics-related section of
lib/api/mock.ts, including theMOCK_ANALYTICS_SUMMARY.resourceAccessreturn path. Large inline mock structures are difficult to maintain when their data shape and access functions are not clearly separated.Problem
Analytics mock data and the functions consuming it are tightly coupled inside the large mock module, increasing the chance that structural or shape changes will introduce failures that are only discovered when Next.js compiles the module.
Expected outcome
Give the analytics mock data an explicit, reusable TypeScript shape and separate its data definition from access logic.
Suggested implementation
Locate
MOCK_ANALYTICS_SUMMARYand the functions that return its analytics fields. Define or reuse an appropriate TypeScript type based on the actual object shape. Move the analytics fixture and related access functions into a focused module if consistent with the repository's existing structure. EnsureresourceAccessand its sibling fields remain type-safe.Acceptance criteria
MOCK_ANALYTICS_SUMMARYhas an explicit type or is inferred from a clearly typed fixture.resourceAccessis type-checked against the analytics summary shape.Likely affected files/directories
lib/api/mock.tslib/api/analytics-related modules