You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7ce6aea
Browse filesBrowse the repository at this point in the historyBrowse files
feat(types): add StyledComponent for explicit export annotations (#5799)
* feat(types): add StyledComponent for explicit export annotations
Packages that emit their own declarations, including any project using
isolatedDeclarations, must annotate every exported styled component, and there
was no public type for it: consumers reached into styled-components/dist/types or
hand-assembled a shape that silently dropped members such as hoisted statics.
StyledComponent<Target, Props> is now exported from the web and native entries.
It resolves to the exact type styled(Target)<Props> produces across every target
kind, .withConfig, and hoisted statics, so the annotation is not lossy and the
check against the inferred component stays cheap.
Contract tests enumerate the target-kind matrix and the two .attrs() spelling
rules; three annotated-public type-perf fixture kinds guard the alias's construction
arms (intrinsic tag, statics wrap, factory widening) with both budgets re-measured.
* docs(type-perf): document the annotatedPublic fixture kinds
The type-performance guide enumerates the fixture kinds; add the three
annotatedPublic* kinds introduced alongside StyledComponent so the enumeration
matches the fixture.
* docs(types): trim StyledComponent doc prose
Added a `StyledComponent<Target, Props>` type for annotating explicitly-typed styled component exports.
6
+
7
+
Packages that emit their own declaration files, including any project using `isolatedDeclarations`, must annotate every exported styled component, and there was no public type for it: consumers reached into internal paths or hand-assembled one that dropped members like a wrapped component's hoisted statics.
8
+
9
+
`StyledComponent` is exported from the web and native entries. Name the target and props as you passed them to `styled`:
0 commit comments