Skip to content

Rename default export for @emotion/styled so it shows up as a suggestion for an auto-import #3334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wild-pumas-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@emotion/styled': patch
---

Renamed default-exported variable in `@emotion/styled` to aid inferred import names in auto-import completions in IDEs
8 changes: 4 additions & 4 deletions packages/styled/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Theme } from '@emotion/react'
import styled from './base'
import baseStyled from './base'
import { ReactJSXIntrinsicElements } from './jsx-namespace'
import { tags } from './tags'
import {
Expand Down Expand Up @@ -33,10 +33,10 @@ export type StyledTags = {
export interface CreateStyled extends BaseCreateStyled, StyledTags {}

// bind it to avoid mutating the original function
const newStyled = styled.bind(null) as CreateStyled
const styled = baseStyled.bind(null) as CreateStyled

tags.forEach(tagName => {
;(newStyled as any)[tagName] = newStyled(tagName as keyof typeof newStyled)
;(styled as any)[tagName] = styled(tagName as keyof typeof styled)
})

export default newStyled
export default styled