From 22284ab7206717b19b20be389f062e115a34aa2a Mon Sep 17 00:00:00 2001 From: Alex Okrushko Date: Tue, 24 Jul 2018 21:43:11 -0400 Subject: [PATCH] refactor(store): adjust types to be compatible with TypeScript 2.7 and 2.9 (#1193) --- modules/effects/src/effects_metadata.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/effects/src/effects_metadata.ts b/modules/effects/src/effects_metadata.ts index 56db0f382c..4596bd628c 100644 --- a/modules/effects/src/effects_metadata.ts +++ b/modules/effects/src/effects_metadata.ts @@ -3,7 +3,8 @@ import { compose } from '@ngrx/store'; const METADATA_KEY = '__@ngrx/effects__'; export interface EffectMetadata { - propertyName: keyof T; + // Once TS is >= 2.8 replace with > + propertyName: string; dispatch: boolean; } @@ -29,7 +30,9 @@ function setEffectMetadataEntries( } export function Effect({ dispatch = true } = {}): PropertyDecorator { - return function(target: T, propertyName: keyof T) { + // Once TS is >= 2.8 replace with > + // for propertyName. + return function(target: T, propertyName: string) { const metadata: EffectMetadata = { propertyName, dispatch }; setEffectMetadataEntries(target, [metadata]); } as (target: {}, propertyName: string | symbol) => void; @@ -46,7 +49,9 @@ export function getSourceMetadata(instance: T): Array> { )(instance); } -export type EffectsMetadata = { [key in keyof T]?: { dispatch: boolean } }; +// Once TS is >= 2.8 replace with +// {[key in >]?: { dispatch: boolean } }; +export type EffectsMetadata = { [key: string]: { dispatch: boolean } }; export function getEffectsMetadata(instance: T): EffectsMetadata { const metadata: EffectsMetadata = {};