Commit 8ce2a7a
committed
refactor(layers,core): genericize ILayer.getScale with IStyleScale default (stage-3 3.2)
3.2 收尾刀:把返回 `any` 的 `getScale` 收紧为泛型签名,默认
`IStyleScale`(该返回路径的实际语义结构:scale/field/type/option)。
- core `ILayer.getScale(name): any` → `getScale<T = IStyleScale>(name): T`
(`ILayerService.ts`)。默认 IStyleScale 比严格 any 安全,调用方可
opt-in 泛型;底层 `getLayerAttributeScale` 仍 any(scaler 未具名,
归后续 scale service 专属刀),经 `as T` 透传不引入类型错误。
- layers `BaseLayer.getScale<T = IStyleScale>(name): T` → 委托
`scaleLegendManager.getScale<T>(name)`;`LayerScaleLegend.getScale`
同步、`getLayerAttributeScale(name) as T`。纯内部签名对齐。
运行时零行为变化,仅类型面收紧。验证:core+layers father build
(98/278 files,d.ts 生成通过)、eslint/prettier 0 error、jest
packages/layers packages/maps 0 failed(660 passed,1 skipped
citybuilding 基线不变)。PLAN 3.2 标 ☑ 完成。1 parent af62247 commit 8ce2a7a
6 files changed
Lines changed: 54 additions & 6 deletions
File tree
- .changeset
- docs/refactoring/layers
- packages
- core/src/services/layer
- layers/src/core
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
499 | 500 | | |
500 | 501 | | |
501 | 502 | | |
502 | | - | |
| 503 | + | |
503 | 504 | | |
504 | 505 | | |
505 | 506 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
980 | 981 | | |
981 | 982 | | |
982 | 983 | | |
983 | | - | |
984 | | - | |
| 984 | + | |
| 985 | + | |
985 | 986 | | |
986 | 987 | | |
987 | 988 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | | - | |
58 | | - | |
| 58 | + | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| |||
0 commit comments