Skip to content

Commit c0722a5

Browse files
authored
improve typescript autocomplete for cacheLife (#71400)
just applying the good old typescript trick that prevent a `'a' | 'b' | string` union from collapsing into `string`, and thus preserving the autocomplete we'd get for `'a' | 'b'` before: <img width="246" alt="Screenshot 2024-10-16 at 21 48 25" src="https://github.com/user-attachments/assets/5bc9c078-fb8a-4aeb-93c5-9ee02854f3f9"> after: <img width="296" alt="Screenshot 2024-10-16 at 21 47 06" src="https://github.com/user-attachments/assets/6b87cc47-ef2b-4124-9dc4-b628b19a4fe3">
1 parent f2ed75a commit c0722a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/next/src/server/use-cache/cache-life.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type CacheLifeProfiles =
2828
| 'days'
2929
| 'weeks'
3030
| 'max'
31-
| string
31+
| (string & {})
3232

3333
function validateCacheLife(profile: CacheLife) {
3434
if (profile.stale !== undefined) {

0 commit comments

Comments
 (0)