浏览代码

fix typescript error

lloydzhou 1 年之前
父节点
当前提交
6a083b24c4
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      app/api/artifact/route.ts

+ 6 - 2
app/api/artifact/route.ts

@@ -12,12 +12,16 @@ async function handle(req: NextRequest, res: NextResponse) {
   if (req.method === "POST") {
   if (req.method === "POST") {
     const clonedBody = await req.text();
     const clonedBody = await req.text();
     const hashedCode = md5.hash(clonedBody).trim();
     const hashedCode = md5.hash(clonedBody).trim();
-    const body = {
+    const body: {
+      key: string;
+      value: string;
+      expiration_ttl?: Number;
+    } = {
       key: hashedCode,
       key: hashedCode,
       value: clonedBody,
       value: clonedBody,
     };
     };
     try {
     try {
-      const ttl = parseInt(serverConfig.cloudflareKVTTL);
+      const ttl = parseInt(serverConfig.cloudflareKVTTL as string);
       if (ttl > 60) {
       if (ttl > 60) {
         body["expiration_ttl"] = ttl;
         body["expiration_ttl"] = ttl;
       }
       }