@dsivd/prestations-ng 19.2.0-beta.12 → 19.2.0-beta.13

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/UPGRADING_V19.md CHANGED
@@ -1448,6 +1448,36 @@ When using `IntelliJ`, you can run code inspection on your project to fix deprec
1448
1448
  - In your `tsconfig.json` file, add `"strict": true` in `compilerOptions` and remove `alwaysStrict`, `noImplicitThis`, `strictBindCallApply` and `strictFunctionTypes` as they are already included in `strict` mode.
1449
1449
  - In your `tsconfig.json` file, remove `useDefineForClassFields` from `compilerOptions`.
1450
1450
 
1451
+ Without `useDefineForClassFields: false`, the class fields follow the standard semantics: they are initialized before
1452
+ the body of the constructor, so before the parameter properties, and a field declared again in a subclass overwrites
1453
+ the value set by the parent class. Two errors can appear:
1454
+
1455
+ - TS2729 (`Property 'x' is used before its initialization`): a field initializer uses a parameter property of the
1456
+ constructor. Use `inject()` in the initializer, or assign the field in the constructor. Don't move a
1457
+ `private readonly x = inject(X)` field above the public fields: the `@typescript-eslint/member-ordering` rule of
1458
+ `@dsivd/prestations-ng/eslint` wants the public fields first.
1459
+
1460
+ ```diff
1461
+ - readonly items = toSignal(this.itemService.getItems(), { initialValue: [] });
1462
+ -
1463
+ - constructor(private readonly itemService: ItemService) {}
1464
+ + readonly items = toSignal(inject(ItemService).getItems(), { initialValue: [] });
1465
+ ```
1466
+
1467
+ ```ts
1468
+ readonly items: Signal<Item[]>;
1469
+
1470
+ private readonly itemService = inject(ItemService);
1471
+
1472
+ constructor() {
1473
+ this.items = toSignal(this.itemService.getItems(), { initialValue: [] });
1474
+ }
1475
+ ```
1476
+
1477
+ - TS2612 (`Property 'x' will overwrite the base property`): a subclass declares again a field of its parent class,
1478
+ e.g. to narrow its type. Add `declare` (`declare form: MyForm | null | undefined;`) or remove the declaration, but
1479
+ never add an initializer: it would overwrite the value set by the parent class.
1480
+
1451
1481
  Now fix your project until no more errors (unlike `tsc -b`, these commands write nothing):
1452
1482
 
1453
1483
  ```bash
@@ -1618,6 +1648,10 @@ Pay attention to:
1618
1648
  }
1619
1649
  ```
1620
1650
 
1651
+ - the fields read by the template and set in `ngAfterViewInit()`, `ngAfterContentInit()` or `ngAfterViewChecked()`:
1652
+ derive them with `computed()` from `viewChild()` or `contentChild()` (see "Deriving a state from view queries"
1653
+ in [GOOD_PRACTICES.md](GOOD_PRACTICES.md)).
1654
+
1621
1655
  - `NgZone`: `onStable`, `onMicrotaskEmpty` and `onUnstable` never emit without zone.js, and `run()` or
1622
1656
  `runOutsideAngular()` are useless. To act on the rendered DOM (focus, scroll...), replace them, as well as the
1623
1657
  `setTimeout()` waiting for the view, by `afterNextRender()`. `AbstractMenuPageComponent.ngZone` is deprecated.
package/package.json CHANGED
@@ -39,7 +39,7 @@
39
39
  "ng-update": {
40
40
  "migrations": "./schematics/migration-collection.json"
41
41
  },
42
- "version": "19.2.0-beta.12",
42
+ "version": "19.2.0-beta.13",
43
43
  "module": "fesm2022/dsivd-prestations-ng.mjs",
44
44
  "typings": "types/dsivd-prestations-ng.d.ts",
45
45
  "exports": {