Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: formatjs/formatjs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: @formatjs/utils@2.0.3
Choose a base ref
...
head repository: formatjs/formatjs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: @formatjs/utils@2.0.4
Choose a head ref
  • 2 commits
  • 18 files changed
  • 1 contributor

Commits on Dec 19, 2025

  1. fix(@formatjs/utils): fix ESM imports (#5596)

    ### TL;DR
    
    Convert JSON data files to TypeScript modules with proper typing for better type safety and module compatibility.
    
    ### What changed?
    
    - Changed file extensions from `.json` to `.ts` for generated data files:
      - `defaultCurrencyData.generated.json` → `defaultCurrencyData.generated.ts`
      - `defaultLocaleData.generated.json` → `defaultLocaleData.generated.ts`
      - `currencyMinorUnits.generated.json` → `currencyMinorUnits.generated.ts`
      - `iso3166Alpha3CountryCodes.json` → `iso3166Alpha3CountryCodes.ts`
    
    - Updated the Bazel build configuration to reflect these file extension changes
    
    - Modified import statements to use default exports instead of JSON imports with type annotations:
      - Changed `import * as data from './file.json' with {type: 'json'}` to `import data from './file.js'`
    
    - Updated generator scripts to output TypeScript files with proper type annotations (`as const`)
    
    - Added comments to generated files indicating they shouldn't be edited directly
    
    ### How to test?
    
    1. Run the build process to ensure all generated files are created correctly
    2. Verify that imports work properly in the codebase
    3. Check that TypeScript type checking passes without errors
    4. Ensure functionality remains the same by testing currency and locale-related utilities
    
    ### Why make this change?
    
    This change improves the codebase by:
    
    1. Providing better TypeScript type safety with `as const` assertions
    2. Eliminating the need for JSON import assertions which are less standard
    3. Making the code more maintainable with proper module exports
    4. Ensuring better compatibility with modern JavaScript module systems
    5. Improving developer experience with better type checking and IDE support
    
    GitHub: #
    longlho committed Dec 19, 2025
    Configuration menu
    Copy the full SHA
    9580a68 View commit details
    Browse the repository at this point in the history
  2. build: publish

     - @formatjs/utils@2.0.4
    longlho committed Dec 19, 2025
    Configuration menu
    Copy the full SHA
    d556a34 View commit details
    Browse the repository at this point in the history
Loading