Repository navigation
Keys known at run time: a string index signature is a dictionary (TSLANG 152) - #972
Merged
Merged
Conversation
… a move then return, a narrowed T | undefined) is no longer a use after move Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… default library's ObjectDictionary<T>; d[k], d.name, k in d, for...in, Object.keys and delete go by its entries; { [m]: v } with a run-time key makes one
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oved on exclusive paths Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…onst's accessor was declared twice); detected from the generated key Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eclaration it was public, which failed every module importing another that made one (import + new Map<...>) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ber is made by the check; an import-map test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…les without the default library Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
This implements your decisions: a string index signature is a dictionary, reading an absent key gives
T | undefined, and under-mm=ownthe dictionary owns its values. The library side is ASDAlexander77/TypeScriptCompilerDefaultLib#114 (merged): it addsObjectDictionary<T>, marked@dictionary, andobjectDictionaryAssign.What changed
{ [key: string]: T }, a type literal with a string index signature and nothing else, is nowObjectDictionary<T>.get/setfields that nothing could fill, soconst d: { [k: string]: number } = { a: 1 }failed.d[k],d["name"]andd.namealways mean entries, sod.getandd.sizeare entries too.T | undefined; a write takes T.k in d,for...in,Object.keys(d)anddelete d[k]/delete d.nameall go by the entries.{ [m]: i }) makes a dictionary of its values' type.objectDictionaryAssign.const, or a folded"a" + "b".-mm=own: a parameter moved on paths that exclude each other is no longer reported as "used after its value was moved". This coversif/else, a move thenreturnthen another move, and a narrowedT | undefined. The dictionary'ssetneeds this.Mapfailed with "'ts.Func' op symbol declaration cannot have public visibility". The keys adapter for what the library boxes intoanywas made as a public declaration while the imported file was being read. This bug was already in main.Verification
00object_dictionary.ts,00own_param_exclusive_moves.tsandimport-map. The tester compiles without the default library, so these tests declare their own dictionary class.import-maptest does not reproduce theMapimport bug: that path needs the default library, which the tester doesn't load. It covers a dictionary keyed by imported values.numericIndexerConstraint1. TypeScript reports that line as an error too, and tslang now does as well.PrivateMemorySize, memory stayed flat at 33 MB:-mm=own).Still open, recorded in TSLANG 152:
ifs in a row is still refused.f<T, S>(Box<T>, Box<S>)gives the wrong types and then crashes. Because of it, a spread between dictionaries with different value types is refused.a[a.length] = xdoes not grow an array.🤖 Generated with Claude Code