mui / mui/material-ui

[styled-engine-sc] Types are not taken into account when using `styled` function with a template string

Open
#40,498 11 comments 0 reactions 1 assignee View on GitHub

@mnajdova is already working on this.

Since Jan 9, 2024.

package: styled-engine-sc scope: system
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Steps to reproduce

Link to live example: https://github.com/DND-IT/material-ui-cra-styled-components-ts/pull/1

Steps:

  1. Checkout the project
  2. Hover the position variable to see, that the type is any
Current behavior

Screenshot 2024-01-09 at 14 32 53

Expected behavior

The provided types must be taken into account

Context

We try to use proper typed styled-components

Your environment
npx @mui/envinfo
  System:
    OS: macOS 12.6.1
  Binaries:
    Node: 20.10.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
  Browsers:
    Chrome: 120.0.6099.199
    Edge: Not Found
    Safari: 15.6.1
  npmPackages:
    @mui/base:  5.0.0-beta.30
    @mui/core-downloads-tracker:  5.15.3
    @mui/lab: latest => 5.0.0-alpha.159
    @mui/material: latest => 5.15.3
    @mui/private-theming:  5.15.3
    @mui/styled-engine:  5.15.3
    @mui/styled-engine-sc: 6.0.0-alpha.11 => 6.0.0-alpha.11
    @mui/system:  5.15.3
    @mui/types:  7.2.12
    @mui/utils:  5.15.3
    @types/react: latest => 18.2.47
    react: latest => 18.2.0
    react-dom: latest => 18.2.0
    styled-components: latest => 6.1.8
    typescript: latest => 4.9.5
Support Key

#80425

Search keywords: styled-engine-sc styled-components typescript

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.