Fix js-typecheck regression in parseAwContext object field access#32112
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
May 14, 2026 12:34
View session
pelikhan
reviewed
May 14, 2026
| const parsedObj = /** @type {Record<string, unknown>} */ parsed; | ||
| const itemType = typeof parsedObj.item_type === "string" ? parsedObj.item_type : ""; | ||
| const itemNumber = parsePositiveInteger(parsedObj.item_number); | ||
| const itemTypeValue = Reflect.get(parsed, "item_type"); |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a js-typecheck regression in parseAwContext by avoiding direct property access on values narrowed only to object under @ts-check.
Changes:
- Replace direct reads of
item_type/item_numberfrom a loosely-narrowed object withReflect.get. - Preserve existing normalization behavior for
item_type(string or"") anditem_number(viaparsePositiveInteger).
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/push_to_pull_request_branch.cjs | Updates parseAwContext normalization to avoid TS2339 property-access errors under @ts-check. |
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
Comment on lines
+62
to
+63
| const itemTypeValue = Reflect.get(parsed, "item_type"); | ||
| const itemNumberValue = Reflect.get(parsed, "item_number"); |
Collaborator
|
@copilot review all comments |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Collaborator
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
Copilot stopped work on behalf of
pelikhan due to an error
May 14, 2026 12:53
This was referenced May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Fix
The
js-typecheckjob failed inpush_to_pull_request_branch.cjsbecauseitem_type/item_numberwere read directly from a value narrowed only toobject. TypeScript correctly rejected those property reads.What was the bug?
validateAndNormalizeParsedContextaccessedparsedObj.item_typeandparsedObj.item_numberafter anobjectguard, which is not sufficient for typed property access under@ts-check.TS2339errors in CI (Property ... does not exist on type 'object').How did you fix it?
Reflect.getto read keys from an unknown object safely while preserving runtime behavior.item_typemust be a string, otherwise""item_numberis parsed via existingparsePositiveIntegerpathTesting
actions/setup/jstypecheck path is now clean for this file (the failingTS2339errors are removed).