demo · v131

Codemod the deprecated getters

The deprecation covers seven method-form replacements in the Intl.Locale info proposal, plus legacy getters that still have no method form. Paste a chunk of TypeScript / JavaScript on the left, and the demo rewrites confirmed Intl.Locale call sites while reporting skipped and review-only matches.

input

your code

output

migrated

The codemod detects variables initialized with new Intl.Locale(...), rewrites (\.)(calendars|timeZones|textInfo|weekInfo|numberingSystems|hourCycles|collations)(?!\s*\(), tracks .currencies as a skipped getter, and leaves other object matches for review. Production migrations should run jscodeshift or ts-morph.

method replacements and skips

// deprecated property access            // codemod action
loc.calendars            // ->  loc.getCalendars()
loc.collations           // ->  loc.getCollations()
loc.hourCycles           // ->  loc.getHourCycles()
loc.numberingSystems     // ->  loc.getNumberingSystems()
loc.timeZones            // ->  loc.getTimeZones()
loc.textInfo             // ->  loc.getTextInfo()
loc.weekInfo             // ->  loc.getWeekInfo()
loc.currencies           // (no method form yet — still a getter)

why methods

TC39 moved these to methods because synchronous getters that return arrays of strings cost a real allocation per access. With property syntax, naive code that read the same property twice would pay the allocation twice; with the method form the cost is explicit. The deprecation window means existing code keeps working but will warn in DevTools — perfect for an automated migration tool like this one.

see also