fix(javascript): honor computed keys when naming callables, exports, requests and options (#536)

This commit is contained in:
morluto
2026-10-05 15:52:06 +08:00
committed by GitHub
parent d40502aa3b
commit 4c8dc39f43
6 changed files with 84 additions and 9 deletions
+3 -1
View File
@@ -370,7 +370,9 @@ const requestFields = (
if (!t.isObjectExpression(candidate)) return [];
return candidate.properties.flatMap((property) => {
if (!t.isObjectProperty(property)) return [];
const name = propertyName(property.key);
// `{[key]: 1}` sends no knowable field name; reporting `key` would invent
// a request field that may not exist.
const name = semanticStaticPropertyName(property.key, property.computed);
if (name.length === 0) return [];
return [
{