Commit 0ae3574
committed
update all code to work with typescript 6
Many modules used a pattern that initialized an object with `undefined`
placeholders and then patched on real implementations afterwards (e.g.
`const self = { add: undefined, render: undefined }; self.add = function(...) {...}`).
Under TS 6's strict checking, those properties infer as literal `undefined`,
which breaks every later assignment and call site. They were rewritten to
either fully built objects (e.g. container.ts, math.ts, forcegraph/draw.ts,
utils/node.ts, sidebar.ts, legend.ts, title.ts, tabs.ts, linklist.ts,
nodelist.ts, sorttable.ts) or typed stubs + assignments where needed.
lib/utils/version.ts: Rewritten as a class so this and new are correctly typed.
lib/utils/router.ts: Uses ObjectsLinksAndNodes for objects / setData, safer handling of nodeDict, and routeGroup for regex capture data; Target.gotoNode matches real usage (node, nodeDict).
lib/utils/helper.ts: showStat return type fixed to VNode (it always returned a snabbdom VNode; the prior HTMLDivElement type was a cast).
lib/forcegraph.ts: Stricter typing for graph state, forceLink.links!(…), MapLink initial x/y, and gotoNode/gotoLink return arrays instead of calling resetView() where a coordinate array is required.
lib/proportions.ts: Stubs, GenericFilter vs Filter in watchFilters, gateway modifier return type.
lib/infobox/main.ts: Avoids Node / Link name clashes with DOM/utils/node, uses an InfoboxPanel type and as unknown as for panel instances.
lib/infobox/link.ts and lib/infobox/node.ts: Same self-initialization pattern fix. node.ts also factors the config-driven dynamic lookup (nodef["show" + value], node[value]) behind named local types (NodeFieldValue, NodefShowers, NodeRecord).
lib/map/button.ts (was button.js) and lib/map/locationmarker.ts (was locationmarker.js): Migrated to TypeScript. button.ts names the Leaflet-extend shapes once via ButtonBaseThis / ButtonOnAddThis / ButtonControl / ButtonCtor; the only suppression is a single @ts-expect-error on `Map.locate({setView: "untilPan"})` which Leaflet supports at runtime but @types/leaflet only types as boolean. locationmarker.ts is now a proper ES6 class extending L.CircleMarker.1 parent bf0f9e5 commit 0ae3574
39 files changed
Lines changed: 1283 additions & 1190 deletions
File tree
- lib
- filters
- forcegraph
- infobox
- map
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 14 | + | |
24 | 15 | | |
25 | | - | |
26 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
27 | 23 | | |
28 | 24 | | |
29 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
12 | 17 | | |
13 | 18 | | |
14 | 19 | | |
| |||
0 commit comments