Skip to content
On this page

Module: features/decorators/common

Interfaces

EffectFeatureOptions

EffectFeatureOptions<T>: Object

Type parameters

NameType
Tunknown
NameType
effectComputable<T>

Defined in

profectus/src/features/decorators/common.ts:30

Type Aliases

Decorator

Ƭ Decorator<FeatureOptions, BaseFeature, GenericFeature, S>: Object

Type parameters

NameType
FeatureOptionsFeatureOptions
BaseFeatureobject
GenericFeatureBaseFeature
Sextends State = State

Type declaration

NameType
getGatheredProps?(feature: OptionsObject<FeatureOptions, BaseFeature & { id: string }, GenericFeature>) => Partial<OptionsObject<FeatureOptions, BaseFeature & { id: string }, GenericFeature>>
getPersistentData?() => Record<string, Persistent<S>>
postConstruct?(feature: OptionsObject<FeatureOptions, BaseFeature & { id: string }, GenericFeature>) => void
preConstruct?(feature: OptionsObject<FeatureOptions, BaseFeature & { id: string }, GenericFeature>) => void

Defined in

profectus/src/features/decorators/common.ts:10


EffectFeature

Ƭ EffectFeature<T>: Replace<T, { effect: GetComputableType<T["effect"]> }>

Type parameters

NameType
Textends EffectFeatureOptions

Defined in

profectus/src/features/decorators/common.ts:34


GenericDecorator

Ƭ GenericDecorator: Decorator<unknown>

Defined in

profectus/src/features/decorators/common.ts:28


GenericEffectFeature

Ƭ GenericEffectFeature<T>: Replace<EffectFeature<EffectFeatureOptions>, { effect: ProcessedComputable<T> }>

Type parameters

NameType
Tunknown

Defined in

profectus/src/features/decorators/common.ts:39

Variables

effectDecorator

Const effectDecorator: Decorator<EffectFeatureOptions, unknown, GenericEffectFeature>

Allows the usage of an effect field in the decorated feature. To function properly, the createFeature() function must have its generic type extended by EffectFeatureOptions. To allow access to the decorated values outside the createFeature() function, the output type must be extended by GenericEffectFeature.

Example

ts
createRepeatable<RepeatableOptions & EffectFeatureOptions>(() => ({
  effect() { return Decimal.pow(2, this.amount); },
  ...
}), effectDecorator) as GenericUpgrade & GenericEffectFeature;

Defined in

profectus/src/features/decorators/common.ts:55