Files
zzy 8ece55983a feat(前端): TypeScript 重写版(esbuild IIFE 产物,暂不接管线上)
- 新增 src-ts/(22 个 .ts / 7792 行):按 core / map / card / order / nav / share /
  subscribe / ui / compat 分层,types 里有 BMapGL 与 API 响应声明
- compat/globals.ts 是唯一挂 window 的地方(292 个),覆盖模板 139 处内联事件
- esbuild 产出 static/dist/app.js(226.6 KiB,IIFE,es2019)+ README(构建/切换/回滚)
- 构建可复现:node esbuild.config.mjs、node --check、npx tsc --noEmit 均通过
- .gitignore 增加 node_modules/ 与 static/dist/*.map(sourcemap 可重生成,不入库)
- 暂不改 templates/map.html 与 MAP_ASSETS:等独立核对通过再切换,回滚=换回四个 script
2026-11-16 10:44:11 +08:00

33 lines
859 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* DOM 宽松化垫片。
*
* 原实现是原生 JS:`document.getElementById("x").value` / `.dataset` / 自定义标记
* 属性(如 `el.__kind`)都直接拿来用,不做类型收窄。搬成 TS 后若逐个加 cast,
* 会改动上百处正文、且和「逐函数等价」的目标冲突;这里改用**接口合并**给 DOM
* 接口补一个宽松索引签名:已声明成员(addEventListener 等)保持原有类型,
* 未声明成员一律 any。纯类型层面,零运行时开销、零行为变化。
*/
interface Element {
[key: string]: any;
}
interface HTMLElement {
[key: string]: any;
}
interface HTMLInputElement {
[key: string]: any;
}
interface HTMLTextAreaElement {
[key: string]: any;
}
interface HTMLCanvasElement {
[key: string]: any;
}
interface SVGSVGElement {
[key: string]: any;
}