File tree Expand file tree Collapse file tree 3 files changed +14
-12
lines changed
Expand file tree Collapse file tree 3 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -68,26 +68,26 @@ TypeScript before transform:
6868TypeScript after transform:
6969
7070 declare const styled: any;
71- const Button = styled.button({
71+ const Button = styled.button.withConfig({ displayName: "Button" }) ({
7272 color: 'red'
7373 });
7474 declare const nonStyled: any;
7575 const NonButton = nonStyled.button({
7676 color: 'red'
7777 });
78- const OtherButton = styled(Button)({
78+ const OtherButton = styled(Button).withConfig({ displayName: "OtherButton" }) ({
7979 color: 'blue'
8080 });
81- const SuperButton = Button.extend({
81+ const SuperButton = Button.extend.withConfig({ displayName: "SuperButton" }) ({
8282 color: 'super'
8383 });
8484 export default styled.link({
8585 color: 'black'
8686 });
87- export const SmallButton = Button.extend({
87+ export const SmallButton = Button.extend.withConfig({ displayName: "SmallButton" }) ({
8888 fontSize: '.7em'
8989 });
90- const MiniButton = styled(SmallButton).attrs({ size: ' mini' })({
90+ const MiniButton = styled(SmallButton).attrs({ size: " mini" }).withConfig({ displayName: "MiniButton" })({
9191 fontSize: '.1em'
9292 });
9393
Original file line number Diff line number Diff line change @@ -68,26 +68,26 @@ TypeScript before transform:
6868TypeScript after transform:
6969
7070 declare const styled: any;
71- const Button = styled.button({
71+ const Button = styled.button.withConfig({ displayName: "Button", componentId: "sc-7b7p9e" }) ({
7272 color: 'red'
7373 });
7474 declare const nonStyled: any;
7575 const NonButton = nonStyled.button({
7676 color: 'red'
7777 });
78- const OtherButton = styled(Button)({
78+ const OtherButton = styled(Button).withConfig({ displayName: "OtherButton", componentId: "sc-14ah7t" }) ({
7979 color: 'blue'
8080 });
81- const SuperButton = Button.extend({
81+ const SuperButton = Button.extend.withConfig({ displayName: "SuperButton", componentId: "sc-1t5v351" }) ({
8282 color: 'super'
8383 });
8484 export default styled.link({
8585 color: 'black'
8686 });
87- export const SmallButton = Button.extend({
87+ export const SmallButton = Button.extend.withConfig({ displayName: "SmallButton", componentId: "sc-ftk9hu" }) ({
8888 fontSize: '.7em'
8989 });
90- const MiniButton = styled(SmallButton).attrs({ size: ' mini' })({
90+ const MiniButton = styled(SmallButton).attrs({ size: " mini" }).withConfig({ displayName: "MiniButton", componentId: "sc-15rszef" })({
9191 fontSize: '.1em'
9292 });
9393
Original file line number Diff line number Diff line change @@ -128,8 +128,10 @@ export function createTransformer({
128128 const visitor : ts . Visitor = ( node ) => {
129129 if (
130130 node . parent
131- && isTaggedTemplateExpression ( node . parent )
132- && node . parent . tag === node
131+ && (
132+ isTaggedTemplateExpression ( node . parent ) && node . parent . tag === node
133+ || isCallExpression ( node . parent )
134+ )
133135 && node . parent . parent
134136 && isVariableDeclaration ( node . parent . parent )
135137 && isStyledFunction ( node , identifiers )
You can’t perform that action at this time.
0 commit comments