From c0722a500a59dee7b413c534dcc78581cac54c20 Mon Sep 17 00:00:00 2001 From: Janka Uryga Date: Mon, 21 Oct 2024 14:59:42 +0200 Subject: [PATCH] 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: Screenshot 2024-10-16 at 21 48 25 after: Screenshot 2024-10-16 at 21 47 06 --- packages/next/src/server/use-cache/cache-life.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next/src/server/use-cache/cache-life.ts b/packages/next/src/server/use-cache/cache-life.ts index 6a37578eafeb2..9f294dcdcc7fb 100644 --- a/packages/next/src/server/use-cache/cache-life.ts +++ b/packages/next/src/server/use-cache/cache-life.ts @@ -28,7 +28,7 @@ type CacheLifeProfiles = | 'days' | 'weeks' | 'max' - | string + | (string & {}) function validateCacheLife(profile: CacheLife) { if (profile.stale !== undefined) {