Skip to content

Remove @ts-nocheck from 15 .cjs files and fix type errors#7909

Merged
pelikhan merged 4 commits into
mainfrom
copilot/fix-type-checking-in-cjs-file
Dec 27, 2025
Merged

Remove @ts-nocheck from 15 .cjs files and fix type errors#7909
pelikhan merged 4 commits into
mainfrom
copilot/fix-type-checking-in-cjs-file

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 27, 2025

15 JavaScript files had @ts-nocheck directives disabling TypeScript type checking. All type errors have been resolved and checking is now enabled.

Changes by pattern

Error handling - Replace optional chaining with proper instanceof checks:

// Before
catch (error) {
  const msg = error?.message ?? String(error);
}

// After  
catch (error) {
  const msg = error instanceof Error ? error.message : String(error);
}

Undefined values - Add default values or guards:

const { maxCount = 1 } = config;  // Was: const { maxCount } = config

Null checks - Guard property access on nullable objects:

if (resolved.wasTemporaryId && resolved.resolved) {  // Added && resolved.resolved
  log(resolved.resolved.repo);
}

Type annotations - Add JSDoc where inference fails:

/** @type {Record<string, string>} */
const variables = {};

Dynamic properties - Use @ts-ignore with explanations for intentional dynamic properties on arrays/objects

Files fixed (15)

add_copilot_reviewer.cjs, add_reviewer.cjs, assign_agent_helpers.cjs, assign_copilot_to_created_issues.cjs, assign_issue.cjs, assign_milestone.cjs, assign_to_agent.cjs, assign_to_user.cjs, check_workflow_timestamp_api.cjs, interpolate_prompt.cjs, link_sub_issue.cjs, mcp_http_transport.cjs, notify_comment_error.cjs, parse_copilot_log.cjs, safe_inputs_bootstrap.cjs

Validation

npm run typecheck passes with zero errors.

Original prompt

Find a .cjs with ts-no check and fix type checking.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits December 27, 2025 17:18
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix type checking in .cjs file with ts-no check Remove @ts-nocheck from 15 .cjs files and fix type errors Dec 27, 2025
Copilot AI requested a review from pelikhan December 27, 2025 17:42
@pelikhan pelikhan marked this pull request as ready for review December 27, 2025 17:43
@pelikhan pelikhan merged commit fa6dd86 into main Dec 27, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/fix-type-checking-in-cjs-file branch December 27, 2025 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants