@@ -33,6 +33,10 @@ Source code:
3333 font-size: .7em;
3434 \` ;
3535
36+ const MiniButton = styled(SmallButton).attrs({ size : ' mini' } )\`
37+ font-size: .1em;
38+ \` ;
39+
3640
3741TypeScript before transform:
3842
@@ -44,18 +48,68 @@ TypeScript before transform:
4448 const SuperButton = Button.extend \`\\ n color: super;\\ n\` ;
4549 export default styled.link \`\\ n color: black;\\ n\` ;
4650 export const SmallButton = Button.extend \`\\ n font-size: .7em;\\ n\` ;
51+ const MiniButton = styled(SmallButton).attrs({ size : " mini" } ) \`\\ n font-size: .1em;\\ n\` ;
4752
4853
4954TypeScript after transform:
5055
51- import styled from "styled-components";
52- const Button = styled.button \`\\ n color: red;\\ n\` ;
56+ import styled from 'styled-components';
57+ const Button = styled.button.withConfig({ displayName : " Button" } ) \`
58+ color: red;
59+ \` ;
5360 declare const nonStyled: any;
54- const NonButton = nonStyled.button \`\\ n yo\\ n\` ;
55- const OtherButton = styled(Button) \`\\ n color: blue;\\ n\` ;
56- const SuperButton = Button.extend \`\\ n color: super;\\ n\` ;
57- export default styled.link \`\\ n color: black;\\ n\` ;
58- export const SmallButton = Button.extend \`\\ n font-size: .7em;\\ n\` ;
61+ const NonButton = nonStyled.button \`
62+ yo
63+ \` ;
64+ const OtherButton = styled(Button).withConfig({ displayName : " OtherButton" } ) \`
65+ color: blue;
66+ \` ;
67+ const SuperButton = Button.extend.withConfig({ displayName : " SuperButton" } ) \`
68+ color: super;
69+ \` ;
70+ export default styled.link \`
71+ color: black;
72+ \` ;
73+ export const SmallButton = Button.extend.withConfig({ displayName : " SmallButton" } ) \`
74+ font-size: .7em;
75+ \` ;
76+ const MiniButton = styled(SmallButton).attrs({ size : " mini" } ).withConfig({ displayName : " MiniButton" } ) \`
77+ font-size: .1em;
78+ \` ;
79+
80+
81+
82+ ` ;
83+
84+ exports [` sample2.ts 1` ] = `
85+
86+ File: sample2.ts
87+ Source code:
88+
89+ import styled from 'styled-components';
90+
91+ const styled2 = styled;
92+ const NonButton = styled.button;
93+ const NonStyled = styled\` color: red; \` ;
94+ const Link = styled(NonStyled)\` color: red; \` ;
95+
96+
97+ TypeScript before transform:
98+
99+ import styled from "styled-components";
100+ const styled2 = styled;
101+ const NonButton = styled.button;
102+ const NonStyled = styled \` color: red; \` ;
103+ const Link = styled(NonStyled) \` color: red; \` ;
104+
105+
106+ TypeScript after transform:
107+
108+ import styled from 'styled-components';
109+ const styled2 = styled;
110+ const NonButton = styled.button;
111+ const NonStyled = styled \` color: red; \` ;
112+ const Link = styled(NonStyled).withConfig({ displayName : " Link" } ) \` color: red; \` ;
59113
60114
61115
0 commit comments