0
私はapollo-codegenを使用して、私のプロジェクトのtsxファイルに埋め込まれたGraphQLクエリからTypeScript型を生成しています。生成されたタイプの例は:Typescript:名前付きの型の子である匿名型を参照するにはどうすればよいですか?
export type MooQuery = {
wines: {
edges: Array< {
node: {
nodeId: string,
wineName: string | null,
wineryId: number | null,
vintageId: number | null,
uomId: number | null
},
} | null > | null,
} | null,
};
Iは、各ノード反応成分をレンダリングするヘルパーメソッドに「ノード」を渡すことになります。私は次のようなことをしたいと思っています:
renderHelper(node: MooQuery.wines.edges.node) { // this won't work
}
私が欲しいものを達成する方法はありますか?私が望んでいることは理にかなっていますか?
これはすばらしい、ありがとう!しかし、私は非常に奇妙なエラーが発生します: 'エラーTS2339:プロパティ 'edges'はタイプ '{edges:({node:{nodeId:string; wineName:string | null; wineryId:number | null; vintageId:..私には矛盾しているように見えますか? –
私はそれを再現できません。新しい質問を開き、これにリンクすることをお勧めします。 –
ありがとうございます:) –