I have a type of AccountQuery with specified options {SubAccount: boolean; Classification: "Asset" | "Liability";etc...
.
A relevant function can accept either an object (AccountQuery) or (|) array (AccountArrayOptions[]) as a parameter;
AccountArrayOptions is derived from AccountQuery but just in a different format {field: string; value: unknown}.
I’d like to create AccountArrayOptions from the AccountQuery type.
I would like to use something like this:
type AccountArrayPossiblity = {field: keyof AccountQuery; value: AccountQuery[keyof AccountQuery]}
But instead have to use:
type AccountArrayOptions =
{field: "SubAccount"; value: AccountQuery["SubAccount"]}
| {field: "Classification"; value: AccountQuery["Classification"]}
| {field: "AccountSubType", value: AccountQuery["AccountSubType"]}
Is there any way this will work?
CoolHandClay is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.