Typegen: merge configured cacheLife profiles into next/cache types
Author: ask-bonk[bot]Created Sep 12, 2026Updated Sep 12, 2026
Labelsnextjs-tracking
Next.js Change
What changed
Next.js moved configured cacheLife profile declarations to an augmentation of next/cache rather than a standalone ambient module that shadows the package types. It adds a CacheLifeProfiles interface to next/cache and constrains string profile names when that interface is augmented, while retaining the object-form cacheLife() overload.
Impact on vinext
vinext implements the next/cache API and Cache Components configuration. Its generated or declared types should preserve all existing next/cache exports while providing typed custom cacheLife profile names from project configuration.
Acceptance criteria
- Declare an augmentable
CacheLifeProfilesinterface in vinext'snext/cachetypes. - Restrict string
cacheLife()andunstable_cacheLife()profile arguments to configured profiles when present, while allowing arbitrary strings when none are configured. - Keep the object-form
cacheLife()overload available. - Generate a module augmentation, not a standalone declaration that shadows other
next/cacheexports. - Add type-level coverage for valid configured profiles, rejected unknown profiles, and existing
next/cacheexports.
References
Source: cloudflare/vinext