Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
267 views
in Technique[技术] by (71.8m points)

Graphql aliases with typescript

When using aliases in graphql what is the proper way to tell typescript that alias exists?

  query GetAssets {
    red: assets(type: "red") {
      uuid
      name
    }
    blue: assets(type: "blue") {
      uuid
      name
    }
  }

But the generated types file only includes:

export type Query = {
  assets?: Maybe<AssetData>
}

I'd like to access data.red, but only data.assets is a known type.

question from:https://stackoverflow.com/questions/65921676/graphql-aliases-with-typescript

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...