edgedb-js icon indicating copy to clipboard operation
edgedb-js copied to clipboard

Wrong property types when access a link

Open awerlogus opened this issue 1 year ago • 0 comments

Code

The case when it's ok

const userSubscriptions = e.select(e.User, () => ({
  subscriptions: subscription => ({
    role: subscription['@role']
  })
}))

// (parameter) user: {
//   subscriptions: {
//     role: number | null;
//   }[];
// } | null
userSubscriptions.run().then(user => {})

Now I access the property subscriptions: the role is being erased and the default { id: string } is put instead.

const subscriptions = e.select(e.User, () => ({
  subscriptions: subscription => ({
    role: subscription['@role']
  })
})).subscriptions

// (parameter) subscriptions: {
//   id: string;
// }[]
subscriptions.run().then(subscriptions => {})

But when running the query, the result contains role property, not id

Versions (please complete the following information):

  • EdgeDB CLI version (e.g. 2.0): 4.0.2+be1da73
  • edgedb-js version (e.g. 0.20.10;): 1.4.1
  • @edgedb/generate version (e.g. 0.0.7;): 0.4.1
  • TypeScript version: Version 5.4.0-dev.20240120

awerlogus avatar Mar 02 '24 03:03 awerlogus