File tree Expand file tree Collapse file tree
src/internal/emit-wrappers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1897,6 +1897,22 @@ export function emitIntrinsicWrappers(ctx: any): {
18971897 }
18981898 }
18991899
1900+ // Extract transient props (starting with $) from the explicit type and add to destructureProps
1901+ // so they get stripped from the rest spread (styled-components transient props should never reach DOM)
1902+ const explicit = d . propsType ;
1903+ if ( explicit ?. type === "TSTypeLiteral" && explicit . members ) {
1904+ for ( const member of explicit . members as any [ ] ) {
1905+ if (
1906+ member . type === "TSPropertySignature" &&
1907+ member . key ?. type === "Identifier" &&
1908+ member . key . name . startsWith ( "$" ) &&
1909+ ! destructureProps . includes ( member . key . name )
1910+ ) {
1911+ destructureProps . push ( member . key . name ) ;
1912+ }
1913+ }
1914+ }
1915+
19001916 const usedAttrs = getUsedAttrs ( d . localName ) ;
19011917 const { hasAny : hasLocalUsage } = getJsxCallsites ( d . localName ) ;
19021918 const explicitPropsNames = d . propsType ? getExplicitPropNames ( d . propsType ) : new Set < string > ( ) ;
Original file line number Diff line number Diff line change @@ -32,12 +32,8 @@ type PointProps = {
3232// Pattern 3: Transient prop with dynamic value passed to inlined component
3333// The prop is declared in type but not used in styles - must be stripped when inlined
3434function Point ( props : PointProps ) {
35- const { children, style, ...rest } = props ;
36- return (
37- < div { ...rest } { ...mergedSx ( styles . point , undefined , style ) } >
38- { children }
39- </ div >
40- ) ;
35+ const { children, style, $size } = props ;
36+ return < div { ...mergedSx ( styles . point , undefined , style ) } > { children } </ div > ;
4137}
4238
4339// Pattern 4: styled(Component) where base component declares the transient prop
You can’t perform that action at this time.
0 commit comments