@@ -316,17 +316,25 @@ export class SyntaxChecker {
316316 }
317317
318318 /**
319- * Check if variant has errors
319+ * Check if variant has any issues (malformations, parameter errors, type mismatches)
320320 * @param variant - Parsed variant object
321- * @param params - Actual parameter array
322- * @param actualParamNames - Array of actual parameter names
323- * @returns True if variant has errors or malformation at current warning level
321+ * @param params - Actual parameter array (can be empty/undefined)
322+ * @param actualParamNames - Array of actual parameter names (can be empty)
323+ * @returns True if variant has any issues at current warning level
324324 */
325- hasVariantErrors ( variant : ParsedVariant , params : DocumentationParameter [ ] , actualParamNames : string [ ] ) : boolean {
325+ private hasVariantIssues ( variant : ParsedVariant , params : DocumentationParameter [ ] = [ ] , actualParamNames : string [ ] = [ ] ) : boolean {
326+ // Always check for malformations first
327+ const hasMalformation = this . hasRelevantMalformation ( variant ) ;
328+
329+ // Only check parameter errors if we have params to validate against
330+ if ( params . length === 0 ) {
331+ return hasMalformation ;
332+ }
333+
326334 const { extraParams, typeMismatches, returnTypeMismatches } = this . validateVariantParameters ( variant , params , actualParamNames ) ;
327335 const hasParameterErrors = extraParams . length > 0 || typeMismatches . length > 0 || returnTypeMismatches . length > 0 ;
328- const hasMalformation = this . hasRelevantMalformation ( variant ) ;
329- return hasParameterErrors || hasMalformation ;
336+
337+ return hasMalformation || hasParameterErrors ;
330338 }
331339
332340 /**
@@ -392,24 +400,14 @@ export class SyntaxChecker {
392400
393401 // Check if there are any errors/warnings
394402 let hasErrors = false ;
403+ const actualParamNames = params && params . length > 0 ? this . extractActualParamNames ( params ) : [ ] ;
395404
396- if ( params && params . length > 0 ) {
397- const actualParamNames = this . extractActualParamNames ( params ) ;
398-
399- // Check each parsed variant for errors
400- parsedParams . forEach ( ( variant ) => {
401- if ( this . hasVariantErrors ( variant , params , actualParamNames ) ) {
402- hasErrors = true ;
403- }
404- } ) ;
405- } else {
406- // Even without params, check for malformations
407- parsedParams . forEach ( ( variant ) => {
408- if ( this . hasRelevantMalformation ( variant ) ) {
409- hasErrors = true ;
410- }
411- } ) ;
412- }
405+ // Check each parsed variant for issues (malformations and parameter errors)
406+ parsedParams . forEach ( ( variant ) => {
407+ if ( this . hasVariantIssues ( variant , params , actualParamNames ) ) {
408+ hasErrors = true ;
409+ }
410+ } ) ;
413411
414412 // Only show full output if there are errors
415413 if ( hasErrors ) {
0 commit comments