cloudflare / cloudflare/vinext

Typegen: merge configured cacheLife profiles into next/cache types

Open
#3,244 0 comments 0 reactions 0 assignees View on GitHub
nextjs-tracking
Dominant language
TypeScript
Stars
8.8k
Forks
406
Avg merge
2d 6h
Merged PRs (30d)
120

Description

## Next.js Change

**Commit:** [`f464e32`](https://github.com/vercel/next.js/commit/f464e32ec092c5a00c967e64cba40121a2992224) ([#98252](https://github.com/vercel/next.js/pull/98252))

## 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 `CacheLifeProfiles` interface in vinext's `next/cache` types.
- [ ] Restrict string `cacheLife()` and `unstable_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/cache` exports.
- [ ] Add type-level coverage for valid configured profiles, rejected unknown profiles, and existing `next/cache` exports.

## References

- https://github.com/vercel/next.js/commit/f464e32ec092c5a00c967e64cba40121a2992224

Contributor guide

Open the contributing guide

Research direction

Locate vinext's generated or declared next/cache types and the Cache Components configuration/type-generation entry point; start by tracing how configured cacheLife profiles reach emitted declarations. Add type-level coverage for configured and unknown profiles, the object-form overload, and existing next/cache exports; done means the generated result is a module augmentation that preserves those exports.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, typescript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.