From 9ee9ba866841500936405c7c9dabbb773d822b65 Mon Sep 17 00:00:00 2001 From: Misode Date: Wed, 7 Aug 2024 00:31:19 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Remove=20collection=20length=20e?= =?UTF-8?q?rrors=20in=20nbt=20predicates=20(#1559)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/nbt/src/checker/index.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/nbt/src/checker/index.ts b/packages/nbt/src/checker/index.ts index c7a2533c1..c5fc397b6 100644 --- a/packages/nbt/src/checker/index.ts +++ b/packages/nbt/src/checker/index.ts @@ -129,10 +129,15 @@ export function typeDefinition( } return [] }, - reportError: mcdoc.runtime.checker.getDefaultErrorReporter( - ctx, - mcdoc.runtime.checker.getDefaultErrorRange, - ), + reportError: (error) => { + if (options.isPredicate && error.kind === 'invalid_collection_length') { + return + } + mcdoc.runtime.checker.getDefaultErrorReporter( + ctx, + mcdoc.runtime.checker.getDefaultErrorRange, + )(error) + }, attachTypeInfo: (node, definition, desc = '') => { node.typeDef = definition node.requireCanonical = options.isPredicate