You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exportclassDoSomething{staticreadonlytype='[DO SOMETHING]';}
@Injectable()exportclassSomeEffectsClass{
@Effect(DoSomething)doSomething(){// Just do something}}
In this case, I get a Typescript compiler error:
Argument of type 'TypedPropertyDescriptor<() => void>' is not assignable to parameter of type 'TypedPropertyDescriptor<(args: DoSomething) => unknown>'.
Types of property 'set' are incompatible.
Type '((value: () => void) => void) | undefined' is not assignable to type '((value: (args: DoSomething) => unknown) => void) | undefined'.
Type '(value: () => void) => void' is not assignable to type '(value: (args: DoSomething) => unknown) => void'.
Types of parameters 'value' and 'value' are incompatible.ts(2345)
This error can be fixed by adding a parameter to the doSomething method:
exportclassDoSomething{staticreadonlytype='[DO SOMETHING]';}
@Injectable()exportclassSomeEffectsClass{
@Effect(DoSomething)doSomething(_: DoSomething){// Just do something}}
However, it does not really make much sense to add a parameter that is not actually used inside the function. Besides, in my case this violates the https://eslint.org/docs/rules/no-unused-vars ESLint rule that I use to make sure no unused function params are declared.
Of course, the eslint warning can be suppressed for each such usage (or it could be disabled globally), but that is suboptimal.
It would be great if the Effects decorator just supported functions with no arguments.
Typescript version: 4.3.5
The text was updated successfully, but these errors were encountered:
Maximaximum
added a commit
to Maximaximum/ngxs-effects
that referenced
this issue
Dec 1, 2021
Please consider this example:
In this case, I get a Typescript compiler error:
This error can be fixed by adding a parameter to the
doSomething
method:However, it does not really make much sense to add a parameter that is not actually used inside the function. Besides, in my case this violates the https://eslint.org/docs/rules/no-unused-vars ESLint rule that I use to make sure no unused function params are declared.
Of course, the eslint warning can be suppressed for each such usage (or it could be disabled globally), but that is suboptimal.
It would be great if the
Effects
decorator just supported functions with no arguments.Typescript version: 4.3.5
The text was updated successfully, but these errors were encountered: