assertAccountDecoded
Call Signature
Asserts that an account stores decoded data, ie. not a Uint8Array.
Note that it does not check the shape of the data matches the decoded type, only that it is not a
Uint8Array.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
TData extends object | - | The type of this account's data. |
TAddress extends string | string | Supply a string literal to define an account having a particular address. |
Parameters
| Parameter | Type |
|---|---|
account | Account< | Uint8Array<ArrayBufferLike> | TData, TAddress> |
Returns
asserts account is Account<TData, TAddress>
Example
This is particularly useful for narrowing the result of fetching a JSON parsed account.
Call Signature
Asserts that an account stores decoded data, ie. not a Uint8Array.
Note that it does not check the shape of the data matches the decoded type, only that it is not a
Uint8Array.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
TData extends object | - | The type of this account's data. |
TAddress extends string | string | Supply a string literal to define an account having a particular address. |
Parameters
| Parameter | Type |
|---|---|
account | MaybeAccount< | Uint8Array<ArrayBufferLike> | TData, TAddress> |
Returns
asserts account is MaybeAccount<TData, TAddress>
Example
This is particularly useful for narrowing the result of fetching a JSON parsed account.