feat: 前端迁移至 TypeScript,集成 Biome 格式化与代码检查

- app.js → app.ts:添加完整类型标注、接口定义
- audio-processor.js → audio-processor.ts:AudioWorklet 类型化
- vite.config.js → vite.config.ts
- 添加 tsconfig.json、vite-env.d.ts
- 集成 Biome 默认配置(lint + format),通过全部检查
- package.json 添加 check/typecheck 脚本
- index.html 修复无障碍问题(button type、SVG title)
This commit is contained in:
2026-03-01 05:40:06 +08:00
parent b22b27db75
commit d0be096165
13 changed files with 776 additions and 598 deletions

View File

@@ -24,8 +24,9 @@
</section>
<section id="mic-section">
<button id="mic-btn" disabled>
<svg viewBox="0 0 24 24" width="48" height="48" fill="currentColor">
<button id="mic-btn" type="button" disabled>
<svg viewBox="0 0 24 24" width="48" height="48" fill="currentColor" aria-label="麦克风" role="img">
<title>麦克风</title>
<path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/>
<path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/>
</svg>
@@ -35,13 +36,13 @@
<section id="history-section">
<div class="history-header">
<h2>历史记录</h2>
<button id="clear-history" class="text-btn">清空</button>
<button id="clear-history" type="button" class="text-btn">清空</button>
</div>
<ul id="history-list"></ul>
<p id="history-empty" class="placeholder">暂无记录</p>
</section>
</div>
<script type="module" src="app.js"></script>
<script type="module" src="app.ts"></script>
</body>
</html>