>
下記のように、cacheLifeのカスタムキャッシュプロファイルを設定しています。
experimental: {
dynamicIO: true,
cacheLife: {
blog: {
stale: 60 * 60, // 1時間
revalidate: 60 * 60 * 24 * 30, // 1ヶ月
expire: 60 * 60 * 24 * 30, // 1ヶ月
},
},
},
下記のコードで、エラーが発生しました。
export async function getPosts() {
"use cache";
cacheLife("blog"); // この行でエラー
// ...
}
No overload matches this call.
The last overload gave the following error.
Type '"blog"' has no properties in common with type '{ stale?: number | undefined; revalidate?: number | undefined; expire?: number | undefined; }'.ts(2769)
cache-life.d.ts(124, 21): The last overload is declared here.
ビルドしたら、エラーが消えました。なぜかはわかりません。
pnpm build
or
npm run build