feat(tl-ref): find usages in array arguments

This commit is contained in:
teidesu 2021-04-14 20:00:14 +03:00
parent 14dc62e912
commit 7a463f22a3
2 changed files with 6 additions and 1 deletions

View file

@ -84,6 +84,11 @@ function prepareData(data) {
// add hex constructor id // add hex constructor id
if (item.id) item.tlId = item.id.toString(16).padStart(8, '0') if (item.id) item.tlId = item.id.toString(16).padStart(8, '0')
if (item.arguments) item.arguments.forEach((arg) => {
// raw non-array type for usages count
arg.rawType = arg.type.replace(/\[]$/, '')
})
// add typescript types for the item and arguments // add typescript types for the item and arguments
// basically copy-pasted from generate-types.js // basically copy-pasted from generate-types.js
const prefix_ = item.prefix === 'mtproto/' ? 'mt_' : '' const prefix_ = item.prefix === 'mtproto/' ? 'mt_' : ''

View file

@ -471,7 +471,7 @@ export const query = graphql`
usageTypes: allTlObject( usageTypes: allTlObject(
filter: { filter: {
prefix: { eq: $prefix } prefix: { eq: $prefix }
arguments: { elemMatch: { type: { eq: $name } } } arguments: { elemMatch: { rawType: { eq: $name } } }
} }
) { ) {
nodes { nodes {