@storybook/react 7.0.0-alpha.7 → 7.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/dist/chunk-LSK4KSW4.mjs +1 -0
  2. package/dist/config.d.ts +11 -13
  3. package/dist/config.js +3 -7
  4. package/dist/config.mjs +3 -7
  5. package/dist/index.d.ts +57 -37
  6. package/dist/index.js +1 -1
  7. package/dist/index.mjs +1 -1
  8. package/dist/types-0a347bb9.d.ts +10 -0
  9. package/jest.config.js +7 -0
  10. package/package.json +27 -22
  11. package/template/cli/.eslintrc.json +5 -0
  12. package/template/cli/js/Button.jsx +50 -0
  13. package/template/cli/js/Button.stories.js +39 -0
  14. package/template/cli/js/Header.jsx +59 -0
  15. package/template/cli/js/Header.stories.js +22 -0
  16. package/template/cli/js/Page.jsx +69 -0
  17. package/template/cli/js/Page.stories.js +25 -0
  18. package/template/cli/ts/Button.stories.ts +44 -0
  19. package/template/cli/ts/Button.tsx +48 -0
  20. package/template/cli/ts/Header.stories.ts +26 -0
  21. package/template/cli/ts/Header.tsx +56 -0
  22. package/template/cli/ts/Page.stories.ts +29 -0
  23. package/template/cli/ts/Page.tsx +73 -0
  24. package/template/cli/ts-legacy/Button.stories.ts +45 -0
  25. package/template/cli/ts-legacy/Button.tsx +48 -0
  26. package/template/cli/ts-legacy/Header.stories.ts +24 -0
  27. package/template/cli/ts-legacy/Header.tsx +56 -0
  28. package/template/cli/ts-legacy/Page.stories.ts +29 -0
  29. package/template/cli/ts-legacy/Page.tsx +73 -0
  30. package/template/components/Button.jsx +13 -0
  31. package/template/components/Form.jsx +36 -0
  32. package/template/components/Html.jsx +9 -0
  33. package/template/components/Pre.jsx +20 -0
  34. package/template/components/index.js +9 -0
  35. package/template/stories/decorators.stories.tsx +28 -0
  36. package/template/stories/docgen-components/10017-ts-union/argTypes.snapshot +36 -0
  37. package/template/stories/docgen-components/10017-ts-union/docgen.snapshot +34 -0
  38. package/template/stories/docgen-components/10017-ts-union/input.tsx +12 -0
  39. package/template/stories/docgen-components/10017-ts-union/properties.snapshot +32 -0
  40. package/template/stories/docgen-components/10278-ts-multiple-components/argTypes.snapshot +26 -0
  41. package/template/stories/docgen-components/10278-ts-multiple-components/docgen.snapshot +49 -0
  42. package/template/stories/docgen-components/10278-ts-multiple-components/input.tsx +27 -0
  43. package/template/stories/docgen-components/10278-ts-multiple-components/properties.snapshot +22 -0
  44. package/template/stories/docgen-components/8140-js-prop-types-oneof/argTypes.snapshot +127 -0
  45. package/template/stories/docgen-components/8140-js-prop-types-oneof/docgen.snapshot +97 -0
  46. package/template/stories/docgen-components/8140-js-prop-types-oneof/input.jsx +27 -0
  47. package/template/stories/docgen-components/8140-js-prop-types-oneof/properties.snapshot +89 -0
  48. package/template/stories/docgen-components/8143-ts-imported-types/argTypes.snapshot +27 -0
  49. package/template/stories/docgen-components/8143-ts-imported-types/docgen.snapshot +22 -0
  50. package/template/stories/docgen-components/8143-ts-imported-types/input.tsx +10 -0
  51. package/template/stories/docgen-components/8143-ts-imported-types/properties.snapshot +23 -0
  52. package/template/stories/docgen-components/8143-ts-imported-types/types.ts +3 -0
  53. package/template/stories/docgen-components/8143-ts-react-fc-generics/argTypes.snapshot +27 -0
  54. package/template/stories/docgen-components/8143-ts-react-fc-generics/docgen.snapshot +24 -0
  55. package/template/stories/docgen-components/8143-ts-react-fc-generics/input.tsx +10 -0
  56. package/template/stories/docgen-components/8143-ts-react-fc-generics/properties.snapshot +21 -0
  57. package/template/stories/docgen-components/8428-js-static-prop-types/argTypes.snapshot +25 -0
  58. package/template/stories/docgen-components/8428-js-static-prop-types/docgen.snapshot +39 -0
  59. package/template/stories/docgen-components/8428-js-static-prop-types/input.jsx +20 -0
  60. package/template/stories/docgen-components/8428-js-static-prop-types/properties.snapshot +21 -0
  61. package/template/stories/docgen-components/8740-ts-multi-props/argTypes.snapshot +27 -0
  62. package/template/stories/docgen-components/8740-ts-multi-props/docgen.snapshot +49 -0
  63. package/template/stories/docgen-components/8740-ts-multi-props/input.tsx +23 -0
  64. package/template/stories/docgen-components/8740-ts-multi-props/properties.snapshot +21 -0
  65. package/template/stories/docgen-components/8894-9511-ts-forward-ref/argTypes.snapshot +48 -0
  66. package/template/stories/docgen-components/8894-9511-ts-forward-ref/docgen.snapshot +39 -0
  67. package/template/stories/docgen-components/8894-9511-ts-forward-ref/input.tsx +31 -0
  68. package/template/stories/docgen-components/8894-9511-ts-forward-ref/properties.snapshot +34 -0
  69. package/template/stories/docgen-components/9023-js-hoc/argTypes.snapshot +89 -0
  70. package/template/stories/docgen-components/9023-js-hoc/docgen.snapshot +84 -0
  71. package/template/stories/docgen-components/9023-js-hoc/input.jsx +40 -0
  72. package/template/stories/docgen-components/9023-js-hoc/properties.snapshot +67 -0
  73. package/template/stories/docgen-components/9399-js-proptypes-shape/argTypes.snapshot +39 -0
  74. package/template/stories/docgen-components/9399-js-proptypes-shape/docgen.snapshot +48 -0
  75. package/template/stories/docgen-components/9399-js-proptypes-shape/input.jsx +16 -0
  76. package/template/stories/docgen-components/9399-js-proptypes-shape/properties.snapshot +35 -0
  77. package/template/stories/docgen-components/9465-ts-type-props/argTypes.snapshot +28 -0
  78. package/template/stories/docgen-components/9465-ts-type-props/docgen.snapshot +33 -0
  79. package/template/stories/docgen-components/9465-ts-type-props/input.tsx +12 -0
  80. package/template/stories/docgen-components/9465-ts-type-props/properties.snapshot +24 -0
  81. package/template/stories/docgen-components/9493-ts-display-name/argTypes.snapshot +62 -0
  82. package/template/stories/docgen-components/9493-ts-display-name/docgen.snapshot +50 -0
  83. package/template/stories/docgen-components/9493-ts-display-name/input.tsx +30 -0
  84. package/template/stories/docgen-components/9493-ts-display-name/properties.snapshot +52 -0
  85. package/template/stories/docgen-components/9556-ts-react-default-exports/argTypes.snapshot +28 -0
  86. package/template/stories/docgen-components/9556-ts-react-default-exports/docgen.snapshot +32 -0
  87. package/template/stories/docgen-components/9556-ts-react-default-exports/input.tsx +12 -0
  88. package/template/stories/docgen-components/9556-ts-react-default-exports/properties.snapshot +24 -0
  89. package/template/stories/docgen-components/9575-ts-camel-case/argTypes.snapshot +28 -0
  90. package/template/stories/docgen-components/9575-ts-camel-case/docgen.snapshot +38 -0
  91. package/template/stories/docgen-components/9575-ts-camel-case/input.tsx +26 -0
  92. package/template/stories/docgen-components/9575-ts-camel-case/properties.snapshot +24 -0
  93. package/template/stories/docgen-components/9586-js-react-memo/argTypes.snapshot +41 -0
  94. package/template/stories/docgen-components/9586-js-react-memo/docgen.snapshot +42 -0
  95. package/template/stories/docgen-components/9586-js-react-memo/input.jsx +15 -0
  96. package/template/stories/docgen-components/9586-js-react-memo/properties.snapshot +34 -0
  97. package/template/stories/docgen-components/9591-ts-import-types/Bar.tsx +3 -0
  98. package/template/stories/docgen-components/9591-ts-import-types/argTypes.snapshot +25 -0
  99. package/template/stories/docgen-components/9591-ts-import-types/docgen.snapshot +21 -0
  100. package/template/stories/docgen-components/9591-ts-import-types/input.tsx +10 -0
  101. package/template/stories/docgen-components/9591-ts-import-types/properties.snapshot +21 -0
  102. package/template/stories/docgen-components/9626-js-default-values/argTypes.snapshot +27 -0
  103. package/template/stories/docgen-components/9626-js-default-values/docgen.snapshot +25 -0
  104. package/template/stories/docgen-components/9626-js-default-values/input.jsx +5 -0
  105. package/template/stories/docgen-components/9626-js-default-values/properties.snapshot +21 -0
  106. package/template/stories/docgen-components/9668-js-proptypes-no-jsdoc/argTypes.snapshot +42 -0
  107. package/template/stories/docgen-components/9668-js-proptypes-no-jsdoc/docgen.snapshot +36 -0
  108. package/template/stories/docgen-components/9668-js-proptypes-no-jsdoc/input.jsx +13 -0
  109. package/template/stories/docgen-components/9668-js-proptypes-no-jsdoc/properties.snapshot +35 -0
  110. package/template/stories/docgen-components/9721-ts-deprecated-jsdoc/argTypes.snapshot +53 -0
  111. package/template/stories/docgen-components/9721-ts-deprecated-jsdoc/docgen.snapshot +45 -0
  112. package/template/stories/docgen-components/9721-ts-deprecated-jsdoc/input.tsx +18 -0
  113. package/template/stories/docgen-components/9721-ts-deprecated-jsdoc/properties.snapshot +43 -0
  114. package/template/stories/docgen-components/9764-ts-extend-props/argTypes.snapshot +72 -0
  115. package/template/stories/docgen-components/9764-ts-extend-props/docgen.snapshot +41 -0
  116. package/template/stories/docgen-components/9764-ts-extend-props/input.tsx +17 -0
  117. package/template/stories/docgen-components/9764-ts-extend-props/properties.snapshot +56 -0
  118. package/template/stories/docgen-components/9827-ts-default-values/argTypes.snapshot +72 -0
  119. package/template/stories/docgen-components/9827-ts-default-values/docgen.snapshot +52 -0
  120. package/template/stories/docgen-components/9827-ts-default-values/input.tsx +17 -0
  121. package/template/stories/docgen-components/9827-ts-default-values/properties.snapshot +56 -0
  122. package/template/stories/docgen-components/9832-ts-enum-export/argTypes.snapshot +3 -0
  123. package/template/stories/docgen-components/9832-ts-enum-export/docgen.snapshot +16 -0
  124. package/template/stories/docgen-components/9832-ts-enum-export/input.tsx +8 -0
  125. package/template/stories/docgen-components/9832-ts-enum-export/properties.snapshot +7 -0
  126. package/template/stories/docgen-components/9922-ts-component-props/argTypes.snapshot +25 -0
  127. package/template/stories/docgen-components/9922-ts-component-props/docgen.snapshot +35 -0
  128. package/template/stories/docgen-components/9922-ts-component-props/input.tsx +24 -0
  129. package/template/stories/docgen-components/9922-ts-component-props/properties.snapshot +21 -0
  130. package/template/stories/docgen-components/imported.js +1 -0
  131. package/template/stories/docgen-components/js-class-component/argTypes.snapshot +386 -0
  132. package/template/stories/docgen-components/js-class-component/docgen.snapshot +252 -0
  133. package/template/stories/docgen-components/js-class-component/input.jsx +57 -0
  134. package/template/stories/docgen-components/js-class-component/properties.snapshot +286 -0
  135. package/template/stories/docgen-components/js-function-component/argTypes.snapshot +386 -0
  136. package/template/stories/docgen-components/js-function-component/docgen.snapshot +236 -0
  137. package/template/stories/docgen-components/js-function-component/input.jsx +50 -0
  138. package/template/stories/docgen-components/js-function-component/properties.snapshot +286 -0
  139. package/template/stories/docgen-components/js-function-component-inline-defaults/argTypes.snapshot +386 -0
  140. package/template/stories/docgen-components/js-function-component-inline-defaults/docgen.snapshot +247 -0
  141. package/template/stories/docgen-components/js-function-component-inline-defaults/input.jsx +65 -0
  142. package/template/stories/docgen-components/js-function-component-inline-defaults/properties.snapshot +286 -0
  143. package/template/stories/docgen-components/js-function-component-inline-defaults-no-propTypes/argTypes.snapshot +237 -0
  144. package/template/stories/docgen-components/js-function-component-inline-defaults-no-propTypes/docgen.snapshot +124 -0
  145. package/template/stories/docgen-components/js-function-component-inline-defaults-no-propTypes/input.jsx +41 -0
  146. package/template/stories/docgen-components/js-function-component-inline-defaults-no-propTypes/properties.snapshot +151 -0
  147. package/template/stories/docgen-components/js-proptypes/docgen.snapshot +1770 -0
  148. package/template/stories/docgen-components/js-proptypes/ext.js +13 -0
  149. package/template/stories/docgen-components/js-proptypes/input.jsx +497 -0
  150. package/template/stories/docgen-components/jsdoc/argTypes.snapshot +969 -0
  151. package/template/stories/docgen-components/jsdoc/docgen.snapshot +548 -0
  152. package/template/stories/docgen-components/jsdoc/input.jsx +231 -0
  153. package/template/stories/docgen-components/jsdoc/properties.snapshot +857 -0
  154. package/template/stories/docgen-components/ts-function-component/argTypes.snapshot +396 -0
  155. package/template/stories/docgen-components/ts-function-component/docgen.snapshot +241 -0
  156. package/template/stories/docgen-components/ts-function-component/input.tsx +52 -0
  157. package/template/stories/docgen-components/ts-function-component/properties.snapshot +296 -0
  158. package/template/stories/docgen-components/ts-function-component-inline-defaults/argTypes.snapshot +279 -0
  159. package/template/stories/docgen-components/ts-function-component-inline-defaults/docgen.snapshot +151 -0
  160. package/template/stories/docgen-components/ts-function-component-inline-defaults/input.tsx +80 -0
  161. package/template/stories/docgen-components/ts-function-component-inline-defaults/properties.snapshot +177 -0
  162. package/template/stories/docgen-components/ts-html/argTypes.snapshot +3 -0
  163. package/template/stories/docgen-components/ts-html/docgen.snapshot +12 -0
  164. package/template/stories/docgen-components/ts-html/input.tsx +12 -0
  165. package/template/stories/docgen-components/ts-html/properties.snapshot +7 -0
  166. package/template/stories/docgen-components/ts-jsdoc/argTypes.snapshot +3 -0
  167. package/template/stories/docgen-components/ts-jsdoc/docgen.snapshot +21 -0
  168. package/template/stories/docgen-components/ts-jsdoc/input.tsx +27 -0
  169. package/template/stories/docgen-components/ts-jsdoc/properties.snapshot +7 -0
  170. package/template/stories/docgen-components/ts-types/argTypes.snapshot +656 -0
  171. package/template/stories/docgen-components/ts-types/docgen.snapshot +317 -0
  172. package/template/stories/docgen-components/ts-types/input.tsx +130 -0
  173. package/template/stories/docgen-components/ts-types/properties.snapshot +410 -0
  174. package/template/stories/errors.stories.tsx +37 -0
  175. package/template/stories/hooks.stories.tsx +17 -0
  176. package/template/stories/js-argtypes.stories.jsx +91 -0
  177. package/template/stories/react-mdx.stories.mdx +26 -0
  178. package/template/stories/ts-argtypes.stories.tsx +81 -0
  179. package/LICENSE +0 -21
  180. package/dist/chunk-DGYCFUMN.mjs +0 -1
  181. package/dist/types-9f8d440a.d.ts +0 -17
@@ -0,0 +1,317 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`react component properties ts-types 1`] = `
4
+ "import React from 'react';
5
+ function concat(a, b) {
6
+ return a + b;
7
+ }
8
+ var DefaultEnum;
9
+ (function (DefaultEnum) {
10
+ DefaultEnum[DefaultEnum[\\"TopLeft\\"] = 0] = \\"TopLeft\\";
11
+ DefaultEnum[DefaultEnum[\\"TopRight\\"] = 1] = \\"TopRight\\";
12
+ DefaultEnum[DefaultEnum[\\"TopCenter\\"] = 2] = \\"TopCenter\\";
13
+ })(DefaultEnum || (DefaultEnum = {}));
14
+ var NumericEnum;
15
+ (function (NumericEnum) {
16
+ NumericEnum[NumericEnum[\\"TopLeft\\"] = 0] = \\"TopLeft\\";
17
+ NumericEnum[NumericEnum[\\"TopRight\\"] = 1] = \\"TopRight\\";
18
+ NumericEnum[NumericEnum[\\"TopCenter\\"] = 2] = \\"TopCenter\\";
19
+ })(NumericEnum || (NumericEnum = {}));
20
+ var StringEnum;
21
+ (function (StringEnum) {
22
+ StringEnum[\\"TopLeft\\"] = \\"top-left\\";
23
+ StringEnum[\\"TopRight\\"] = \\"top-right\\";
24
+ StringEnum[\\"TopCenter\\"] = \\"top-center\\";
25
+ })(StringEnum || (StringEnum = {}));
26
+ export const TypeScriptProps = () => /*#__PURE__*/React.createElement(\\"div\\", null, \\"TypeScript!\\");
27
+ TypeScriptProps.defaultProps = {
28
+ any: 'Any value',
29
+ string: 'A string value',
30
+ bool: true,
31
+ number: 5,
32
+ voidFunc: () => {},
33
+ funcWithArgsAndReturns: concat,
34
+ symbol: Symbol('Default symbol'),
35
+ interface: {
36
+ text: 'foo',
37
+ value: 'bar'
38
+ },
39
+ genericInterface: {
40
+ value: 'A string value'
41
+ },
42
+ arrayOfPrimitive: ['foo', 'bar'],
43
+ arrayOfComplexObject: [{
44
+ text: 'foo',
45
+ value: 'bar'
46
+ }],
47
+ tupleOfPrimitive: ['string value', 5],
48
+ tupleWithComplexType: ['string value', {
49
+ text: 'foo',
50
+ value: 'bar'
51
+ }],
52
+ defaultEnum: DefaultEnum.TopRight,
53
+ numericEnum: NumericEnum.TopRight,
54
+ stringEnum: StringEnum.TopRight,
55
+ enumUnion: DefaultEnum.TopLeft,
56
+ recordOfPrimitive: {
57
+ foo: 1,
58
+ bar: 2
59
+ },
60
+ recordOfComplexObject: {
61
+ foo: {
62
+ text: 'bar',
63
+ value: 'bar2'
64
+ }
65
+ },
66
+ intersectionType: {
67
+ text: 'foo',
68
+ value: 'bar',
69
+ name: 'foo-bar'
70
+ },
71
+ intersectionWithInlineType: {
72
+ text: 'foo',
73
+ value: 'bar',
74
+ inlineValue: 'this is inlined'
75
+ },
76
+ unionOfPrimitive: 'A string value',
77
+ unionOfComplexType: {
78
+ text: 'foo',
79
+ value: 'bar'
80
+ },
81
+ nullableComplexTypeUndefinedDefaultValue: undefined,
82
+ typeAlias: 'foo',
83
+ aliasesUnion: 'foo',
84
+ genericAlias: {
85
+ value: 'foo'
86
+ },
87
+ namedStringLiteralUnion: 'top-right',
88
+ inlinedStringLiteralUnion: 'bottom-right',
89
+ namedNumericLiteralUnion: 0,
90
+ inlinedNumericLiteralUnion: 1
91
+ };
92
+ export const component = TypeScriptProps;
93
+ TypeScriptProps.__docgenInfo = {
94
+ \\"description\\": \\"\\",
95
+ \\"methods\\": [],
96
+ \\"displayName\\": \\"TypeScriptProps\\",
97
+ \\"props\\": {
98
+ \\"any\\": {
99
+ \\"defaultValue\\": {
100
+ \\"value\\": \\"'Any value'\\",
101
+ \\"computed\\": false
102
+ },
103
+ \\"required\\": false
104
+ },
105
+ \\"string\\": {
106
+ \\"defaultValue\\": {
107
+ \\"value\\": \\"'A string value'\\",
108
+ \\"computed\\": false
109
+ },
110
+ \\"required\\": false
111
+ },
112
+ \\"bool\\": {
113
+ \\"defaultValue\\": {
114
+ \\"value\\": \\"true\\",
115
+ \\"computed\\": false
116
+ },
117
+ \\"required\\": false
118
+ },
119
+ \\"number\\": {
120
+ \\"defaultValue\\": {
121
+ \\"value\\": \\"5\\",
122
+ \\"computed\\": false
123
+ },
124
+ \\"required\\": false
125
+ },
126
+ \\"voidFunc\\": {
127
+ \\"defaultValue\\": {
128
+ \\"value\\": \\"() => {}\\",
129
+ \\"computed\\": false
130
+ },
131
+ \\"required\\": false
132
+ },
133
+ \\"funcWithArgsAndReturns\\": {
134
+ \\"defaultValue\\": {
135
+ \\"value\\": \\"function concat(a: string, b: string): string {\\\\n return a + b;\\\\n}\\",
136
+ \\"computed\\": false
137
+ },
138
+ \\"required\\": false
139
+ },
140
+ \\"symbol\\": {
141
+ \\"defaultValue\\": {
142
+ \\"value\\": \\"Symbol('Default symbol')\\",
143
+ \\"computed\\": true
144
+ },
145
+ \\"required\\": false
146
+ },
147
+ \\"interface\\": {
148
+ \\"defaultValue\\": {
149
+ \\"value\\": \\"{ text: 'foo', value: 'bar' }\\",
150
+ \\"computed\\": false
151
+ },
152
+ \\"required\\": false
153
+ },
154
+ \\"genericInterface\\": {
155
+ \\"defaultValue\\": {
156
+ \\"value\\": \\"{ value: 'A string value' }\\",
157
+ \\"computed\\": false
158
+ },
159
+ \\"required\\": false
160
+ },
161
+ \\"arrayOfPrimitive\\": {
162
+ \\"defaultValue\\": {
163
+ \\"value\\": \\"['foo', 'bar']\\",
164
+ \\"computed\\": false
165
+ },
166
+ \\"required\\": false
167
+ },
168
+ \\"arrayOfComplexObject\\": {
169
+ \\"defaultValue\\": {
170
+ \\"value\\": \\"[{ text: 'foo', value: 'bar' }]\\",
171
+ \\"computed\\": false
172
+ },
173
+ \\"required\\": false
174
+ },
175
+ \\"tupleOfPrimitive\\": {
176
+ \\"defaultValue\\": {
177
+ \\"value\\": \\"['string value', 5]\\",
178
+ \\"computed\\": false
179
+ },
180
+ \\"required\\": false
181
+ },
182
+ \\"tupleWithComplexType\\": {
183
+ \\"defaultValue\\": {
184
+ \\"value\\": \\"['string value', { text: 'foo', value: 'bar' }]\\",
185
+ \\"computed\\": false
186
+ },
187
+ \\"required\\": false
188
+ },
189
+ \\"defaultEnum\\": {
190
+ \\"defaultValue\\": {
191
+ \\"value\\": \\"DefaultEnum.TopRight\\",
192
+ \\"computed\\": true
193
+ },
194
+ \\"required\\": false
195
+ },
196
+ \\"numericEnum\\": {
197
+ \\"defaultValue\\": {
198
+ \\"value\\": \\"NumericEnum.TopRight\\",
199
+ \\"computed\\": true
200
+ },
201
+ \\"required\\": false
202
+ },
203
+ \\"stringEnum\\": {
204
+ \\"defaultValue\\": {
205
+ \\"value\\": \\"StringEnum.TopRight\\",
206
+ \\"computed\\": true
207
+ },
208
+ \\"required\\": false
209
+ },
210
+ \\"enumUnion\\": {
211
+ \\"defaultValue\\": {
212
+ \\"value\\": \\"DefaultEnum.TopLeft\\",
213
+ \\"computed\\": true
214
+ },
215
+ \\"required\\": false
216
+ },
217
+ \\"recordOfPrimitive\\": {
218
+ \\"defaultValue\\": {
219
+ \\"value\\": \\"{ foo: 1, bar: 2 }\\",
220
+ \\"computed\\": false
221
+ },
222
+ \\"required\\": false
223
+ },
224
+ \\"recordOfComplexObject\\": {
225
+ \\"defaultValue\\": {
226
+ \\"value\\": \\"{ foo: { text: 'bar', value: 'bar2' } }\\",
227
+ \\"computed\\": false
228
+ },
229
+ \\"required\\": false
230
+ },
231
+ \\"intersectionType\\": {
232
+ \\"defaultValue\\": {
233
+ \\"value\\": \\"{ text: 'foo', value: 'bar', name: 'foo-bar' }\\",
234
+ \\"computed\\": false
235
+ },
236
+ \\"required\\": false
237
+ },
238
+ \\"intersectionWithInlineType\\": {
239
+ \\"defaultValue\\": {
240
+ \\"value\\": \\"{ text: 'foo', value: 'bar', inlineValue: 'this is inlined' }\\",
241
+ \\"computed\\": false
242
+ },
243
+ \\"required\\": false
244
+ },
245
+ \\"unionOfPrimitive\\": {
246
+ \\"defaultValue\\": {
247
+ \\"value\\": \\"'A string value'\\",
248
+ \\"computed\\": false
249
+ },
250
+ \\"required\\": false
251
+ },
252
+ \\"unionOfComplexType\\": {
253
+ \\"defaultValue\\": {
254
+ \\"value\\": \\"{ text: 'foo', value: 'bar' }\\",
255
+ \\"computed\\": false
256
+ },
257
+ \\"required\\": false
258
+ },
259
+ \\"nullableComplexTypeUndefinedDefaultValue\\": {
260
+ \\"defaultValue\\": {
261
+ \\"value\\": \\"undefined\\",
262
+ \\"computed\\": true
263
+ },
264
+ \\"required\\": false
265
+ },
266
+ \\"typeAlias\\": {
267
+ \\"defaultValue\\": {
268
+ \\"value\\": \\"'foo'\\",
269
+ \\"computed\\": false
270
+ },
271
+ \\"required\\": false
272
+ },
273
+ \\"aliasesUnion\\": {
274
+ \\"defaultValue\\": {
275
+ \\"value\\": \\"'foo'\\",
276
+ \\"computed\\": false
277
+ },
278
+ \\"required\\": false
279
+ },
280
+ \\"genericAlias\\": {
281
+ \\"defaultValue\\": {
282
+ \\"value\\": \\"{ value: 'foo' }\\",
283
+ \\"computed\\": false
284
+ },
285
+ \\"required\\": false
286
+ },
287
+ \\"namedStringLiteralUnion\\": {
288
+ \\"defaultValue\\": {
289
+ \\"value\\": \\"'top-right'\\",
290
+ \\"computed\\": false
291
+ },
292
+ \\"required\\": false
293
+ },
294
+ \\"inlinedStringLiteralUnion\\": {
295
+ \\"defaultValue\\": {
296
+ \\"value\\": \\"'bottom-right'\\",
297
+ \\"computed\\": false
298
+ },
299
+ \\"required\\": false
300
+ },
301
+ \\"namedNumericLiteralUnion\\": {
302
+ \\"defaultValue\\": {
303
+ \\"value\\": \\"0\\",
304
+ \\"computed\\": false
305
+ },
306
+ \\"required\\": false
307
+ },
308
+ \\"inlinedNumericLiteralUnion\\": {
309
+ \\"defaultValue\\": {
310
+ \\"value\\": \\"1\\",
311
+ \\"computed\\": false
312
+ },
313
+ \\"required\\": false
314
+ }
315
+ }
316
+ };"
317
+ `;
@@ -0,0 +1,130 @@
1
+ import type { FC } from 'react';
2
+ import React from 'react';
3
+
4
+ function concat(a: string, b: string): string {
5
+ return a + b;
6
+ }
7
+
8
+ interface ItemInterface {
9
+ text: string;
10
+ value: string;
11
+ }
12
+
13
+ interface PersonInterface {
14
+ name: string;
15
+ }
16
+
17
+ type InterfaceIntersection = ItemInterface & PersonInterface;
18
+
19
+ interface GenericInterface<T> {
20
+ value: T;
21
+ }
22
+
23
+ enum DefaultEnum {
24
+ TopLeft,
25
+ TopRight,
26
+ TopCenter,
27
+ }
28
+
29
+ enum NumericEnum {
30
+ TopLeft = 0,
31
+ TopRight,
32
+ TopCenter,
33
+ }
34
+
35
+ enum StringEnum {
36
+ TopLeft = 'top-left',
37
+ TopRight = 'top-right',
38
+ TopCenter = 'top-center',
39
+ }
40
+
41
+ type EnumUnion = DefaultEnum | NumericEnum;
42
+
43
+ type StringLiteralUnion = 'top-left' | 'top-right' | 'top-center';
44
+ type NumericLiteralUnion = 0 | 1 | 2;
45
+
46
+ type StringAlias = string;
47
+ type NumberAlias = number;
48
+ type AliasesIntersection = StringAlias & NumberAlias;
49
+ type AliasesUnion = StringAlias | NumberAlias;
50
+ interface GenericAlias<T> {
51
+ value: T;
52
+ }
53
+
54
+ interface TypeScriptPropsProps {
55
+ any: any;
56
+ string: string;
57
+ bool: boolean;
58
+ number: number;
59
+ voidFunc: () => void;
60
+ funcWithArgsAndReturns: (a: string, b: string) => string;
61
+ funcWithunionArg: (a: string | number) => string;
62
+ funcWithMultipleUnionReturns: () => string | ItemInterface;
63
+ funcWithIndexTypes: <T, K extends keyof T>(o: T, propertyNames: K[]) => T[K][];
64
+ symbol: symbol;
65
+ interface: ItemInterface;
66
+ genericInterface: GenericInterface<string>;
67
+ arrayOfPrimitive: string[];
68
+ arrayOfComplexObject: ItemInterface[];
69
+ tupleOfPrimitive: [string, number];
70
+ tupleWithComplexType: [string, ItemInterface];
71
+ defaultEnum: DefaultEnum;
72
+ numericEnum: NumericEnum;
73
+ stringEnum: StringEnum;
74
+ enumUnion: EnumUnion;
75
+ recordOfPrimitive: Record<string, number>;
76
+ recordOfComplexObject: Record<string, ItemInterface>;
77
+ intersectionType: InterfaceIntersection;
78
+ intersectionWithInlineType: ItemInterface & { inlineValue: string };
79
+ unionOfPrimitive: string | number;
80
+ unionOfComplexType: ItemInterface | InterfaceIntersection;
81
+ nullablePrimitive?: string;
82
+ nullableComplexType?: ItemInterface;
83
+ nullableComplexTypeUndefinedDefaultValue?: ItemInterface;
84
+ readonly readonlyPrimitive: string;
85
+ typeAlias: StringAlias;
86
+ aliasesIntersection: AliasesIntersection;
87
+ aliasesUnion: AliasesUnion;
88
+ genericAlias: GenericAlias<string>;
89
+ namedStringLiteralUnion: StringLiteralUnion;
90
+ inlinedStringLiteralUnion: 'bottom-left' | 'bottom-right' | 'bottom-center';
91
+ namedNumericLiteralUnion: NumericLiteralUnion;
92
+ inlinedNumericLiteralUnion: 0 | 1 | 2;
93
+ }
94
+
95
+ export const TypeScriptProps: FC<TypeScriptPropsProps> = () => <div>TypeScript!</div>;
96
+ TypeScriptProps.defaultProps = {
97
+ any: 'Any value',
98
+ string: 'A string value',
99
+ bool: true,
100
+ number: 5,
101
+ voidFunc: () => {},
102
+ funcWithArgsAndReturns: concat,
103
+ symbol: Symbol('Default symbol'),
104
+ interface: { text: 'foo', value: 'bar' },
105
+ genericInterface: { value: 'A string value' },
106
+ arrayOfPrimitive: ['foo', 'bar'],
107
+ arrayOfComplexObject: [{ text: 'foo', value: 'bar' }],
108
+ tupleOfPrimitive: ['string value', 5],
109
+ tupleWithComplexType: ['string value', { text: 'foo', value: 'bar' }],
110
+ defaultEnum: DefaultEnum.TopRight,
111
+ numericEnum: NumericEnum.TopRight,
112
+ stringEnum: StringEnum.TopRight,
113
+ enumUnion: DefaultEnum.TopLeft,
114
+ recordOfPrimitive: { foo: 1, bar: 2 },
115
+ recordOfComplexObject: { foo: { text: 'bar', value: 'bar2' } },
116
+ intersectionType: { text: 'foo', value: 'bar', name: 'foo-bar' },
117
+ intersectionWithInlineType: { text: 'foo', value: 'bar', inlineValue: 'this is inlined' },
118
+ unionOfPrimitive: 'A string value',
119
+ unionOfComplexType: { text: 'foo', value: 'bar' },
120
+ nullableComplexTypeUndefinedDefaultValue: undefined,
121
+ typeAlias: 'foo',
122
+ aliasesUnion: 'foo',
123
+ genericAlias: { value: 'foo' },
124
+ namedStringLiteralUnion: 'top-right',
125
+ inlinedStringLiteralUnion: 'bottom-right',
126
+ namedNumericLiteralUnion: 0,
127
+ inlinedNumericLiteralUnion: 1,
128
+ };
129
+
130
+ export const component = TypeScriptProps;