@mnemonica/tactica 0.3.7 → 0.3.8

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 CHANGED
@@ -464,11 +464,14 @@ The analyzer infers property types from constructor bodies and class members. Su
464
464
  | `this.x = a + b` (where `a, b: number`) | `number` |
465
465
  | `` this.x = `${a} ${b}` `` | `string` |
466
466
  | `this.x = data.field` | type of `data.field` from the parameter annotation |
467
+ | `this.x = data.field` where `data: SomeNamedType` (alias/interface/class) | type of the field from the resolved declaration — import-aware, inherited members included; a bare `this.x = data` keeps the full expanded shape |
467
468
  | `this.x = data.field \|\| []` | type of the fallback expression |
468
469
  | `this.x = data.field ? a : b` | type of the truthy branch |
469
470
  | `Object.assign(this, data)` | all fields of `data`'s type annotation |
470
471
  | async / sync constructor functions | same rules |
471
472
 
473
+ An existing annotation always beats a weaker inference: `unknown` (and `unknown`-bearing guesses like `Array<unknown>`) never overwrites a known type — `Record<string, unknown>` IS a known type — and an overwrite never drops an optionality modifier.
474
+
472
475
  When inference fails the property's type falls back to `unknown` (or `any` in some Topologica paths) — safe, and you can refine manually.
473
476
 
474
477
  ### Referenced types in constructor signatures