Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions internal/checker/utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,10 @@ var getFeatureMap = sync.OnceValue(func() map[string][]FeatureMapEntry {
},
"Map": {
{lib: "es2015", props: []string{"entries", "keys", "values"}},
{lib: "esnext", props: []string{
"getOrInsert",
"getOrInsertComputed",
}},
},
Comment thread
jakebailey marked this conversation as resolved.
"MapConstructor": {
{lib: "es2024", props: []string{"groupBy"}},
Expand Down Expand Up @@ -1396,10 +1400,14 @@ var getFeatureMap = sync.OnceValue(func() map[string][]FeatureMapEntry {
{lib: "es2019", props: []string{"description"}},
},
"WeakMap": {
{lib: "es2015", props: []string{"entries", "keys", "values"}},
{lib: "es2015", props: []string{}},
{lib: "esnext", props: []string{
Comment on lines 1402 to +1404
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feature map lists entries, keys, and values on WeakMap under es2015, but WeakMap is not iterable and these members don't exist in the bundled lib declarations (e.g. lib.es2015.collection.d.ts / lib.es2015.iterable.d.ts). This will make the “try changing the 'lib'…” suggestions incorrect for WeakMap.entries() etc. Remove these props (or drop the WeakMap iterable entry entirely) so only real WeakMap members are mapped.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3a7bf1b. Replaced the incorrect entries/keys/values props with empty lists for both WeakMap and WeakSet, since these types are not iterable. Kept the es2015 lib entries (with empty props, like Promise does) so that getSuggestedLibForNonExistentName still correctly suggests es2015 for WeakMap/WeakSet.

"getOrInsert",
"getOrInsertComputed",
}},
},
"WeakSet": {
{lib: "es2015", props: []string{"entries", "keys", "values"}},
{lib: "es2015", props: []string{}},
},
"String": {
{lib: "es2015", props: []string{"codePointAt", "includes", "endsWith", "normalize", "repeat", "startsWith", "anchor", "big", "blink", "bold", "fixed", "fontcolor", "fontsize", "italics", "link", "small", "strike", "sub", "sup"}},
Expand Down