* Add side effect check workaround (#4994) * Update packages/api/src/base/Getters.ts Co-authored-by: Jaco <jacogr@gmail.com> * Update packages/api/src/base/Getters.ts Co-authored-by: Jaco <jacogr@gmail.com> * eslint --fix * inline isUndefined Co-authored-by: Jaco <jacogr@gmail.com>
This commit is contained in:
@@ -9,8 +9,6 @@ import type { Metadata } from '@polkadot/types/metadata';
|
||||
import type { CallFunction, RegistryError } from '@polkadot/types/types';
|
||||
import type { ApiDecoration, ApiInterfaceRx, ApiTypes, DecoratedErrors, DecoratedEvents, DecoratedRpc, QueryableCalls, QueryableConsts, QueryableStorage, QueryableStorageMulti, SubmittableExtrinsics } from '../types';
|
||||
|
||||
import { assertReturn } from '@polkadot/util';
|
||||
|
||||
import { packageInfo } from '../packageInfo';
|
||||
import { findCall, findError } from './find';
|
||||
import { Init } from './Init';
|
||||
@@ -21,7 +19,11 @@ interface PkgJson {
|
||||
}
|
||||
|
||||
function assertResult<T> (value: T | undefined): T {
|
||||
return assertReturn(value, 'Api needs to be initialized before using, listen on \'ready\'');
|
||||
if (typeof value === 'undefined') {
|
||||
throw new Error('Api needs to be initialized before using, listen on \'ready\'');
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
export abstract class Getters<ApiType extends ApiTypes> extends Init<ApiType> implements ApiDecoration<ApiType> {
|
||||
|
||||
Reference in New Issue
Block a user