@alloy-js/typescript 0.23.0-dev.7 → 0.23.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 (196) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/dev/src/components/FunctionBase.js +1 -9
  3. package/dist/dev/src/components/FunctionBase.js.map +1 -1
  4. package/dist/dev/src/components/ImportStatement.js +42 -10
  5. package/dist/dev/src/components/ImportStatement.js.map +1 -1
  6. package/dist/dev/src/name-conflict-resolver.js +8 -2
  7. package/dist/dev/src/name-conflict-resolver.js.map +1 -1
  8. package/dist/dev/src/symbols/index.js +9 -3
  9. package/dist/dev/src/symbols/index.js.map +1 -1
  10. package/dist/dev/src/symbols/reference.js +19 -9
  11. package/dist/dev/src/symbols/reference.js.map +1 -1
  12. package/dist/dev/src/symbols/ts-module-scope.js +66 -2
  13. package/dist/dev/src/symbols/ts-module-scope.js.map +1 -1
  14. package/dist/dev/test/externals.test.js +17 -13
  15. package/dist/dev/test/externals.test.js.map +1 -1
  16. package/dist/dev/test/function-declaration.test.js +65 -7
  17. package/dist/dev/test/function-declaration.test.js.map +1 -1
  18. package/dist/dev/test/imports-reactive.test.js +223 -0
  19. package/dist/dev/test/imports-reactive.test.js.map +1 -0
  20. package/dist/dev/test/imports.test.js +262 -80
  21. package/dist/dev/test/imports.test.js.map +1 -1
  22. package/dist/dev/test/name-conflict.test.js.map +1 -1
  23. package/dist/src/components/FunctionBase.js +1 -5
  24. package/dist/src/components/FunctionBase.js.map +1 -1
  25. package/dist/src/components/ImportStatement.d.ts.map +1 -1
  26. package/dist/src/components/ImportStatement.js +16 -8
  27. package/dist/src/components/ImportStatement.js.map +1 -1
  28. package/dist/src/name-conflict-resolver.d.ts +2 -2
  29. package/dist/src/name-conflict-resolver.d.ts.map +1 -1
  30. package/dist/src/name-conflict-resolver.js +8 -2
  31. package/dist/src/name-conflict-resolver.js.map +1 -1
  32. package/dist/src/symbols/index.d.ts.map +1 -1
  33. package/dist/src/symbols/index.js +9 -3
  34. package/dist/src/symbols/index.js.map +1 -1
  35. package/dist/src/symbols/reference.d.ts.map +1 -1
  36. package/dist/src/symbols/reference.js +13 -3
  37. package/dist/src/symbols/reference.js.map +1 -1
  38. package/dist/src/symbols/ts-module-scope.d.ts +7 -0
  39. package/dist/src/symbols/ts-module-scope.d.ts.map +1 -1
  40. package/dist/src/symbols/ts-module-scope.js +66 -2
  41. package/dist/src/symbols/ts-module-scope.js.map +1 -1
  42. package/dist/test/externals.test.js +5 -1
  43. package/dist/test/externals.test.js.map +1 -1
  44. package/dist/test/function-declaration.test.js +42 -0
  45. package/dist/test/function-declaration.test.js.map +1 -1
  46. package/dist/test/imports-reactive.test.d.ts +2 -0
  47. package/dist/test/imports-reactive.test.d.ts.map +1 -0
  48. package/dist/test/imports-reactive.test.js +167 -0
  49. package/dist/test/imports-reactive.test.js.map +1 -0
  50. package/dist/test/imports.test.js +121 -3
  51. package/dist/test/imports.test.js.map +1 -1
  52. package/dist/test/name-conflict.test.js.map +1 -1
  53. package/dist/tsconfig.tsbuildinfo +1 -1
  54. package/docs/api/components/ArrowFunction.md +71 -0
  55. package/docs/api/components/BarrelFile.md +58 -0
  56. package/docs/api/components/BlockScope.md +97 -0
  57. package/docs/api/components/CallSignature.md +45 -0
  58. package/docs/api/components/CaseClause.md +102 -0
  59. package/docs/api/components/CatchClause.md +50 -0
  60. package/docs/api/components/ClassDeclaration.md +61 -0
  61. package/docs/api/components/ClassField.md +63 -0
  62. package/docs/api/components/ClassMember.md +56 -0
  63. package/docs/api/components/ClassMethod.md +75 -0
  64. package/docs/api/components/CommaList.md +31 -0
  65. package/docs/api/components/Declaration.md +87 -0
  66. package/docs/api/components/ElseClause.md +29 -0
  67. package/docs/api/components/ElseIfClause.md +30 -0
  68. package/docs/api/components/EnumDeclaration.md +29 -0
  69. package/docs/api/components/EnumMember.md +46 -0
  70. package/docs/api/components/ExportStatement.md +26 -0
  71. package/docs/api/components/FinallyClause.md +50 -0
  72. package/docs/api/components/FunctionCallExpression.md +29 -0
  73. package/docs/api/components/FunctionDeclaration.md +57 -0
  74. package/docs/api/components/FunctionExpression.md +71 -0
  75. package/docs/api/components/IfStatement.md +30 -0
  76. package/docs/api/components/ImportStatement.md +29 -0
  77. package/docs/api/components/ImportStatements.md +25 -0
  78. package/docs/api/components/InterfaceDeclaration.md +38 -0
  79. package/docs/api/components/InterfaceMember.md +99 -0
  80. package/docs/api/components/InterfaceMethod.md +74 -0
  81. package/docs/api/components/JSDoc.md +29 -0
  82. package/docs/api/components/JSDocComment.md +29 -0
  83. package/docs/api/components/JSDocExample.md +31 -0
  84. package/docs/api/components/MemberExpression.md +58 -0
  85. package/docs/api/components/NewExpression.md +26 -0
  86. package/docs/api/components/ObjectExpression.md +32 -0
  87. package/docs/api/components/ObjectProperty.md +44 -0
  88. package/docs/api/components/ObjectSpreadProperty.md +29 -0
  89. package/docs/api/components/PackageDirectory.md +102 -0
  90. package/docs/api/components/PackageJsonFile.md +82 -0
  91. package/docs/api/components/Reference.md +26 -0
  92. package/docs/api/components/SingleLineCommentBlock.md +29 -0
  93. package/docs/api/components/SourceFile.md +41 -0
  94. package/docs/api/components/SwitchStatement.md +30 -0
  95. package/docs/api/components/TSConfigJson.md +25 -0
  96. package/docs/api/components/TryStatement.md +50 -0
  97. package/docs/api/components/TypeRefContext.md +35 -0
  98. package/docs/api/components/ValueExpression.md +25 -0
  99. package/docs/api/components/VarDeclaration.md +44 -0
  100. package/docs/api/components/ensureTypeRefContext.md +28 -0
  101. package/docs/api/components/index.md +49 -0
  102. package/docs/api/contexts/Package-context.md +21 -0
  103. package/docs/api/contexts/PackageMetadata-context.md +18 -0
  104. package/docs/api/contexts/SourceFile-context.md +20 -0
  105. package/docs/api/contexts/index.md +5 -0
  106. package/docs/api/functions/createInstanceMemberSymbol.md +38 -0
  107. package/docs/api/functions/createLexicalScope.md +27 -0
  108. package/docs/api/functions/createMemberScope.md +28 -0
  109. package/docs/api/functions/createMemberSymbol.md +42 -0
  110. package/docs/api/functions/createPackage.md +18 -0
  111. package/docs/api/functions/createPrivateInstanceMemberSymbol.md +38 -0
  112. package/docs/api/functions/createPrivateStaticMemberSymbol.md +38 -0
  113. package/docs/api/functions/createStaticMemberSymbol.md +38 -0
  114. package/docs/api/functions/createTSNamePolicy.md +17 -0
  115. package/docs/api/functions/createTransientValueSymbol.md +17 -0
  116. package/docs/api/functions/createTypeAndValueSymbol.md +38 -0
  117. package/docs/api/functions/createTypeSymbol.md +38 -0
  118. package/docs/api/functions/createValueSymbol.md +38 -0
  119. package/docs/api/functions/decl.md +38 -0
  120. package/docs/api/functions/declMember.md +42 -0
  121. package/docs/api/functions/declType.md +38 -0
  122. package/docs/api/functions/getPackageScope.md +20 -0
  123. package/docs/api/functions/getSourceDirectoryData.md +18 -0
  124. package/docs/api/functions/index.md +27 -0
  125. package/docs/api/functions/ref.md +25 -0
  126. package/docs/api/functions/tsNameConflictResolver.md +19 -0
  127. package/docs/api/functions/useTSLexicalScope.md +17 -0
  128. package/docs/api/functions/useTSLexicalScopeIfPresent.md +17 -0
  129. package/docs/api/functions/useTSMemberScope.md +17 -0
  130. package/docs/api/functions/useTSNamePolicy.md +17 -0
  131. package/docs/api/functions/useTSScope.md +17 -0
  132. package/docs/api/index.md +7 -0
  133. package/docs/api/types/AddImportOptions.md +7 -0
  134. package/docs/api/types/BlockScopeProps.md +5 -0
  135. package/docs/api/types/CaseClauseProps.md +5 -0
  136. package/docs/api/types/CaseClausePropsBase.md +9 -0
  137. package/docs/api/types/CommonDeclarationProps.md +7 -0
  138. package/docs/api/types/CreatePackageProps.md +12 -0
  139. package/docs/api/types/CreateTsSymbolOptions.md +12 -0
  140. package/docs/api/types/DeclarationProps.md +5 -0
  141. package/docs/api/types/DeclarationPropsBase.md +8 -0
  142. package/docs/api/types/ExportConditions.md +7 -0
  143. package/docs/api/types/ExportPath.md +5 -0
  144. package/docs/api/types/ExternalPackage.md +7 -0
  145. package/docs/api/types/FunctionBodyProps.md +7 -0
  146. package/docs/api/types/FunctionParametersProps.md +10 -0
  147. package/docs/api/types/FunctionTypeParameterDescriptor.md +10 -0
  148. package/docs/api/types/FunctionTypeParametersProps.md +10 -0
  149. package/docs/api/types/FunctionTypeProps.md +13 -0
  150. package/docs/api/types/ImportRecords.md +5 -0
  151. package/docs/api/types/ImportedSymbol.md +8 -0
  152. package/docs/api/types/InterfaceExpressionProps.md +7 -0
  153. package/docs/api/types/InterfaceMemberProps.md +5 -0
  154. package/docs/api/types/InterfaceMemberPropsBase.md +11 -0
  155. package/docs/api/types/MemberExpressionPartProps.md +15 -0
  156. package/docs/api/types/ModuleExports.md +18 -0
  157. package/docs/api/types/ModuleSymbolsDescriptor.md +10 -0
  158. package/docs/api/types/NamedMap.md +18 -0
  159. package/docs/api/types/NamedModuleDescriptor.md +17 -0
  160. package/docs/api/types/PackageDescriptor.md +7 -0
  161. package/docs/api/types/PackageExports.md +7 -0
  162. package/docs/api/types/PackageRefkeys.md +10 -0
  163. package/docs/api/types/ParameterDescriptor.md +11 -0
  164. package/docs/api/types/ParameterDescriptorBase.md +16 -0
  165. package/docs/api/types/RefOptions.md +7 -0
  166. package/docs/api/types/SourceDirectoryData.md +7 -0
  167. package/docs/api/types/SourceFileHeaderProps.md +8 -0
  168. package/docs/api/types/TSLexicalScope.md +13 -0
  169. package/docs/api/types/TSMemberScope.md +14 -0
  170. package/docs/api/types/TSModuleScope.md +17 -0
  171. package/docs/api/types/TSOutputScope.md +5 -0
  172. package/docs/api/types/TSOutputSymbol.md +28 -0
  173. package/docs/api/types/TSPackageScope.md +21 -0
  174. package/docs/api/types/TSPackageScopeOptions.md +9 -0
  175. package/docs/api/types/TypeDeclarationProps.md +8 -0
  176. package/docs/api/types/TypeParameterDescriptor.md +13 -0
  177. package/docs/api/types/TypeScriptElements.md +5 -0
  178. package/docs/api/types/index.md +47 -0
  179. package/docs/api/variables/FunctionType.md +24 -0
  180. package/docs/api/variables/InterfaceExpression.md +5 -0
  181. package/docs/api/variables/TSSymbolFlags.md +5 -0
  182. package/docs/api/variables/TypeDeclaration.md +5 -0
  183. package/docs/api/variables/index.md +6 -0
  184. package/package.json +6 -6
  185. package/src/components/FunctionBase.tsx +1 -1
  186. package/src/components/ImportStatement.tsx +26 -12
  187. package/src/name-conflict-resolver.ts +12 -8
  188. package/src/symbols/index.ts +18 -3
  189. package/src/symbols/reference.tsx +17 -6
  190. package/src/symbols/ts-module-scope.ts +79 -2
  191. package/temp/api.json +68 -2
  192. package/test/externals.test.tsx +5 -1
  193. package/test/function-declaration.test.tsx +36 -0
  194. package/test/imports-reactive.test.tsx +128 -0
  195. package/test/imports.test.tsx +136 -2
  196. package/test/name-conflict.test.tsx +4 -4
@@ -0,0 +1,75 @@
1
+ # ClassMethod
2
+
3
+ * jsx
4
+
5
+ ```tsx
6
+ import { ClassMethod } from "@alloy-js/typescript";
7
+
8
+
9
+ <ClassMethod
10
+ async
11
+ doc={Children}
12
+ jsPrivate
13
+ name={string | Namekey}
14
+ nullish
15
+ parameters={ParameterDescriptor[] | string[]}
16
+ parametersChildren={Children}
17
+ private
18
+ protected
19
+ public
20
+ refkey={Refkey}
21
+ returnType={Children}
22
+ static
23
+ typeParameters={TypeParameterDescriptor[] | string[]}
24
+ typeParametersChildren={Children}
25
+ >
26
+ {children}
27
+ </ClassMethod>
28
+ ```
29
+
30
+ * stc
31
+
32
+ ```ts
33
+ import { ClassMethod } from "@alloy-js/typescript/stc";
34
+
35
+
36
+ ClassMethod({
37
+ async: boolean,
38
+ doc: Children,
39
+ jsPrivate: boolean,
40
+ name: string | Namekey,
41
+ nullish: boolean,
42
+ parameters: ParameterDescriptor[] | string[],
43
+ parametersChildren: Children,
44
+ private: boolean,
45
+ protected: boolean,
46
+ public: boolean,
47
+ refkey: Refkey,
48
+ returnType: Children,
49
+ static: boolean,
50
+ typeParameters: TypeParameterDescriptor[] | string[],
51
+ typeParametersChildren: Children,
52
+ }).children(children)
53
+ ```
54
+
55
+ ## Props
56
+
57
+ | | | |
58
+ | ---------------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
59
+ | async | optional boolean | |
60
+ | children | optional [Children](../../../core/types/children/) | |
61
+ | children | optional [Children](../../../core/types/children/) | |
62
+ | doc | optional [Children](../../../core/types/children/) | |
63
+ | jsPrivate | optional boolean | |
64
+ | name | string \| [Namekey](../../../core/types/namekey/) | |
65
+ | nullish | optional boolean | |
66
+ | parameters | optional [ParameterDescriptor](../../types/parameterdescriptor/)\[] \| string\[] | The parameters to the function. Can be an array of strings for parameters which don’t have a type or a default value. Otherwise, it’s an array of [ParameterDescriptor](../../types/parameterdescriptor/)s. |
67
+ | parametersChildren | optional [Children](../../../core/types/children/) | Raw content to be used as the parameter list. |
68
+ | private | optional boolean | |
69
+ | protected | optional boolean | |
70
+ | public | optional boolean | |
71
+ | refkey | optional [Refkey](../../../core/types/refkey/) | |
72
+ | returnType | optional [Children](../../../core/types/children/) | The return type of the function. |
73
+ | static | optional boolean | |
74
+ | typeParameters | optional [TypeParameterDescriptor](../../types/typeparameterdescriptor/)\[] \| string\[] | The type parameters for the function. Can be an array of strings for type parameters which don’t have any constraints or a default type, otherwise it’s an array of [TypeParameterDescriptor](../../types/typeparameterdescriptor/)s. |
75
+ | typeParametersChildren | optional [Children](../../../core/types/children/) | Raw content to be used as the type parameter list. |
@@ -0,0 +1,31 @@
1
+ # CommaList
2
+
3
+ A comma-separated list of items (e.g. arguments to a function call, parameters, etc).
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { CommaList } from "@alloy-js/typescript";
9
+
10
+
11
+ <CommaList hardline softline>
12
+ {children}
13
+ </CommaList>
14
+ ```
15
+
16
+ * stc
17
+
18
+ ```ts
19
+ import { CommaList } from "@alloy-js/typescript/stc";
20
+
21
+
22
+ CommaList({ hardline: boolean, softline: boolean }).children(children)
23
+ ```
24
+
25
+ ## Props
26
+
27
+ | | | |
28
+ | -------- | ----------------------------------------- | - |
29
+ | children | [Children](../../../core/types/children/) | |
30
+ | hardline | optional boolean | |
31
+ | softline | optional boolean | |
@@ -0,0 +1,87 @@
1
+ # Declaration
2
+
3
+ Create a TypeScript declaration. Generally, this component shouldn’t be used directly, and instead prefer components for specific declarations, e.g. [EnumDeclaration](../enumdeclaration/), [InterfaceDeclaration](../interfacedeclaration/), [TypeDeclaration](../../variables/typedeclaration/), etc.
4
+
5
+ ## Overload 1
6
+
7
+ * jsx
8
+
9
+ ```tsx
10
+ import { Declaration } from "@alloy-js/typescript";
11
+
12
+
13
+ <Declaration doc={Children} symbol={TSOutputSymbol} />
14
+ ```
15
+
16
+ * stc
17
+
18
+ ```ts
19
+ import { Declaration } from "@alloy-js/typescript/stc";
20
+
21
+
22
+ Declaration({ doc: Children, symbol: TSOutputSymbol }).children(children)
23
+ ```
24
+
25
+ ### Props
26
+
27
+ | | | |
28
+ | -------- | -------------------------------------------------- | --------------------------------------- |
29
+ | children | optional [Children](../../../core/types/children/) | |
30
+ | doc | optional [Children](../../../core/types/children/) | Documentation for this declaration |
31
+ | symbol | [TSOutputSymbol](../../types/tsoutputsymbol/) | The symbol to use for this declaration. |
32
+
33
+ ## Overload 2
34
+
35
+ * jsx
36
+
37
+ ```tsx
38
+ import { Declaration } from "@alloy-js/typescript";
39
+
40
+
41
+ <Declaration
42
+ default
43
+ doc={Children}
44
+ export
45
+ kind={"type" | "value"}
46
+ metadata={Record<string, unknown>}
47
+ name={string | Namekey}
48
+ nameKind={TypeScriptElements}
49
+ refkey={Refkey | Refkey[]}
50
+ />
51
+ ```
52
+
53
+ * stc
54
+
55
+ ```ts
56
+ import { Declaration } from "@alloy-js/typescript/stc";
57
+
58
+
59
+ Declaration({
60
+ default: boolean,
61
+ doc: Children,
62
+ export: boolean,
63
+ kind: "type" | "value",
64
+ metadata: Record<string, unknown>,
65
+ name: string | Namekey,
66
+ nameKind: TypeScriptElements,
67
+ refkey: Refkey | Refkey[],
68
+ }).children(children)
69
+ ```
70
+
71
+ ### Props
72
+
73
+ | | | |
74
+ | -------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------- |
75
+ | children | optional [Children](../../../core/types/children/) | |
76
+ | default | optional boolean | Whether this is the default export of the module. |
77
+ | doc | optional [Children](../../../core/types/children/) | Documentation for this declaration |
78
+ | export | optional boolean | Whether to export this declaration from the module. |
79
+ | kind | optional “type” \| “value” | Whether this is a declaration of a type (e.g. interface, type alias) or a value (e.g. var, const, let). |
80
+ | metadata | optional Record\<string, unknown> | Arbitrary metadata about this declaration. |
81
+ | name | string \| [Namekey](../../../core/types/namekey/) | The base name of this declaration. May change depending on naming policy and any conflicts. |
82
+ | nameKind | [TypeScriptElements](../../types/typescriptelements/) | The name policy kind to apply to the declaration. |
83
+ | refkey | optional [Refkey](../../../core/types/refkey/) \| [Refkey](../../../core/types/refkey/)\[] | The refkey or array of refkeys for this declaration. |
84
+
85
+ ## Remarks
86
+
87
+ This component will wrap its contents in a [Declaration](../../../core/components/declaration/) component, so children can make use of declaration context.
@@ -0,0 +1,29 @@
1
+ # ElseClause
2
+
3
+ The else clause of an if statement.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { ElseClause } from "@alloy-js/typescript";
9
+
10
+
11
+ <ElseClause >
12
+ {children}
13
+ </ElseClause>
14
+ ```
15
+
16
+ * stc
17
+
18
+ ```ts
19
+ import { ElseClause } from "@alloy-js/typescript/stc";
20
+
21
+
22
+ ElseClause({ }).children(children)
23
+ ```
24
+
25
+ ## Props
26
+
27
+ | | | |
28
+ | -------- | ----------------------------------------- | - |
29
+ | children | [Children](../../../core/types/children/) | |
@@ -0,0 +1,30 @@
1
+ # ElseIfClause
2
+
3
+ An else clause with an if statement.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { ElseIfClause } from "@alloy-js/typescript";
9
+
10
+
11
+ <ElseIfClause condition={Children}>
12
+ {children}
13
+ </ElseIfClause>
14
+ ```
15
+
16
+ * stc
17
+
18
+ ```ts
19
+ import { ElseIfClause } from "@alloy-js/typescript/stc";
20
+
21
+
22
+ ElseIfClause({ condition: Children }).children(children)
23
+ ```
24
+
25
+ ## Props
26
+
27
+ | | | |
28
+ | --------- | ----------------------------------------- | - |
29
+ | children | [Children](../../../core/types/children/) | |
30
+ | condition | [Children](../../../core/types/children/) | |
@@ -0,0 +1,29 @@
1
+ # EnumDeclaration
2
+
3
+ A TypeScript enum declaration.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { EnumDeclaration } from "@alloy-js/typescript";
9
+
10
+
11
+ <EnumDeclaration jsValue={Record<string, string | number>} />
12
+ ```
13
+
14
+ * stc
15
+
16
+ ```ts
17
+ import { EnumDeclaration } from "@alloy-js/typescript/stc";
18
+
19
+
20
+ EnumDeclaration({
21
+ jsValue: Record<string, string | number>,
22
+ }).children(children)
23
+ ```
24
+
25
+ ## Props
26
+
27
+ | | | |
28
+ | ------- | ------------------------------------------ | ---------------------------------------------------------- |
29
+ | jsValue | optional Record\<string, string \| number> | A JS object representing the enum member names and values. |
@@ -0,0 +1,46 @@
1
+ # EnumMember
2
+
3
+ A TypeScript enum member.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { EnumMember } from "@alloy-js/typescript";
9
+
10
+
11
+ <EnumMember
12
+ doc={Children}
13
+ jsValue={string | number}
14
+ metadata={Record<string, unknown>}
15
+ name={string | Namekey}
16
+ refkey={Refkey}
17
+ value={Children}
18
+ />
19
+ ```
20
+
21
+ * stc
22
+
23
+ ```ts
24
+ import { EnumMember } from "@alloy-js/typescript/stc";
25
+
26
+
27
+ EnumMember({
28
+ doc: Children,
29
+ jsValue: string | number,
30
+ metadata: Record<string, unknown>,
31
+ name: string | Namekey,
32
+ refkey: Refkey,
33
+ value: Children,
34
+ }).children(children)
35
+ ```
36
+
37
+ ## Props
38
+
39
+ | | | |
40
+ | -------- | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
41
+ | doc | optional [Children](../../../core/types/children/) | Documentation for the enum member. |
42
+ | jsValue | optional string \| number | The JS value of the enum member. |
43
+ | metadata | optional Record\<string, unknown> | Arbitrary symbol metadata for the enum member. |
44
+ | name | string \| [Namekey](../../../core/types/namekey/) | The name of the member. If a naming policy is provided in context, the policy name “enum-member” is used. |
45
+ | refkey | optional [Refkey](../../../core/types/refkey/) | Refkey for the enum member symbol. If the refkey is not provided, a symbol is not created and the member cannot be referenced by refkey. |
46
+ | value | optional [Children](../../../core/types/children/) | The value of the enum member. |
@@ -0,0 +1,26 @@
1
+ # ExportStatement
2
+
3
+ * jsx
4
+
5
+ ```tsx
6
+ import { ExportStatement } from "@alloy-js/typescript";
7
+
8
+
9
+ <ExportStatement from={TSModuleScope} star />
10
+ ```
11
+
12
+ * stc
13
+
14
+ ```ts
15
+ import { ExportStatement } from "@alloy-js/typescript/stc";
16
+
17
+
18
+ ExportStatement({ from: TSModuleScope, star: boolean }).children(children)
19
+ ```
20
+
21
+ ## Props
22
+
23
+ | | | |
24
+ | ---- | ---------------------------------------------------- | - |
25
+ | from | optional [TSModuleScope](../../types/tsmodulescope/) | |
26
+ | star | optional boolean | |
@@ -0,0 +1,50 @@
1
+ # FinallyClause
2
+
3
+ A finally clause of a try statement.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { FinallyClause } from "@alloy-js/typescript";
9
+
10
+
11
+ <FinallyClause >
12
+ {children}
13
+ </FinallyClause>
14
+ ```
15
+
16
+ * stc
17
+
18
+ ```ts
19
+ import { FinallyClause } from "@alloy-js/typescript/stc";
20
+
21
+
22
+ FinallyClause({ }).children(children)
23
+ ```
24
+
25
+ ## Props
26
+
27
+ | | | |
28
+ | -------- | ----------------------------------------- | - |
29
+ | children | [Children](../../../core/types/children/) | |
30
+
31
+ ## Example
32
+
33
+ ```tsx
34
+ <TryStatement>
35
+ // risky operation
36
+ </TryStatement>
37
+ <FinallyClause>
38
+ // cleanup
39
+ </FinallyClause>
40
+ ```
41
+
42
+ renders to
43
+
44
+ ```ts
45
+ try {
46
+ // risky operation
47
+ } finally {
48
+ // cleanup
49
+ }
50
+ ```
@@ -0,0 +1,29 @@
1
+ # FunctionCallExpression
2
+
3
+ * jsx
4
+
5
+ ```tsx
6
+ import { FunctionCallExpression } from "@alloy-js/typescript";
7
+
8
+
9
+ <FunctionCallExpression args={Children[]} target={Children} />
10
+ ```
11
+
12
+ * stc
13
+
14
+ ```ts
15
+ import { FunctionCallExpression } from "@alloy-js/typescript/stc";
16
+
17
+
18
+ FunctionCallExpression({
19
+ args: Children[],
20
+ target: Children,
21
+ }).children(children)
22
+ ```
23
+
24
+ ## Props
25
+
26
+ | | | |
27
+ | ------ | ----------------------------------------------------- | - |
28
+ | args | optional [Children](../../../core/types/children/)\[] | |
29
+ | target | [Children](../../../core/types/children/) | |
@@ -0,0 +1,57 @@
1
+ # FunctionDeclaration
2
+
3
+ A TypeScript function declaration.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { FunctionDeclaration } from "@alloy-js/typescript";
9
+
10
+
11
+ <FunctionDeclaration
12
+ async
13
+ parameters={ParameterDescriptor[] | string[]}
14
+ parametersChildren={Children}
15
+ returnType={Children}
16
+ typeParameters={TypeParameterDescriptor[] | string[]}
17
+ typeParametersChildren={Children}
18
+ >
19
+ {children}
20
+ </FunctionDeclaration>
21
+ ```
22
+
23
+ * stc
24
+
25
+ ```ts
26
+ import { FunctionDeclaration } from "@alloy-js/typescript/stc";
27
+
28
+
29
+ FunctionDeclaration({
30
+ async: boolean,
31
+ parameters: ParameterDescriptor[] | string[],
32
+ parametersChildren: Children,
33
+ returnType: Children,
34
+ typeParameters: TypeParameterDescriptor[] | string[],
35
+ typeParametersChildren: Children,
36
+ }).children(children)
37
+ ```
38
+
39
+ ## Props
40
+
41
+ | | | |
42
+ | ---------------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
43
+ | async | optional boolean | |
44
+ | children | optional [Children](../../../core/types/children/) | |
45
+ | parameters | optional [ParameterDescriptor](../../types/parameterdescriptor/)\[] \| string\[] | The parameters to the function. Can be an array of strings for parameters which don’t have a type or a default value. Otherwise, it’s an array of [ParameterDescriptor](../../types/parameterdescriptor/)s. |
46
+ | parametersChildren | optional [Children](../../../core/types/children/) | Raw content to be used as the parameter list. |
47
+ | returnType | optional [Children](../../../core/types/children/) | The return type of the function. |
48
+ | typeParameters | optional [TypeParameterDescriptor](../../types/typeparameterdescriptor/)\[] \| string\[] | The type parameters for the function. Can be an array of strings for type parameters which don’t have any constraints or a default type, otherwise it’s an array of [TypeParameterDescriptor](../../types/typeparameterdescriptor/)s. |
49
+ | typeParametersChildren | optional [Children](../../../core/types/children/) | Raw content to be used as the type parameter list. |
50
+
51
+ ## Remarks
52
+
53
+ Providing parameters and type parameters can be accomplished in one of three ways:
54
+
55
+ 1. As an array of [ParameterDescriptor](../../types/parameterdescriptor/)s or [TypeParameterDescriptor](../../types/typeparameterdescriptor/)s.
56
+ 2. As raw content via the `parametersChildren` or `typeParametersChildren` props.
57
+ 3. As a child of this component via the \[unresolved link] or \[unresolved link] components.
@@ -0,0 +1,71 @@
1
+ # FunctionExpression
2
+
3
+ A TypeScript function expression.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { FunctionExpression } from "@alloy-js/typescript";
9
+
10
+
11
+ <FunctionExpression
12
+ async
13
+ parameters={ParameterDescriptor[] | string[]}
14
+ parametersChildren={Children}
15
+ returnType={Children}
16
+ typeParameters={TypeParameterDescriptor[] | string[]}
17
+ typeParametersChildren={Children}
18
+ >
19
+ {children}
20
+ </FunctionExpression>
21
+ ```
22
+
23
+ * stc
24
+
25
+ ```ts
26
+ import { FunctionExpression } from "@alloy-js/typescript/stc";
27
+
28
+
29
+ FunctionExpression({
30
+ async: boolean,
31
+ parameters: ParameterDescriptor[] | string[],
32
+ parametersChildren: Children,
33
+ returnType: Children,
34
+ typeParameters: TypeParameterDescriptor[] | string[],
35
+ typeParametersChildren: Children,
36
+ }).children(children)
37
+ ```
38
+
39
+ ## Props
40
+
41
+ | | | |
42
+ | ---------------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
43
+ | async | optional boolean | |
44
+ | children | optional [Children](../../../core/types/children/) | |
45
+ | parameters | optional [ParameterDescriptor](../../types/parameterdescriptor/)\[] \| string\[] | The parameters to the function. Can be an array of strings for parameters which don’t have a type or a default value. Otherwise, it’s an array of [ParameterDescriptor](../../types/parameterdescriptor/)s. |
46
+ | parametersChildren | optional [Children](../../../core/types/children/) | Raw content to be used as the parameter list. |
47
+ | returnType | optional [Children](../../../core/types/children/) | The return type of the function. |
48
+ | typeParameters | optional [TypeParameterDescriptor](../../types/typeparameterdescriptor/)\[] \| string\[] | The type parameters for the function. Can be an array of strings for type parameters which don’t have any constraints or a default type, otherwise it’s an array of [TypeParameterDescriptor](../../types/typeparameterdescriptor/)s. |
49
+ | typeParametersChildren | optional [Children](../../../core/types/children/) | Raw content to be used as the type parameter list. |
50
+
51
+ ## Remarks
52
+
53
+ Providing parameters and type parameters can be accomplished in one of three ways:
54
+
55
+ 1. As an array of [ParameterDescriptor](../../types/parameterdescriptor/)s or [TypeParameterDescriptor](../../types/typeparameterdescriptor/)s.
56
+ 2. As raw content via the `parametersChildren` or `typeParametersChildren` props.
57
+ 3. As a child of this component via the \[unresolved link] or \[unresolved link] components.
58
+
59
+ ## Example
60
+
61
+ ```tsx
62
+ <FunctionExpression async parameters={[{ name: "a", type: "number" }, { name: "b", type: "number" }]}>
63
+ return a + b;
64
+ <FunctionExpression>
65
+ ```
66
+
67
+ renders to
68
+
69
+ ```ts
70
+ async function (a, b) { return a + b; }
71
+ ```
@@ -0,0 +1,30 @@
1
+ # IfStatement
2
+
3
+ An if statement.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { IfStatement } from "@alloy-js/typescript";
9
+
10
+
11
+ <IfStatement condition={Children}>
12
+ {children}
13
+ </IfStatement>
14
+ ```
15
+
16
+ * stc
17
+
18
+ ```ts
19
+ import { IfStatement } from "@alloy-js/typescript/stc";
20
+
21
+
22
+ IfStatement({ condition: Children }).children(children)
23
+ ```
24
+
25
+ ## Props
26
+
27
+ | | | |
28
+ | --------- | ----------------------------------------- | - |
29
+ | children | [Children](../../../core/types/children/) | |
30
+ | condition | [Children](../../../core/types/children/) | |
@@ -0,0 +1,29 @@
1
+ # ImportStatement
2
+
3
+ * jsx
4
+
5
+ ```tsx
6
+ import { ImportStatement } from "@alloy-js/typescript";
7
+
8
+
9
+ <ImportStatement path="string" symbols={Set<ImportedSymbol>} />
10
+ ```
11
+
12
+ * stc
13
+
14
+ ```ts
15
+ import { ImportStatement } from "@alloy-js/typescript/stc";
16
+
17
+
18
+ ImportStatement({
19
+ path: string,
20
+ symbols: Set<ImportedSymbol>,
21
+ }).children(children)
22
+ ```
23
+
24
+ ## Props
25
+
26
+ | | | |
27
+ | ------- | -------------------------------------------------- | - |
28
+ | path | string | |
29
+ | symbols | Set<[ImportedSymbol](../../types/importedsymbol/)> | |
@@ -0,0 +1,25 @@
1
+ # ImportStatements
2
+
3
+ * jsx
4
+
5
+ ```tsx
6
+ import { ImportStatements } from "@alloy-js/typescript";
7
+
8
+
9
+ <ImportStatements records={ImportRecords} />
10
+ ```
11
+
12
+ * stc
13
+
14
+ ```ts
15
+ import { ImportStatements } from "@alloy-js/typescript/stc";
16
+
17
+
18
+ ImportStatements({ records: ImportRecords }).children(children)
19
+ ```
20
+
21
+ ## Props
22
+
23
+ | | | |
24
+ | ------- | ------------------------------------------- | - |
25
+ | records | [ImportRecords](../../types/importrecords/) | |