Fix JSDoc return type annotations in close_expired_*.cjs #10091
Merged
+2
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TypeScript type checking failed because JSDoc annotations declared the search functions returned an array, but they actually return an object with
discussions/issuesandstatsproperties.Changes
Fixed return type annotations:
searchDiscussionsWithExpiration()inclose_expired_discussions.cjssearchIssuesWithExpiration()inclose_expired_issues.cjsBefore:
After:
Cleanup:
require("./error_helpers.cjs")statements on line 39 (already imported on line 4)The functions return this structure, which now matches the JSDoc:
Original prompt
This section details on the original issue you should resolve
<issue_title>[CI Failure Doctor] TypeScript Type Check Failure in close_expired_*.cjs - JSDoc Return Type Mismatch (Run #21033922615)</issue_title>
<issue_description># 🏥 CI Failure Investigation - Run githubnext/gh-aw#21033922615
Summary
TypeScript type checking failed in the
jsjob due to incorrect JSDoc return type annotations in two JavaScript files modified by PR #10069.Failure Details
Root Cause Analysis
The CI failure was caused by incorrect JSDoc type annotations in two functions that were modified to add comprehensive logging:
Affected Files
actions/setup/js/close_expired_discussions.cjsactions/setup/js/close_expired_issues.cjsThe Problem
Both files declare their search functions with incorrect return type annotations:
Declared (line 30):
Actual return (lines 118-124):
The functions return an object with two properties (
discussions/issuesandstats), but the JSDoc declares they return just an array.TypeScript Errors
(Same 3 errors for
close_expired_issues.cjs)Failed Jobs and Errors
Job: js
Investigation Findings
Primary Issue
The PR added comprehensive logging and step summaries, which included modifying the return structure of the search functions to include statistics. However, the JSDoc type annotations were not updated to reflect this change.
Secondary Issue (Non-Breaking)
Both files have duplicate
requirestatements:const { getErrorMessage } = require("./error_helpers.cjs");const { getErrorMessage } = require("./error_helpers.cjs");← DuplicateThis doesn't cause the failure but should be cleaned up.
Recommended Actions
Immediate Fix Required
Update JSDoc annotations in both files:
For
close_expired_discussions.cjs(line 30):For
close_expired_issues.cjs(line 30):Optional Cleanup
requirestatements on line 39 in both files (the one at line 4 is sufficient)Prevention Strategies
For AI Coding Agents (Copilot)
This failure could have been prevented by following the mandatory pre-commit checklist:
ALWAYS run
make agent-finishbefore committing JavaScript changesnpm teststep includes TypeScript type checkingMinimum requirement for JavaScript files: Run
npm testinactions/setup/js/When modifying return types: Always update corresp...
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.