What the Latest TC39 Proposals Mean for JavaScript Developers
This article reviews recent TC39 proposals—including findLast, Symbol-as-WeakMap keys, JSON.parse source text access, String.dedent, RegExp modifiers, atomic operators, and faster Promise adoption—explaining their stage progress, technical details, and practical code examples for modern JavaScript development.
Stage 3 → Stage 4
The findLast proposal reached Stage 4, marking the second Chinese‑driven proposal to do so, while String Dedent and JSON.parse source text access also made progress.
findFromLast
Proposal link: https://tc39.es/proposal-array-find-from-last/index.html
It adds
Array.prototype.findLastand
Array.prototype.findLastIndexto search from the end of an array.
Current
Array.findreturns the first matching element; to get the last one you previously had to reverse the array:
<code>[...[]].reverse().find();</code>This required creating an extra array. The new methods allow intuitive last‑element searches:
<code>const arr = [1, 2, 3, 4];
arr.findLast(i => i % 2 === 1); // 3
arr.findLastIndex(i => i % 2 === 1); // 2
arr.findLastIndex(i => i % 2 === 10); // -1</code>These APIs are available in Chrome 97 and via core‑js or es‑shims.
Stage 2 → Stage 3
Advancement requires a complete standard text reviewed and signed by a TC39 member and the ECMAScript editor’s approval.
Symbol as WeakMap Keys
Proposal link: https://github.com/tc39/proposal-symbols-as-weakmap-keys
The proposal permits
Symbolvalues as keys in
WeakMap, which previously accepted only objects. This enables storing references to Symbols in Records and Tuples, which rely on value‑based equality.
Example:
<code>const weakMap = new WeakMap();
const key = Symbol('ref for data');
const data = {};
weakMap.set(key, data);</code>Three Symbol types are discussed: Unique Symbol, Well‑known Symbol, and Registered Symbol. Only Unique and Well‑known Symbols are allowed as
WeakMapkeys because Registered Symbols cannot be observed for garbage collection.
Stage 1 → Stage 2
Advancement requires a draft standard text and a champion TC39 member.
Duplicate named capturing groups
Proposal link: https://github.com/tc39/proposal-duplicate-named-capturing-groups
It relaxes the uniqueness constraint on named capture groups in regular expressions, allowing patterns such as alternating date formats with the same group names.
String Dedent
Proposal link: https://github.com/tc39/proposal-string-dedent
Introduces
String.dedentto remove common indentation from multiline template literals, making the source code layout match the resulting string.
<code>class Foo {
methodA() {
const foo = String.dedent(`
create table student(
id int primary key,
name text
)
`);
return foo;
}
}</code>Stage 0 → Stage 1
Requirements include finding a champion, defining the problem, providing examples, and discussing API shape and semantics.
Import Reflection
Proposal link: https://github.com/tc39/proposal-import-reflection
Allows the
importstatement to include an
asclause that supplies reflection metadata, e.g., specifying a WebAssembly module type:
<code>import FooModule from "./foo.wasm" as "wasm-module";
FooModule instanceof WebAssembly.Module; // true</code>This differs from Import Assertion, which adds a type assertion without affecting execution semantics.
Regular Expression Pattern Modifiers
Proposal link: https://github.com/tc39/proposal-regexp-modifiers
Introduces scoped flag modifiers using the syntax
(?imsx-imsx:subexpression), enabling selective activation or deactivation of flags within a sub‑expression.
Regular Expression Atomic Operators
Proposal link: https://github.com/tc39/proposal-regexp-atomic-operators
Adds atomic groups
(?>...)and possessive quantifiers like
n*+, preventing backtracking and improving performance.
Faster Promise Adoption
Proposal link: https://github.com/tc39/proposal-faster-promise-adoption
Reduces the number of ticks required when a promise resolves to another promise, allowing the outer promise to adopt the inner promise’s state without an extra asynchronous turn.
<code>const outer = new Promise(res => {
const inner = Promise.resolve(1);
res(inner);
});
outer.then(log); // resolves in fewer ticks</code>Conclusion
The JavaScript Chinese Interest Group (JSCIG) invites developers to discuss these and other ECMAScript topics on GitHub: https://github.com/JSCIG/es-discuss/discussions .
Taobao Frontend Technology
The frontend landscape is constantly evolving, with rapid innovations across familiar languages. Like us, your understanding of the frontend is continually refreshed. Join us on Taobao, a vibrant, all‑encompassing platform, to uncover limitless potential.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.