[compiler] Add Intl formatter types and fix moduleTypeProvider fallback by josephsavona · Pull Request #35906 · facebook/react

@josephsavona

Add type definitions for all Intl formatter objects (DateTimeFormat,
NumberFormat, Collator, PluralRules, ListFormat, RelativeTimeFormat,
Segmenter, DisplayNames) so the compiler understands that formatter
instances are immutable and their methods only read arguments.

Without these types, `new Intl.DateTimeFormat().format(date)` would
conservatively assume the format call captures `date` into the
formatter, creating an unnecessary dependency.

Also fix `#resolveModuleType` to always fall back to
`defaultModuleTypeProvider` when a custom `moduleTypeProvider` returns
null, so that tools like the snap runner that set their own provider
still get the default module types (react-hook-form, tanstack, etc.).