@mnemonica/tactica 0.3.15 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/lib/analyzer.js +52 -11
- package/lib/cli.js +14 -2
- package/lib/topologica-analyzer.js +4 -6
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -41,6 +41,8 @@ npm install --save-dev @mnemonica/tactica
|
|
|
41
41
|
|
|
42
42
|
`mnemonica` is a peer dependency (>= 1.0.1).
|
|
43
43
|
|
|
44
|
+
Tactica bundles its own TypeScript compiler (6.x) as a regular dependency, so it installs and runs regardless of the TypeScript version your project uses — including TypeScript 7, whose npm package no longer exposes the classic compiler API. Your `tsconfig.json` is only ever *parsed* (never emitted), so TS5-era options like `baseUrl` keep working even though TS6 marks them deprecated.
|
|
45
|
+
|
|
44
46
|
## Usage
|
|
45
47
|
|
|
46
48
|
### CLI
|
|
@@ -359,7 +361,7 @@ Tactica then emits:
|
|
|
359
361
|
- Prefixed instance types in `.tactica/types.ts`, e.g. `AppCollectionRegistry_UserType` and `AppCollectionRegistry_UserType_AdminType`.
|
|
360
362
|
- A `declare module '<relative path to this file>'` block in `.tactica/registry.ts` that augments `AppCollectionRegistry` with `'UserType'` and `'UserType.AdminType'` entries.
|
|
361
363
|
|
|
362
|
-
Once `.tactica/registry.ts` is part of your `tsc` compilation, `AppCollection.lookup('UserType')` and `AppCollection.lookup('UserType.AdminType')` are fully typed.
|
|
364
|
+
Once `.tactica/registry.ts` is part of your `tsc` compilation, `AppCollection.lookup('UserType')` and `AppCollection.lookup('UserType.AdminType')` are fully typed. Constructor-relative lookups resolve too: a variable bound to `AppCollection.lookup('UserType')` resolves `.lookup('AdminType')` relative-first (the type's own subtypes, then the collection root) — the same law as for default-collection types.
|
|
363
365
|
|
|
364
366
|
Custom collections also support `decorate()` for root types:
|
|
365
367
|
|
|
@@ -473,7 +475,7 @@ The analyzer infers property types from constructor bodies and class members. Su
|
|
|
473
475
|
| `this.x = []` / `new Array()` | `Array<…>` |
|
|
474
476
|
| `this.x = {}` | `object` |
|
|
475
477
|
| `this.x = new Date()` | `Date` |
|
|
476
|
-
| `this.x = new Map()` / `new Set()` | `Map
|
|
478
|
+
| `this.x = new Map()` / `new Set()` | `Map<unknown, unknown>` / `Set<unknown>` — a bare generic is never emitted (TS2314); explicit arguments survive: `new Map<string, number>()` → `Map<string, number>` |
|
|
477
479
|
| `this.x = Date.now()` | `number` |
|
|
478
480
|
| `this.x = parseInt(…)` / `parseFloat(…)` | `number` |
|
|
479
481
|
| `this.x = String(…)` / `Number(…)` / `Boolean(…)` | `string` / `number` / `boolean` |
|