Skip to content

[system] Wrong return type for resolveBreakpointValues #49671

Closed

Description

@challet

Steps to reproduce

  1. Open this link to live example: https://stackblitz.com/edit/github-u4vydoan?file=src%2FApp.tsx
  2. Look at the browser console

Current behavior

The first two calls to resolveBreakpointValues, respectively using an object and an array typed as ResponsiveStyleValue<number>, return a Record<string, number> as expected.

The third call, using a scalar value typed as ResponsiveStyleValue<number>, returns a scalar value number, in the example case 1

Expected behavior

Either :

  • the third call should return a Record<string, number> as stated by the typed function, in the example case : { xs: 1 }
  • the resolveBreakpointValues signature should specify an other return type : Record<string, T> | T or maybe the same ResponsiveStyleValue<T> as the input

Context

Using this function to have a normalized representation of a ResponsiveStyleValue. I would have expected in its { [key: string]: T | null; } variant even for passing a single scalar value.

I would then use such a result to perform transformations on the values. For instance,

{ xs: 1, lg: 2, notabreakpoint: 5 } => resolveBreakpointValues => myTransformFn => { xs: '100px', lg: '200px' }
[1, 2] => resolveBreakpointValues => myTransformFn => { xs: '100px', lg: '200px' }
1 => resolveBreakpointValues => myTransformFn => { xs: '100px' }

With the expected normalized version, it would only need to iterate over the object entries, without to test if it is a scalar or not. Like it is already the case for when an array is passed.

Your environment

npx @mui/envinfo
  System:
    OS: macOS 26.5
  Binaries:
    Node: 24.15.0 - /opt/homebrew/bin/node
    npm: 11.12.1 - /opt/homebrew/bin/npm
    pnpm: Not Found
  Browsers:
    Chrome: Not Found
    Edge: Not Found
    Firefox: Not Found
    Safari: 26.5
  npmPackages:
    @emotion/react: ^11.11.4 => 11.14.0 
    @emotion/styled: 11.13.5 => 11.13.5 
    @mui/core-downloads-tracker:  7.3.9 
    @mui/icons-material: ^7.3.9 => 7.3.9 
    @mui/lab: ^7.0.1-beta.23 => 7.0.1-beta.23 
    @mui/material: ^7.3.9 => 7.3.9 
    @mui/private-theming:  7.3.9 
    @mui/styled-engine:  7.3.9 
    @mui/system:  7.3.9 
    @mui/types:  7.4.12 
    @mui/utils:  7.3.9 
    @mui/x-data-grid:  8.28.2 
    @mui/x-data-grid-pro: ^8.28.2 => 8.28.2 
    @mui/x-date-pickers: ^8.27.2 => 8.27.2 
    @mui/x-internals:  8.26.0 
    @mui/x-license: ^8.26.0 => 8.26.0 
    @mui/x-telemetry:  8.20.0 
    @mui/x-virtualizer:  0.3.4 
    @types/react: ^18.2.74 => 18.3.24 
    react: ^18.2.0 => 18.3.1 
    react-dom: ^18.2.0 => 18.3.1 
    typescript: ^5.9.3 => 5.9.3 

Search keywords: resolveBreakpointValues

Activity

  1. added
    status: waiting for maintainer
    on Nov 3, 2026
  2. changed the title [-]Wrong return type for resolveBreakpointValues[/-] [+][system] Wrong return type for resolveBreakpointValues[/+] on Nov 4, 2026
  3. github-actions commented on Nov 5, 2026

    @github-actions
    Contributor

    This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
    Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.


    @challet Thanks again for creating this issue! If you have a moment, we would love to hear your thoughts on how we handled it with this short feedback form.

  4. removed
    status: waiting for maintainer
    on Nov 5, 2026
  5. added
    scope: system
    on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: system

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions