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
Today the $conf property of EsDay is a Record<string, SimpleType. This enables e.g. plugins to add arbitrary properties to this object that can be used by the plugin.
If we changed the type of $conf to the instance of a class (to be created), a plugin can use module augmentation to add properties to $conf. This way the new properties do not have to be of union type SimpleType as today, but can be of a specific simple type (e.g. boolean). This would enable type checking by the typescript compiler.
Another positive effect would be that we get an automatic documentation of the configuration parameters of a plugin.
The used class should have a clone method to replace the destructuring command used with the current implementation.
This could be implemented like this (based on a github gist:
clone() {
return Object.assign(
Object.create(
// Set the prototype of the new object to the prototype of the instance.
// Used to allow new object behave like class instance.
Object.getPrototypeOf(this)
),
this
)
}
The text was updated successfully, but these errors were encountered:
Today the
$conf
property of EsDay is aRecord<string, SimpleType
. This enables e.g. plugins to add arbitrary properties to this object that can be used by the plugin.If we changed the type of
$conf
to the instance of a class (to be created), a plugin can use module augmentation to add properties to$conf
. This way the new properties do not have to be of union type SimpleType as today, but can be of a specific simple type (e.g. boolean). This would enable type checking by the typescript compiler.Another positive effect would be that we get an automatic documentation of the configuration parameters of a plugin.
The used class should have a clone method to replace the destructuring command used with the current implementation.
This could be implemented like this (based on a github gist:
The text was updated successfully, but these errors were encountered: