Cleanup assignments (#2811)

* Cleanup assignments

* Small adjustments

* Cleanup AnyJson results

* Event toHuman
This commit is contained in:
Jaco Greeff
2020-10-31 12:50:44 +01:00
committed by GitHub
parent 5be8ef8f0d
commit 94a4594d32
16 changed files with 70 additions and 108 deletions
+3 -9
View File
@@ -167,11 +167,9 @@ export default class Rpc implements RpcInterface {
// decorate the sections with base and user methods
this.sections.forEach((sectionName): void => {
if (!(this as Record<string, unknown>)[sectionName as Section]) {
(this as Record<string, unknown>)[sectionName as Section] = {};
}
(this as Record<string, unknown>)[sectionName as Section] ||= {};
const section = (this as Record<string, unknown>)[sectionName as Section] as Record<string, any>;
const section = this[sectionName as Section] as Record<string, unknown>;
Object
.entries({
@@ -179,11 +177,7 @@ export default class Rpc implements RpcInterface {
...this._createInterface(sectionName, userRpc[sectionName] || {})
})
.forEach(([key, value]): void => {
// we don't want to clobber existing, i.e. when this is called again after chain is determined
if (!section[key]) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
section[key] = value;
}
section[key] ||= value;
});
});
}