File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' @antv/l7-maps ' : patch
3+ ---
4+
5+ fix(maps): 补全 BMap/TMap SDK 类型声明,修复 father dts 生成失败
6+
7+ PR #2878 将 bmap/tmap 迁移到 BaseMap 后,maps 包全量 build 在
8+ father 的 declaration 生成阶段中断 (exit 1),阻塞 fixed group
9+ 整体发布。根因是第三方 SDK 类型缺失运行时存在、但 .d.ts 未声明的
10+ 成员:
11+
12+ - @types/bmapgl 的 BMapGL.Map 未声明 on/off/getMinZoom/getMaxZoom
13+ (bmap/map.ts 直接 this.map.on(...)/getMinZoom() 调用报 TS2339/2551)
14+ - @map-component/tmap-types 的 TMap.Map 未声明 getContainer/panBy
15+ (tmap/map.ts 7 处 getContainer + panBy 报 TS2339,连带
16+ addEventListener 回调 e 隐式 any)
17+
18+ 修法 (补类型声明,非 as any 投机转换):
19+
20+ - 新增 packages/maps/map-sdk-augmentation.d.ts (ambient,与现有
21+ style.d.ts 同级,tsconfig 默认 include 覆盖):
22+ 通过 namespace 接口合并为 BMapGL.Map 补 on/off/getMinZoom/
23+ getMaxZoom,为 TMap.Map 补 getContainer()/panBy([ x,y] )。
24+ 无运行时代码,仅声明增强。
25+ - bmap/map.ts: 补 public version: string = BMAP_VERSION 声明
26+ (对齐 maplibre/map.ts、map/map.ts 惯例;此前只赋值未声明)
27+ - bmap/tmap map.ts: handleCameraChanged 中
28+ this.cameraChangedCallback(...) 改 ?. 可选调用,与 BaseMap
29+ updateView 一致 (cameraChangedCallback 为可选属性)
30+
31+ 验证: pnpm --filter @antv/l7-maps build 0 error (48 files),
32+ pnpm 全量 build 通过 (fixed group 解除阻塞),eslint 0 error。
33+ 无运行时行为变更。
Original file line number Diff line number Diff line change 1+ /**
2+ * 第三方地图 SDK 类型补全
3+ *
4+ * @types /bmapgl 与 @map-component/tmap-types 未声明、但运行时确实存在且
5+ * L7 maps 服务依赖的 BMapGL.Map / TMap.Map 成员。通过 interface 合并增强,
6+ * 不引入任何运行时代码。
7+ *
8+ * 详见: packages/maps/src/{bmap,tmap}/map.ts
9+ */
10+ declare namespace BMapGL {
11+ interface Map {
12+ // BMapGL.Map 继承 EventEmitter,但 @types/bmapgl 未声明 on/off
13+ on ( type : string , handler : ( ...args : any [ ] ) => void ) : void ;
14+ off ( type : string , handler : ( ...args : any [ ] ) => void ) : void ;
15+ // 与 setMinZoom/setMaxZoom 对应的 getter,运行时存在
16+ getMinZoom ( ) : number ;
17+ getMaxZoom ( ) : number ;
18+ }
19+ }
20+
21+ declare namespace TMap {
22+ interface Map {
23+ // 返回地图容器 DOM,@map-component/tmap-types 未声明
24+ getContainer ( ) : HTMLElement ;
25+ // 按像素偏移平移地图,运行时接受 [x, y] 元组
26+ panBy ( offset : [ number , number ] ) : void ;
27+ }
28+ }
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ export default class BMapService extends BaseMap<BMapGL.Map> {
3737 } ;
3838 protected currentStyle : any = 'normal' ;
3939
40+ public version : string = BMAP_VERSION ;
41+
4042 // Zoom 偏移量,用于对齐不同地图的显示层级
4143 protected zoomOffset : number = 1.75 ;
4244
@@ -76,7 +78,7 @@ export default class BMapService extends BaseMap<BMapGL.Map> {
7678 if ( this . viewport ) {
7779 this . viewport . syncWithMapCamera ( option as any ) ;
7880 this . updateCoordinateSystemService ( ) ;
79- this . cameraChangedCallback ( this . viewport ) ;
81+ this . cameraChangedCallback ?. ( this . viewport ) ;
8082 }
8183 } ;
8284
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ export default class TMapService extends BaseMap<TMap.Map> {
6262 if ( this . viewport ) {
6363 this . viewport . syncWithMapCamera ( option as any ) ;
6464 this . updateCoordinateSystemService ( ) ;
65- this . cameraChangedCallback ( this . viewport ) ;
65+ this . cameraChangedCallback ?. ( this . viewport ) ;
6666 }
6767 } ;
6868
You can’t perform that action at this time.
0 commit comments