github-types.ts: GitHubIssue.assignees and labels arrays are not typed as nullable, inconsistent with other nullable fields
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 92/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- tooling
Research direction
Open src/prompt-generators/github/github-types.ts and compare GitHubIssue.assignees and labels with the existing nullable user, assignee, and milestone fields. Update the two array field types to include null, then confirm the existing optional-chaining callers in src/prompt-generators/github.ts remain compatible. Done means both fields match the GitHub API nullability without runtime changes.
Written by the indexing model from the issue text.
Description
Observed behavior
In src/prompt-generators/github/github-types.ts, the nullable fields on GitHubIssue are inconsistent in how they handle "the GitHub API can send null":
export interface GitHubIssue {
// ...
readonly user?: GitHubUser | null; // includes | null
readonly assignee?: GitHubUser | null; // includes | null
readonly assignees?: ReadonlyArray<GitHubUser>; // no | null
readonly labels?: ReadonlyArray<GitHubLabel | string>; // no | null
readonly milestone?: GitHubMilestone | null; // includes | null
// ...
}
GitHub's REST API schema for the Issue object marks both assignees and labels as nullable: true. So at runtime these fields can be present and set to null (not just undefined). The other nullable fields (user, assignee, milestone) correctly model that with | null. assignees and labels do not.
This does not currently cause a runtime bug because the consumers in src/prompt-generators/github.ts use optional chaining, which short-circuits on both null and undefined:
assignees: issue.assignees?.map(user => user.login).join(', ') ?? '',
// and in labelNames:
issue.labels?.map(label => /* ... */) ?? []
But the type lies to any caller who reaches for these fields without ?. - for example for (const a of issue.assignees ?? []) is safe, while if (issue.assignees) for (const a of issue.assignees) would still be safe because null is falsy, but const xs = issue.assignees as ReadonlyArray<GitHubUser> followed by xs.map(...) would crash. TypeScript will not warn about that, because the type says assignees is either an array or undefined.
Expected behavior
assignees and labels should match the GitHub API and the convention already used for other nullable fields in this same interface:
readonly assignees?: ReadonlyArray<GitHubUser> | null;
readonly labels?: ReadonlyArray<GitHubLabel | string> | null;
This is purely a type-level fix; no runtime change is needed.
Minimal reproduction
Compare the field signatures in src/prompt-generators/github/github-types.ts against GitHub's published Issue object schema. The mismatch is internal to the file - user/assignee/milestone already do the right thing.
Suggested fix
Add | null to the assignees and labels fields in GitHubIssue. No runtime changes required; existing callers already handle null correctly via ?..
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from joewalker/loop-the-loop
-
bug S4
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
joewalker/loop-the-loop#88 ·
-
Git exec(): child killed by a signal rejects with new Error('') and loses the signal information Openbug S3
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
joewalker/loop-the-loop#84 ·
-
bug S3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
joewalker/loop-the-loop#83 ·
-
bug S3
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
joewalker/loop-the-loop#82 ·
-
bug S4
Difficulty 1/5 Under an hour Newbie friendliness 90/100
joewalker/loop-the-loop#79 ·
All issues in joewalker/loop-the-loop
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
fullcalendar/fullcalendar#8106 ·