fix: apply Prettier formatting to assign_agent_helpers.cjs#19501
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR applies Prettier formatting to assign_agent_helpers.cjs to fix a failing npm run lint:cjs check. The sole change is the removal of parentheses around the value expression in a JSDoc type cast on line 250.
Changes:
- Removes parentheses from
/** @type {any} */ (error)→/** @type {any} */ errorat line 250 to satisfy Prettier's formatting rules.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| try { | ||
| if (!error || typeof error !== "object") return; | ||
| const err = /** @type {any} */ (error); | ||
| const err = /** @type {any} */ error; |
There was a problem hiding this comment.
Removing the parentheses from a JSDoc type cast breaks the cast entirely. In JSDoc, the correct syntax for a type cast/assertion is /** @type {T} */ (expr) — the parentheses are required for the cast to take effect. Without them, /** @type {any} */ error is just an inline comment and err retains its original type (unknown). As a result, accessing err.errors, err.response, and err.data further down will be flagged as errors by type checkers (TypeScript/Flow) in strict mode, since those properties don't exist on unknown.
Notice that line 422 uses the same pattern and has a // prettier-ignore comment specifically to prevent Prettier from removing these parentheses. The correct fix for line 250 is to add // prettier-ignore on the line before it, preserving the parenthesized cast, rather than letting Prettier strip the parentheses and silently break the type cast.
See below for a potential fix:
// prettier-ignore
const err = /** @type {any} */ (error);
const details = {
...(err.errors && { errors: err.errors }),
...(err.response && { response: err.response }),
...(err.data && { data: err.data }),
assign_agent_helpers.cjshad a minor code style issue that causednpm run lint:cjs(Prettier check) to fail.assign_agent_helpers.cjs: ranprettier --writeto fix formatting✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.