Module: features/decorators/common
Interfaces
EffectFeatureOptions
• EffectFeatureOptions<T
>: Object
Type parameters
Name | Type |
---|---|
T | unknown |
Name | Type |
---|---|
effect | Computable <T > |
Defined in
profectus/src/features/decorators/common.ts:30
Type Aliases
Decorator
Ƭ Decorator<FeatureOptions
, BaseFeature
, GenericFeature
, S
>: Object
Type parameters
Name | Type |
---|---|
FeatureOptions | FeatureOptions |
BaseFeature | object |
GenericFeature | BaseFeature |
S | extends State = State |
Type declaration
Name | Type |
---|---|
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
Name | Type |
---|---|
T | extends 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
Name | Type |
---|---|
T | unknown |
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
createRepeatable<RepeatableOptions & EffectFeatureOptions>(() => ({
effect() { return Decimal.pow(2, this.amount); },
...
}), effectDecorator) as GenericUpgrade & GenericEffectFeature;