AI summary by TwinMind
The New JS Features Coming Soon (I'm so hyped)
Theo - t3․gg
39m 2s
TC39 101st Meeting Overview
- TC39 meets every 2 months to discuss JavaScript changes
- Proposals advance through stages until browsers implement them
- More inflight proposals than ever before
- Meeting happened beginning of April
- Focus on stage advancements and new proposals
Stage 1 Advancements
Error.isError Proposal
- Finally reached stage 1
- Provides reliable way to detect error instances
instanceof Errorunreliable with cross-realm issues (iframes, VM modules in Node)- Proper symbol-based detection method
Signals Proposal
- Advanced to stage 1 from idea phase
- Real proposal with good chance of implementation
- Previously covered in separate video
- Significant community hype
Using Statement Strict Enforcement
- Related to existing
usingproposal (currently stage 3) - Addresses composable pattern for resource management
- Links external resources (memory, IO) with automatic cleanup
- Traditional pattern: acquire resource → try/use → finally cleanup
- New syntax:
using handle = acquireFileHandle() - Automatic cleanup when leaving scope
- Disposal behavior defined by library authors
- Implements
Symbol.disposeandSymbol.asyncDispose - Strict enforcement prevents misuse (requiring
usinginstead ofconst) - Advanced from stage 0 to stage 1
Stage 2.7 Advancements
Array.prototype.sum Proposal
- Stage 2.7 = approved in principle, tests written, awaiting community approval
- Addresses common summing operations
- One of few remaining use cases for
array.prototype.reduce - Engine optimization potential - can execute in native code vs JavaScript VM
- Better floating-point arithmetic algorithms
Math.sumPrecise()provides maximally correct answers- Requires arbitrary precision arithmetic conversion
- Performance benefits for engines like Bun
Promise.try Proposal
- Common pattern: wrapping potentially async functions in promises
- Current solution:
Promise.resolve().then(f)runs unnecessarily async - New
Promise.try()provides promise semantics without forced async execution - P-try library: 44M weekly downloads, 8.9B total downloads
- Enables promise syntax without async function overhead
Stage 4 Completions
Set Methods
- Now stage 4 (ready for browser implementation)
- Methods: intersection, union, difference, superset, subset
- Performance optimization potential at engine level
- Already in MDN documentation
- Browser support: Chrome/Edge/Opera (Chromium) ✓, Firefox ✗, Safari ✓
- Firefox blocking widespread adoption
Duplicate Named Capture Groups (Regex)
- Stage 4 completion
- Allows reusing group names in regex patterns
- Example: matching dates in multiple formats with same group name "year"
Major Proposals Not in Recent Meeting
Iterator Helpers (Stage 3)
- Collection of new methods for iterator prototypes
- Already shipped in V8/Chrome
- Motivation: iterators lack helper methods like arrays
- Lazy evaluation - only consume when needed
- Methods include:
map(),filter(),take(),drop(),flatMap()forEach(),some(),every(),find()toArray()for conversion
Iterator.from()for wrapping iterator-like objects- Enables functional programming patterns on iterators
- Massive performance benefits for large/infinite datasets
- Browser support: Chromium-based browsers only
Temporal API (Stage 3)
- Modern datetime API replacement for Date
- Global namespace like Math
- Principles:
- All objects immutable
- Local calendar system support
- Standard 24-hour clock
- No leap seconds
- Key types:
Temporal.Instant- fixed point in timeTemporal.PlainDate/Time- calendar/clock representationsTemporal.Duration- time spansTemporal.TimeZone- timezone handlingTemporal.Calendar- calendar systems
- Browser support: Safari partial, others none
- Addresses long-standing JavaScript date/time pain points
Pattern Matching (Stage 1)
- Match expressions for value patterns
- Alternative to switch statements
- Syntax:
match (value) { when pattern => result } - Supports array destructuring, object matching
- Champions include TypeScript manager Daniel Rosenwasser
- Early escape pattern replacement
- Works with iterators (unlike switch statements)
Shadow Realms (Stage 2)
- Distinct global environments with isolated execution
- New global object with separate built-ins
- Use cases:
- Web-based IDEs
- Third-party code execution
- DOM virtualization
- Test frameworks
- SSR isolation
- Browser code editors
- API:
new ShadowRealm()withimportValue()andevaluate() - Safe code execution with proper isolation
- Wrapped functions for cross-realm communication
- Requested stage 3 in 2021, still pending
