I'm struggling to comprehend how to rectify this typographical error.
Here's the snippet of code causing me trouble:
<script lang="ts">
import type { PlayerListQuery } from "queries";
export let player: PlayerListQuery["playerList"]["edges"][0]["node"];
</script>
involving PlayerListQuery
:
export type PlayerListQuery = {
__typename?: "Query";
playerList: {
__typename?: "PlayerConnection";
edges?: Array<{
__typename?: "PlayerEdge";
cursor: any;
node?: {
__typename?: "Player";
name?: string | null;
age?: number | null;
id: string;
} | null;
} | null> | null;
pageInfo: {
__typename?: "PageInfo";
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor?: any | null;
endCursor?: any | null;
};
};
};
The error message reads as follows:
Property '0' does not exist on type '({ __typename?: "PlayerEdge" | undefined; cursor: any; node?: { __typename?: "Player" | undefined; name?: string | null | undefined; ... more ...; } | null | undefined; } | null)[] | null | undefined'.ts(2339)
This pertains to
["edges"][0]["node"]
.
What steps can be taken to correct this issue?