Skip to content

fix(maps): 补全 BMap/TMap SDK 类型声明,修复 dts 生成失败 - #2884

Merged
lzxue merged 1 commit into
masterfrom
fix/maps-bmap-tmap-types
Jul 23, 2026
Merged

fix(maps): 补全 BMap/TMap SDK 类型声明,修复 dts 生成失败#2884
lzxue merged 1 commit into
masterfrom
fix/maps-bmap-tmap-types

Conversation

@lzxue

@lzxue lzxue commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

背景

为 `@antv/l7-source` 渐进式重构发 beta(PR #2882 已合并)时,全量 `pnpm build` 在 `@antv/l7-maps` 的 father declaration 生成阶段中断(exit 1),阻塞 fixed group `["@antv/l7","@antv/l7-*"]` 整体发布。

根因:PR #2878 将 bmap/tmap 迁移到 BaseMap 后,第三方 SDK 类型缺失「运行时存在但 `.d.ts` 未声明」的成员:

  • `@types/bmapgl` 的 `BMapGL.Map` 未声明 `on` / `off` / `getMinZoom` / `getMaxZoom`
  • `@map-component/tmap-types` 的 `TMap.Map` 未声明 `getContainer` / `panBy`(连带 `addEventListener` 回调 `e` 隐式 any)

共 18 处 TS 错误(bmap 7 + tmap 11),与 source 重构无关,是 #2878 的既存遗留。

修法(补类型声明,非 `as any`)

  • 新增 `packages/maps/map-sdk-augmentation.d.ts`(ambient,与现有 `style.d.ts` 同级,tsconfig 默认 include 覆盖):通过 namespace 接口合并为 `BMapGL.Map` 补 `on/off/getMinZoom/getMaxZoom`,为 `TMap.Map` 补 `getContainer()/panBy([x,y])`。无运行时代码,纯声明增强。
  • `bmap/map.ts`:补 `public version: string = BMAP_VERSION` 声明(对齐 `maplibre/map.ts`、`map/map.ts` 惯例;此前只赋值未声明)。
  • `bmap/map.ts` / `tmap/map.ts`:`handleCameraChanged` 中 `this.cameraChangedCallback(...)` 改 `?.` 可选调用,与 `BaseMap.updateView` 一致(`cameraChangedCallback` 为可选属性)。

验证

  • `pnpm --filter @antv/l7-maps build`:0 error,48 files transformed
  • `pnpm build`(全量):通过,fixed group 解除阻塞
  • `pnpm --filter @antv/l7-maps lint`:0 error(1 个 tmap/maploader.ts 既存无关 warning)
  • 无运行时行为变更(纯类型补全 + 一处可选调用守卫)

改动文件

  • `packages/maps/map-sdk-augmentation.d.ts`(新增)
  • `packages/maps/src/bmap/map.ts`
  • `packages/maps/src/tmap/map.ts`
  • `.changeset/fix-maps-bmap-tmap-types.md`(`@antv/l7-maps`: patch)

合并后恢复 source beta 发布流程(beta 本地准备状态已暂存保留)。

#2878 迁移 bmap/tmap 到 BaseMap 后 SDK 类型缺
on/off/getMinZoom/getMaxZoom/getContainer/panBy 等成员声明,
father declaration 生成失败, 阻塞 fixed group 发布。

新增 ambient map-sdk-augmentation.d.ts 用 namespace 接口合并
补齐; bmap 补 version 声明; handleCameraChanged 改可选调用
cameraChangedCallback?.。

全量 pnpm build 通过, 无运行时行为变更。
详 .changeset/fix-maps-bmap-tmap-types.md
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4f58e73

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@antv/l7-maps Patch
@antv/l7 Patch
@antv/l7-layers Patch
@antv/l7-scene Patch
@antv/l7-three Patch
@antv/l7-component Patch
@antv/l7-core Patch
@antv/l7-map Patch
@antv/l7-renderer Patch
@antv/l7-source Patch
@antv/l7-test-utils Patch
@antv/l7-utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@lzxue
lzxue merged commit 9a455f4 into master Jul 23, 2026
5 checks passed
@lzxue
lzxue deleted the fix/maps-bmap-tmap-types branch July 23, 2026 12:14
lzxue added a commit that referenced this pull request Jul 23, 2026
Beta release of l7-source progressive refactor (PR #2882 + docs #2883 + maps #2884).

Includes test-utils peerDeps cleanup fixing the changeset 3.0.0 version coercion bug.

Published under beta dist-tag. latest remains 2.29.1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant