[FIX] app: support for arbitrary descriptors in env

Before this commit, when defining a getter in the env passed to the App,
the value was read, losing the definition of the property.

After this commit, declaring a getter in the env works as expected:
the property stays a getter.
This commit is contained in:
Lucas Perais (lpe)
2021-12-02 12:48:34 +01:00
committed by Aaron Bohy
parent 3c12519277
commit b66d5231d3
3 changed files with 44 additions and 2 deletions
+2 -1
View File
@@ -44,7 +44,8 @@ export class App<T extends typeof Component = any> extends TemplateSet {
console.info(DEV_MSG);
}
if (config.env) {
this.env = Object.freeze(Object.assign({}, config.env));
const descrs = Object.getOwnPropertyDescriptors(config.env);
this.env = Object.freeze(Object.defineProperties({}, descrs));
}
if (config.translateFn) {
this.translateFn = config.translateFn;