diff --git a/libs/governance/src/lib/proposals-queries/proposals-queries.ts b/libs/governance/src/lib/proposals-queries/proposals-queries.ts index 99be43018..9e66b33bd 100644 --- a/libs/governance/src/lib/proposals-queries/proposals-queries.ts +++ b/libs/governance/src/lib/proposals-queries/proposals-queries.ts @@ -16,14 +16,15 @@ type Proposal = { type ProposalEdge = { node: Proposal; }; +type ProposalEdges = { + edges: (ProposalEdge | null)[] | null; +}; type ProposalsConnection = { - proposalsConnection: { - edges: (ProposalEdge | null)[] | null; - }; + proposalsConnection: ProposalEdges | null; }; export const getProposals = (data?: ProposalsConnection) => { - const proposals = data?.proposalsConnection.edges + const proposals = data?.proposalsConnection?.edges ?.filter((e) => e?.node) .map((e) => e?.node); return proposals ? (proposals as Proposal[]) : []; diff --git a/libs/react-helpers/src/lib/assets.ts b/libs/react-helpers/src/lib/assets.ts index c734aca92..7c00c0b00 100644 --- a/libs/react-helpers/src/lib/assets.ts +++ b/libs/react-helpers/src/lib/assets.ts @@ -45,10 +45,10 @@ type AssetEdge = { node: T; }; +type AssetEdges = { edges: (AssetEdge | null)[] | null }; + type AssetsConnection = { - assetsConnection: { - edges: (AssetEdge | null)[] | null; - }; + assetsConnection: AssetEdges | null; }; export const getAssets = (data?: AssetsConnection): Asset[] =>