Repository navigation
ObjectDictionary<T>: the value of a string index signature - #114
Merged
Merged
Conversation
…y run-time keys (the compiler maps { [key: string]: T } to it), and objectDictionaryAssign for a spread of one
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ASDAlexander77
force-pushed
the
object-dictionary
branch
from
November 21, 2026 11:06
27b8d7e to
bdd6199
Compare
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.
The compiler is about to map a string index signature,
{ [key: string]: T }, and an object literal with a key known only at run time ({ [m]: v }), to a dictionary. This is that dictionary.ObjectDictionary<T>(@dictionary), inlib.generics.ts: entries by key in the order they were added.getreturnsT | undefined:undefinedfor a key it does not hold.setwrites a value; writingundefineddeletes the entry.has,delete,keysandsize.-mm=own.-mm=ownit owns its values: a value written in moves in, a read borrows, and a value overwritten or deleted is dropped.d.name,d["name"]andd[k]from outside the class always mean entries, never its members. The@dictionarydecorator marks the class for that.objectDictionaryAssign<T>(target, source)is for a spread of a dictionary into a new one. It is a function, not a member, so it is only made for the types it is used with. Under own, a dictionary of objects (which can't be copied) fails only where one is spread.tests/object_dictionary.ts. Its first line skips-mm=ownuntil a released compiler has the companion own fix: a parameter moved on paths that exclude each other, whichsetneeds. The test uses onlyd[k], so it runs the same with the released compiler and the new one.Companion compiler PR to follow; this one goes in first.
🤖 Generated with Claude Code