@@ -3,7 +3,8 @@ import { compose } from '@ngrx/store';
3
3
const METADATA_KEY = '__@ngrx/effects__' ;
4
4
5
5
export interface EffectMetadata < T > {
6
- propertyName : keyof T ;
6
+ // Once TS is >= 2.8 replace with <Key extends Extract<keyof T, string>>
7
+ propertyName : string ;
7
8
dispatch : boolean ;
8
9
}
9
10
@@ -29,7 +30,9 @@ function setEffectMetadataEntries<T>(
29
30
}
30
31
31
32
export function Effect < T > ( { dispatch = true } = { } ) : PropertyDecorator {
32
- return function ( target : T , propertyName : keyof T ) {
33
+ // Once TS is >= 2.8 replace with <Key extends Extract<keyof T, string>>
34
+ // for propertyName.
35
+ return function ( target : T , propertyName : string ) {
33
36
const metadata : EffectMetadata < T > = { propertyName, dispatch } ;
34
37
setEffectMetadataEntries < T > ( target , [ metadata ] ) ;
35
38
} as ( target : { } , propertyName : string | symbol ) => void ;
@@ -46,7 +49,9 @@ export function getSourceMetadata<T>(instance: T): Array<EffectMetadata<T>> {
46
49
) ( instance ) ;
47
50
}
48
51
49
- export type EffectsMetadata < T > = { [ key in keyof T ] ?: { dispatch : boolean } } ;
52
+ // Once TS is >= 2.8 replace with
53
+ // {[key in <Key extends Extract<keyof T, string>>]?: { dispatch: boolean } };
54
+ export type EffectsMetadata < T > = { [ key : string ] : { dispatch : boolean } } ;
50
55
51
56
export function getEffectsMetadata < T > ( instance : T ) : EffectsMetadata < T > {
52
57
const metadata : EffectsMetadata < T > = { } ;
0 commit comments