Fix copilot_driver JSDoc callback typing to unblock JS CI typecheck#26786
Fix copilot_driver JSDoc callback typing to unblock JS CI typecheck#26786
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/215ace95-a49a-430d-9f68-a51aebb2911c Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/215ace95-a49a-430d-9f68-a51aebb2911c Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes JSDoc typing for injected “append file” callbacks in copilot_driver.cjs so tsc --noEmit accepts both the production writer (fs.appendFileSync) and test stubs.
Changes:
- Introduces shared JSDoc typedefs for append-writer function shapes.
- Broadens
appendSafeOutputLine’sappendFileSyncparameter type to a reusable union type. - Applies the same callback type to
emitInfrastructureIncompleteoptions for consistency.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/copilot_driver.cjs | Adds shared JSDoc typedefs and updates callback types used for safe-output/infrastructure-incomplete emission. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
| * @typedef {(path: import("node:fs").PathOrFileDescriptor, data: string | Uint8Array, options?: import("node:fs").WriteFileOptions) => void} NodeAppendFileSync | ||
| */ | ||
|
|
||
| /** | ||
| * @typedef {(path: string, data: string, encoding: string) => void} StringAppendLineWriter |
There was a problem hiding this comment.
NodeAppendFileSync doesn't match Node's fs.appendFileSync overloads: the third parameter can be a BufferEncoding string (e.g. "utf8") or an options object. As written (options?: WriteFileOptions), appendSafeOutputLine(..., "utf8") is not type-safe for the NodeAppendFileSync branch, so the AppendFileSyncLike union still won't typecheck. Broaden the third parameter type (e.g. WriteFileOptions | import("node:buffer").BufferEncoding) or change the call site to pass an options object (and update the string-writer typedef accordingly).
| * @typedef {(path: import("node:fs").PathOrFileDescriptor, data: string | Uint8Array, options?: import("node:fs").WriteFileOptions) => void} NodeAppendFileSync | |
| */ | |
| /** | |
| * @typedef {(path: string, data: string, encoding: string) => void} StringAppendLineWriter | |
| * @typedef {(path: import("node:fs").PathOrFileDescriptor, data: string | Uint8Array, options?: import("node:fs").WriteFileOptions | import("node:buffer").BufferEncoding) => void} NodeAppendFileSync | |
| */ | |
| /** | |
| * @typedef {(path: string, data: string, encoding: import("node:buffer").BufferEncoding) => void} StringAppendLineWriter |
The CI
jsjob failed intsc --noEmitdue to an incompatible JSDoc function type incopilot_driver.cjs:fs.appendFileSyncwas not assignable to the narrower callback signature used byappendSafeOutputLine. This change aligns the type contracts so both production and test call sites are valid.Type contract fix for safe-output append callback
appendSafeOutputLineto support both:fs.appendFileSyncsignature (PathOrFileDescriptor,string | Uint8Array,WriteFileOptions?)path: string, data: string, encoding: string)Consistency in infrastructure incomplete emitter
emitInfrastructureIncompleteoptions so injected writers and defaultfs.appendFileSyncshare one compatible contract.JSDoc cleanup for maintainability
NodeAppendFileSyncStringAppendLineWriterAppendFileSyncLike