From 4c5b6c94a4a2c44feda42aed7fc47a787cfab761 Mon Sep 17 00:00:00 2001 From: John Henderson Date: Wed, 26 May 2021 15:06:02 -0400 Subject: [PATCH] refactor: feedback from code review --- src/iam.ts | 5 +++-- src/iam/chainConfig.ts | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/iam.ts b/src/iam.ts index efffceb0..8efc6a36 100644 --- a/src/iam.ts +++ b/src/iam.ts @@ -989,7 +989,8 @@ export class IAM extends IAMBase { * @returns metadata string or empty string when there is no metadata * */ - async getDefinition({ type, namespace }: { type: ENSNamespaceTypes; namespace: string }) { + async getDefinition({ type, namespace }: { type: ENSNamespaceTypes; namespace: string }) + : Promise { if (this._cacheClient && type) { if (type === ENSNamespaceTypes.Roles) { return this._cacheClient.getRoleDefinition({ namespace }); @@ -1004,7 +1005,7 @@ export class IAM extends IAMBase { } if (this._domainDefinitionReader) { const roleHash = namehash(namespace); - return await this._domainDefinitionReader.read({ node: roleHash }) as IRoleDefinition | IAppDefinition | IOrganizationDefinition; + return await this._domainDefinitionReader.read({ node: roleHash }); } throw new ENSResolverNotInitializedError(); } diff --git a/src/iam/chainConfig.ts b/src/iam/chainConfig.ts index 99fef7e8..0dabc33f 100644 --- a/src/iam/chainConfig.ts +++ b/src/iam/chainConfig.ts @@ -58,7 +58,7 @@ export const messagingOptions: Record = { * Used to override existing chain configuration or add a missing one * Configuration must be set before constructing `IAM` */ -export const setChainConfig = function (chainId: number, config: Partial) { +export const setChainConfig = (chainId: number, config: Partial) => { chainConfigs[chainId] = { ...chainConfigs[chainId], ...config }; }; @@ -66,10 +66,10 @@ export const setChainConfig = function (chainId: number, config: Partial -) { +) => { cacheServerClientOptions[chainId] = { ...cacheServerClientOptions[chainId], ...options }; }; @@ -78,6 +78,6 @@ export const setCacheClientOptions = function ( * Configuration must be set before constructing `IAM` */ -export const setMessagingOptions = function (chainId: number, options: Partial) { +export const setMessagingOptions = (chainId: number, options: Partial) => { messagingOptions[chainId] = { ...messagingOptions[chainId], ...options }; };