fix: 修复 TypeScript 类型错误

This commit is contained in:
2026-01-27 20:31:57 +08:00
parent abab035b17
commit 0aa983085e
5 changed files with 36 additions and 51 deletions
+10 -5
View File
@@ -23,7 +23,8 @@ async function testAPI() {
if (data.quarters?.length > 0) {
console.log(` 第一个季度: ${data.quarters[0].quarter} (${data.quarters[0].keywordCount} 个关键词)`);
}
} catch (error) {
} catch (err) {
const error = err as Error;
console.log('❌ 失败:', error.message);
}
console.log();
@@ -38,7 +39,8 @@ async function testAPI() {
if (data.keywords?.length > 0) {
console.log(` 最热词汇: ${data.keywords[0].word} (${data.keywords[0].trendScore}分)`);
}
} catch (error) {
} catch (err) {
const error = err as Error;
console.log('❌ 失败:', error.message);
}
console.log();
@@ -53,7 +55,8 @@ async function testAPI() {
if (data.rules?.length > 0) {
console.log(` 规则示例: ${data.rules[0].name} (${data.rules[0].minScore}-${data.rules[0].maxScore}分)`);
}
} catch (error) {
} catch (err) {
const error = err as Error;
console.log('❌ 失败:', error.message);
}
console.log();
@@ -114,7 +117,8 @@ async function testAPI() {
} else {
console.log('❌ 失败:', data.error);
}
} catch (error) {
} catch (err) {
const error = err as Error;
console.log('❌ 失败:', error.message);
}
console.log();
@@ -129,7 +133,8 @@ async function testAPI() {
if (data.keywords?.length > 0) {
console.log(` 关键词: ${data.keywords.map((k: any) => k.word).join(', ')}`);
}
} catch (error) {
} catch (err) {
const error = err as Error;
console.log('❌ 失败:', error.message);
}
console.log();