@ngxs/store 3.8.0-dev.master-d898d7e → 3.8.0-dev.master-e6e913d

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.
@@ -1038,15 +1038,22 @@
1038
1038
  * if another decorator was used, e.g. pipes).
1039
1039
  */
1040
1040
  function ensureStateClassIsInjectable(stateClass) {
1041
+ if (jit_hasInjectableAnnotation(stateClass) || aot_hasNgInjectableDef(stateClass)) {
1042
+ return;
1043
+ }
1044
+ console.warn(getUndecoratedStateInIvyWarningMessage(stateClass.name));
1045
+ }
1046
+ function aot_hasNgInjectableDef(stateClass) {
1041
1047
  // `ɵprov` is a static property added by the NGCC compiler. It always exists in
1042
1048
  // AOT mode because this property is added before runtime. If an application is running in
1043
1049
  // JIT mode then this property can be added by the `@Injectable()` decorator. The `@Injectable()`
1044
1050
  // decorator has to go after the `@State()` decorator, thus we prevent users from unwanted DI errors.
1045
- var ngInjectableDef = stateClass.ɵprov;
1046
- if (!ngInjectableDef) {
1047
- // Don't warn if Ivy is disabled or `ɵprov` exists on the class
1048
- console.warn(getUndecoratedStateInIvyWarningMessage(stateClass.name));
1049
- }
1051
+ return !!stateClass.ɵprov;
1052
+ }
1053
+ function jit_hasInjectableAnnotation(stateClass) {
1054
+ // `ɵprov` doesn't exist in JIT mode (for instance when running unit tests with Jest).
1055
+ var annotations = stateClass.__annotations__ || [];
1056
+ return annotations.some(function (annotation) { return (annotation === null || annotation === void 0 ? void 0 : annotation.ngMetadataName) === 'Injectable'; });
1050
1057
  }
1051
1058
 
1052
1059
  /**