diff --git a/packages/tl-reference/scripts/prepare-data.js b/packages/tl-reference/scripts/prepare-data.js index 9e62fadb..33bd9478 100644 --- a/packages/tl-reference/scripts/prepare-data.js +++ b/packages/tl-reference/scripts/prepare-data.js @@ -84,6 +84,11 @@ function prepareData(data) { // add hex constructor id 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 // basically copy-pasted from generate-types.js const prefix_ = item.prefix === 'mtproto/' ? 'mt_' : '' diff --git a/packages/tl-reference/src/templates/tl-object.tsx b/packages/tl-reference/src/templates/tl-object.tsx index b2a9a10e..93bd4160 100644 --- a/packages/tl-reference/src/templates/tl-object.tsx +++ b/packages/tl-reference/src/templates/tl-object.tsx @@ -471,7 +471,7 @@ export const query = graphql` usageTypes: allTlObject( filter: { prefix: { eq: $prefix } - arguments: { elemMatch: { type: { eq: $name } } } + arguments: { elemMatch: { rawType: { eq: $name } } } } ) { nodes {