Repository navigation
Declare the data keys of module-level const objects - #1826
Merged
swapnilpaliwal-sd merged 1 commit intoSep 30, 2026
Merged
swapnilpaliwal-sd merged 1 commit into
swapnilpaliwal-sd merged 1 commit into
Conversation
A key of an exported const object literal whose value is data (TOPICS.CREATED
in Object.freeze({ CREATED: 'a.b' }), a CommonJS const table) was no
declaration, so impact refused it and its readers were word matches.
- index: declare each data key of a module-level const literal under its key
chain (JS and TS), seeing through Object.freeze/seal; function-valued keys
inside Object.freeze are now owned by the variable too
- rules: a read behind the object's own name is in scope; behind any other
name, or a bare name, it is not this object's key
Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
swapnilpaliwal-sd
requested review from
JaredHLZhang,
Whua689 and
suyashpaliwal26
as code owners
September 30, 2026 12:43
swapnilpaliwal-sd
deleted the
apps/javascript/const-object-literal-keys-not-declared
branch
September 30, 2026 19:01
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.
A data-valued key of a module-level const object (
TOPICS.CREATEDinObject.freeze({ CREATED: 'a.b' }), a CommonJS const table) was no declaration:impactrefused it and its readers were word matches.Object.freeze/sealandas const); function-valued keys insideObject.freezeare now owned by the variable tooin scope; behind another name, or as a bare name, it is not this object's keyconst-object-data-keysfor JS and TS (14 checks, 5 controls); 9 of 13 fail before the fix, all pass afterChecked: golden suites JS 285/285, TS 214/214, Python 278/278, Java 306/306, C# 207/207; engine JS tests 88/88. On a 226-file JS product: edges unchanged (11309), +157 declared keys, probes 55 → 57 of 70 with no regressions, and 13 false name-match readers gone from one key's answer.