Skip to content

Commit 9e9e7bf

Browse files
Copilotpelikhan
andauthored
fix: add prettier-ignore to preserve JSDoc cast parens for TypeScript
The @type {any} JSDoc cast requires parentheses: `/** @type {any} */ (expr)`. Without them TypeScript does not treat it as a cast and reports a type error. Prettier was stripping the parens — add `// prettier-ignore` (same pattern used in assign_agent_helpers.cjs) to preserve them so `tsc --noEmit` passes. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/6b0f8428-4bb0-4473-9541-b9cf98602b4d
1 parent 687d692 commit 9e9e7bf

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

actions/setup/js/create_discussion.cjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,8 +697,10 @@ async function main(config = {}) {
697697
//
698698
// In either case we must NOT fall back to creating an issue, as that would
699699
// result in both a discussion and a fallback issue existing at the same time.
700+
// prettier-ignore
701+
const errorAny = /** @type {any} */ (error);
700702
/** @type {{id: string, number: number, title: string, url: string} | null | undefined} */
701-
const partialDiscussion = /** @type {any} */ error?.data?.createDiscussion?.discussion;
703+
const partialDiscussion = errorAny?.data?.createDiscussion?.discussion;
702704
const resolvedDiscussion = createdDiscussion || partialDiscussion;
703705
if (resolvedDiscussion) {
704706
core.warning(`Discussion ${qualifiedItemRepo}#${resolvedDiscussion.number} was created but a post-creation operation failed: ${errorMessage}`);

actions/setup/js/create_discussion_fallback.test.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,10 @@ describe("create_discussion double-posting prevention", () => {
348348
if (query.includes("createDiscussion")) {
349349
// Simulate @octokit/graphql GraphqlResponseError: discussion was
350350
// persisted but the API also returned an error in the response.
351-
const err = new Error("Request failed due to following response errors:\n - Resource not accessible by integration");
351+
const err = /** @type {any} */ new Error("Request failed due to following response errors:\n - Resource not accessible by integration");
352352
// Attach partial data the way @octokit/graphql does:
353353
// err.data = response.data (the full response body's "data" field)
354-
/** @type {{ createDiscussion: { discussion: { id: string, number: number, title: string, url: string } } }} */ /** @type {any} */ err.data = {
354+
err.data = {
355355
createDiscussion: {
356356
discussion: {
357357
id: "D_test456",

0 commit comments

Comments
 (0)