Skip to content

Commit

Permalink
improve typescript autocomplete for cacheLife (#71400)
Browse files Browse the repository at this point in the history
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">
  • Loading branch information
lubieowoce authored Oct 21, 2024
1 parent f2ed75a commit c0722a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/next/src/server/use-cache/cache-life.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type CacheLifeProfiles =
| 'days'
| 'weeks'
| 'max'
| string
| (string & {})

function validateCacheLife(profile: CacheLife) {
if (profile.stale !== undefined) {
Expand Down

0 comments on commit c0722a5

Please sign in to comment.