@alloy-js/typescript 0.23.0-dev.7 → 0.23.0-dev.9
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.
- package/dist/dev/src/components/FunctionBase.js +1 -9
- package/dist/dev/src/components/FunctionBase.js.map +1 -1
- package/dist/dev/src/name-conflict-resolver.js.map +1 -1
- package/dist/dev/test/function-declaration.test.js +65 -7
- package/dist/dev/test/function-declaration.test.js.map +1 -1
- package/dist/dev/test/name-conflict.test.js.map +1 -1
- package/dist/src/components/FunctionBase.js +1 -5
- package/dist/src/components/FunctionBase.js.map +1 -1
- package/dist/src/name-conflict-resolver.d.ts +2 -2
- package/dist/src/name-conflict-resolver.d.ts.map +1 -1
- package/dist/src/name-conflict-resolver.js.map +1 -1
- package/dist/test/function-declaration.test.js +42 -0
- package/dist/test/function-declaration.test.js.map +1 -1
- package/dist/test/name-conflict.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/api/components/ArrowFunction.md +71 -0
- package/docs/api/components/BarrelFile.md +58 -0
- package/docs/api/components/BlockScope.md +97 -0
- package/docs/api/components/CallSignature.md +45 -0
- package/docs/api/components/CaseClause.md +102 -0
- package/docs/api/components/CatchClause.md +50 -0
- package/docs/api/components/ClassDeclaration.md +61 -0
- package/docs/api/components/ClassField.md +63 -0
- package/docs/api/components/ClassMember.md +56 -0
- package/docs/api/components/ClassMethod.md +75 -0
- package/docs/api/components/CommaList.md +31 -0
- package/docs/api/components/Declaration.md +87 -0
- package/docs/api/components/ElseClause.md +29 -0
- package/docs/api/components/ElseIfClause.md +30 -0
- package/docs/api/components/EnumDeclaration.md +29 -0
- package/docs/api/components/EnumMember.md +46 -0
- package/docs/api/components/ExportStatement.md +26 -0
- package/docs/api/components/FinallyClause.md +50 -0
- package/docs/api/components/FunctionCallExpression.md +29 -0
- package/docs/api/components/FunctionDeclaration.md +57 -0
- package/docs/api/components/FunctionExpression.md +71 -0
- package/docs/api/components/IfStatement.md +30 -0
- package/docs/api/components/ImportStatement.md +29 -0
- package/docs/api/components/ImportStatements.md +25 -0
- package/docs/api/components/InterfaceDeclaration.md +38 -0
- package/docs/api/components/InterfaceMember.md +99 -0
- package/docs/api/components/InterfaceMethod.md +74 -0
- package/docs/api/components/JSDoc.md +29 -0
- package/docs/api/components/JSDocComment.md +29 -0
- package/docs/api/components/JSDocExample.md +31 -0
- package/docs/api/components/MemberExpression.md +58 -0
- package/docs/api/components/NewExpression.md +26 -0
- package/docs/api/components/ObjectExpression.md +32 -0
- package/docs/api/components/ObjectProperty.md +44 -0
- package/docs/api/components/ObjectSpreadProperty.md +29 -0
- package/docs/api/components/PackageDirectory.md +102 -0
- package/docs/api/components/PackageJsonFile.md +82 -0
- package/docs/api/components/Reference.md +26 -0
- package/docs/api/components/SingleLineCommentBlock.md +29 -0
- package/docs/api/components/SourceFile.md +41 -0
- package/docs/api/components/SwitchStatement.md +30 -0
- package/docs/api/components/TSConfigJson.md +25 -0
- package/docs/api/components/TryStatement.md +50 -0
- package/docs/api/components/TypeRefContext.md +35 -0
- package/docs/api/components/ValueExpression.md +25 -0
- package/docs/api/components/VarDeclaration.md +44 -0
- package/docs/api/components/ensureTypeRefContext.md +28 -0
- package/docs/api/components/index.md +49 -0
- package/docs/api/contexts/Package-context.md +21 -0
- package/docs/api/contexts/PackageMetadata-context.md +18 -0
- package/docs/api/contexts/SourceFile-context.md +20 -0
- package/docs/api/contexts/index.md +5 -0
- package/docs/api/functions/createInstanceMemberSymbol.md +38 -0
- package/docs/api/functions/createLexicalScope.md +27 -0
- package/docs/api/functions/createMemberScope.md +28 -0
- package/docs/api/functions/createMemberSymbol.md +42 -0
- package/docs/api/functions/createPackage.md +18 -0
- package/docs/api/functions/createPrivateInstanceMemberSymbol.md +38 -0
- package/docs/api/functions/createPrivateStaticMemberSymbol.md +38 -0
- package/docs/api/functions/createStaticMemberSymbol.md +38 -0
- package/docs/api/functions/createTSNamePolicy.md +17 -0
- package/docs/api/functions/createTransientValueSymbol.md +17 -0
- package/docs/api/functions/createTypeAndValueSymbol.md +38 -0
- package/docs/api/functions/createTypeSymbol.md +38 -0
- package/docs/api/functions/createValueSymbol.md +38 -0
- package/docs/api/functions/decl.md +38 -0
- package/docs/api/functions/declMember.md +42 -0
- package/docs/api/functions/declType.md +38 -0
- package/docs/api/functions/getPackageScope.md +20 -0
- package/docs/api/functions/getSourceDirectoryData.md +18 -0
- package/docs/api/functions/index.md +27 -0
- package/docs/api/functions/ref.md +25 -0
- package/docs/api/functions/tsNameConflictResolver.md +19 -0
- package/docs/api/functions/useTSLexicalScope.md +17 -0
- package/docs/api/functions/useTSLexicalScopeIfPresent.md +17 -0
- package/docs/api/functions/useTSMemberScope.md +17 -0
- package/docs/api/functions/useTSNamePolicy.md +17 -0
- package/docs/api/functions/useTSScope.md +17 -0
- package/docs/api/index.md +7 -0
- package/docs/api/types/AddImportOptions.md +7 -0
- package/docs/api/types/BlockScopeProps.md +5 -0
- package/docs/api/types/CaseClauseProps.md +5 -0
- package/docs/api/types/CaseClausePropsBase.md +9 -0
- package/docs/api/types/CommonDeclarationProps.md +7 -0
- package/docs/api/types/CreatePackageProps.md +12 -0
- package/docs/api/types/CreateTsSymbolOptions.md +12 -0
- package/docs/api/types/DeclarationProps.md +5 -0
- package/docs/api/types/DeclarationPropsBase.md +8 -0
- package/docs/api/types/ExportConditions.md +7 -0
- package/docs/api/types/ExportPath.md +5 -0
- package/docs/api/types/ExternalPackage.md +7 -0
- package/docs/api/types/FunctionBodyProps.md +7 -0
- package/docs/api/types/FunctionParametersProps.md +10 -0
- package/docs/api/types/FunctionTypeParameterDescriptor.md +10 -0
- package/docs/api/types/FunctionTypeParametersProps.md +10 -0
- package/docs/api/types/FunctionTypeProps.md +13 -0
- package/docs/api/types/ImportRecords.md +5 -0
- package/docs/api/types/ImportedSymbol.md +8 -0
- package/docs/api/types/InterfaceExpressionProps.md +7 -0
- package/docs/api/types/InterfaceMemberProps.md +5 -0
- package/docs/api/types/InterfaceMemberPropsBase.md +11 -0
- package/docs/api/types/MemberExpressionPartProps.md +15 -0
- package/docs/api/types/ModuleExports.md +18 -0
- package/docs/api/types/ModuleSymbolsDescriptor.md +10 -0
- package/docs/api/types/NamedMap.md +18 -0
- package/docs/api/types/NamedModuleDescriptor.md +17 -0
- package/docs/api/types/PackageDescriptor.md +7 -0
- package/docs/api/types/PackageExports.md +7 -0
- package/docs/api/types/PackageRefkeys.md +10 -0
- package/docs/api/types/ParameterDescriptor.md +11 -0
- package/docs/api/types/ParameterDescriptorBase.md +16 -0
- package/docs/api/types/RefOptions.md +7 -0
- package/docs/api/types/SourceDirectoryData.md +7 -0
- package/docs/api/types/SourceFileHeaderProps.md +8 -0
- package/docs/api/types/TSLexicalScope.md +13 -0
- package/docs/api/types/TSMemberScope.md +14 -0
- package/docs/api/types/TSModuleScope.md +16 -0
- package/docs/api/types/TSOutputScope.md +5 -0
- package/docs/api/types/TSOutputSymbol.md +28 -0
- package/docs/api/types/TSPackageScope.md +21 -0
- package/docs/api/types/TSPackageScopeOptions.md +9 -0
- package/docs/api/types/TypeDeclarationProps.md +8 -0
- package/docs/api/types/TypeParameterDescriptor.md +13 -0
- package/docs/api/types/TypeScriptElements.md +5 -0
- package/docs/api/types/index.md +47 -0
- package/docs/api/variables/FunctionType.md +24 -0
- package/docs/api/variables/InterfaceExpression.md +5 -0
- package/docs/api/variables/TSSymbolFlags.md +5 -0
- package/docs/api/variables/TypeDeclaration.md +5 -0
- package/docs/api/variables/index.md +6 -0
- package/package.json +4 -4
- package/src/components/FunctionBase.tsx +1 -1
- package/src/name-conflict-resolver.ts +4 -6
- package/temp/api.json +2 -2
- package/test/function-declaration.test.tsx +36 -0
- package/test/name-conflict.test.tsx +4 -4
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# InterfaceDeclaration
|
|
2
|
+
|
|
3
|
+
Create a TypeScript interface declaration.
|
|
4
|
+
|
|
5
|
+
* jsx
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { InterfaceDeclaration } from "@alloy-js/typescript";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<InterfaceDeclaration
|
|
12
|
+
extends={Children}
|
|
13
|
+
typeParameters={TypeParameterDescriptor[] | string[]}
|
|
14
|
+
/>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
* stc
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { InterfaceDeclaration } from "@alloy-js/typescript/stc";
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
InterfaceDeclaration({
|
|
24
|
+
extends: Children,
|
|
25
|
+
typeParameters: TypeParameterDescriptor[] | string[],
|
|
26
|
+
}).children(children)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Props
|
|
30
|
+
|
|
31
|
+
| | | |
|
|
32
|
+
| -------------- | ---------------------------------------------------------------------------------------- | --------------------------------------------- |
|
|
33
|
+
| extends | optional [Children](../../../core/types/children/) | |
|
|
34
|
+
| typeParameters | optional [TypeParameterDescriptor](../../types/typeparameterdescriptor/)\[] \| string\[] | The generic type parameters of the interface. |
|
|
35
|
+
|
|
36
|
+
## Remarks
|
|
37
|
+
|
|
38
|
+
This component will declare a symbol for this interface. The `export` and `default` boolean props determine whether and how this symbol is exported from the package.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# InterfaceMember
|
|
2
|
+
|
|
3
|
+
Create a TypeScript interface member.
|
|
4
|
+
|
|
5
|
+
An interface member can either provide a `name` prop to create a named property, or an `indexer` prop to define an indexer for the interface.
|
|
6
|
+
|
|
7
|
+
The type of the member can be provided either as the `type` prop or as the children of the component.
|
|
8
|
+
|
|
9
|
+
## Overload 1
|
|
10
|
+
|
|
11
|
+
* jsx
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { InterfaceMember } from "@alloy-js/typescript";
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
<InterfaceMember
|
|
18
|
+
doc={Children}
|
|
19
|
+
name={string | Namekey}
|
|
20
|
+
nullish
|
|
21
|
+
optional
|
|
22
|
+
readonly
|
|
23
|
+
refkey={Refkey | Refkey[]}
|
|
24
|
+
type={Children}
|
|
25
|
+
/>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
* stc
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { InterfaceMember } from "@alloy-js/typescript/stc";
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
InterfaceMember({
|
|
35
|
+
doc: Children,
|
|
36
|
+
name: string | Namekey,
|
|
37
|
+
nullish: boolean,
|
|
38
|
+
optional: boolean,
|
|
39
|
+
readonly: boolean,
|
|
40
|
+
refkey: Refkey | Refkey[],
|
|
41
|
+
type: Children,
|
|
42
|
+
}).children(children)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Props
|
|
46
|
+
|
|
47
|
+
| | | |
|
|
48
|
+
| -------- | ------------------------------------------------------------------------------------------ | - |
|
|
49
|
+
| children | optional [Children](../../../core/types/children/) | |
|
|
50
|
+
| doc | optional [Children](../../../core/types/children/) | |
|
|
51
|
+
| name | string \| [Namekey](../../../core/types/namekey/) | |
|
|
52
|
+
| nullish | optional boolean | |
|
|
53
|
+
| optional | optional boolean | |
|
|
54
|
+
| readonly | optional boolean | |
|
|
55
|
+
| refkey | optional [Refkey](../../../core/types/refkey/) \| [Refkey](../../../core/types/refkey/)\[] | |
|
|
56
|
+
| type | optional [Children](../../../core/types/children/) | |
|
|
57
|
+
|
|
58
|
+
## Overload 2
|
|
59
|
+
|
|
60
|
+
* jsx
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import { InterfaceMember } from "@alloy-js/typescript";
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
<InterfaceMember
|
|
67
|
+
doc={Children}
|
|
68
|
+
indexer={Children}
|
|
69
|
+
readonly
|
|
70
|
+
refkey={Refkey | Refkey[]}
|
|
71
|
+
type={Children}
|
|
72
|
+
/>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
* stc
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
import { InterfaceMember } from "@alloy-js/typescript/stc";
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
InterfaceMember({
|
|
82
|
+
doc: Children,
|
|
83
|
+
indexer: Children,
|
|
84
|
+
readonly: boolean,
|
|
85
|
+
refkey: Refkey | Refkey[],
|
|
86
|
+
type: Children,
|
|
87
|
+
}).children(children)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Props
|
|
91
|
+
|
|
92
|
+
| | | |
|
|
93
|
+
| -------- | ------------------------------------------------------------------------------------------ | - |
|
|
94
|
+
| children | optional [Children](../../../core/types/children/) | |
|
|
95
|
+
| doc | optional [Children](../../../core/types/children/) | |
|
|
96
|
+
| indexer | [Children](../../../core/types/children/) | |
|
|
97
|
+
| readonly | optional boolean | |
|
|
98
|
+
| refkey | optional [Refkey](../../../core/types/refkey/) \| [Refkey](../../../core/types/refkey/)\[] | |
|
|
99
|
+
| type | optional [Children](../../../core/types/children/) | |
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# InterfaceMethod
|
|
2
|
+
|
|
3
|
+
An interface method declaration.
|
|
4
|
+
|
|
5
|
+
Props for \[unresolved link] component
|
|
6
|
+
|
|
7
|
+
* jsx
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { InterfaceMethod } from "@alloy-js/typescript";
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<InterfaceMethod
|
|
14
|
+
async
|
|
15
|
+
doc={Children}
|
|
16
|
+
name={string | Namekey}
|
|
17
|
+
parameters={ParameterDescriptor[] | string[]}
|
|
18
|
+
parametersChildren={Children}
|
|
19
|
+
refkey={Refkey | Refkey[]}
|
|
20
|
+
returnType={Children}
|
|
21
|
+
typeParameters={TypeParameterDescriptor[] | string[]}
|
|
22
|
+
typeParametersChildren={Children}
|
|
23
|
+
>
|
|
24
|
+
{children}
|
|
25
|
+
</InterfaceMethod>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
* stc
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { InterfaceMethod } from "@alloy-js/typescript/stc";
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
InterfaceMethod({
|
|
35
|
+
async: boolean,
|
|
36
|
+
doc: Children,
|
|
37
|
+
name: string | Namekey,
|
|
38
|
+
parameters: ParameterDescriptor[] | string[],
|
|
39
|
+
parametersChildren: Children,
|
|
40
|
+
refkey: Refkey | Refkey[],
|
|
41
|
+
returnType: Children,
|
|
42
|
+
typeParameters: TypeParameterDescriptor[] | string[],
|
|
43
|
+
typeParametersChildren: Children,
|
|
44
|
+
}).children(children)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Props
|
|
48
|
+
|
|
49
|
+
| | | |
|
|
50
|
+
| ---------------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
51
|
+
| async | optional boolean | If the method is async. It will change the returnType from `T` to `Promise<T>` |
|
|
52
|
+
| children | optional [Children](../../../core/types/children/) | Jsx content |
|
|
53
|
+
| doc | optional [Children](../../../core/types/children/) | Documentation for this method. |
|
|
54
|
+
| name | string \| [Namekey](../../../core/types/namekey/) | Interface member name |
|
|
55
|
+
| 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. |
|
|
56
|
+
| parametersChildren | optional [Children](../../../core/types/children/) | Raw content to be used as the parameter list. |
|
|
57
|
+
| refkey | optional [Refkey](../../../core/types/refkey/) \| [Refkey](../../../core/types/refkey/)\[] | Ref key for the member declaration |
|
|
58
|
+
| returnType | optional [Children](../../../core/types/children/) | The return type of the function. |
|
|
59
|
+
| 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. |
|
|
60
|
+
| typeParametersChildren | optional [Children](../../../core/types/children/) | Raw content to be used as the type parameter list. |
|
|
61
|
+
|
|
62
|
+
## Remarks
|
|
63
|
+
|
|
64
|
+
Providing parameters and type parameters can be accomplished in one of three ways:
|
|
65
|
+
|
|
66
|
+
1. As an array of [TypeParameterDescriptor](../../types/typeparameterdescriptor/)s or [TypeParameterDescriptor](../../types/typeparameterdescriptor/)s.
|
|
67
|
+
2. As raw content via the `parametersChildren` or `typeParametersChildren` props.
|
|
68
|
+
3. As a child of this component via the \[unresolved link] or \[unresolved link] components.
|
|
69
|
+
|
|
70
|
+
## Example
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
(foo: string, bar: number) => void
|
|
74
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# JSDoc
|
|
2
|
+
|
|
3
|
+
A JSDoc comment. The children of this component are joined with two hard linebreaks. This is useful for creating JSDoc comments with multiple paragraphs.
|
|
4
|
+
|
|
5
|
+
* jsx
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { JSDoc } from "@alloy-js/typescript";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<JSDoc >
|
|
12
|
+
{children}
|
|
13
|
+
</JSDoc>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
* stc
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { JSDoc } from "@alloy-js/typescript/stc";
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
JSDoc({ }).children(children)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Props
|
|
26
|
+
|
|
27
|
+
| | | |
|
|
28
|
+
| -------- | ----------------------------------------- | - |
|
|
29
|
+
| children | [Children](../../../core/types/children/) | |
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# JSDocComment
|
|
2
|
+
|
|
3
|
+
A JSDoc comment block. This is a low-level component that merely creates the block. Consider using [JSDoc](../jsdoc/) if you want to create more complex comments.
|
|
4
|
+
|
|
5
|
+
* jsx
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { JSDocComment } from "@alloy-js/typescript";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<JSDocComment >
|
|
12
|
+
{children}
|
|
13
|
+
</JSDocComment>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
* stc
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { JSDocComment } from "@alloy-js/typescript/stc";
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
JSDocComment({ }).children(children)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Props
|
|
26
|
+
|
|
27
|
+
| | | |
|
|
28
|
+
| -------- | ----------------------------------------- | - |
|
|
29
|
+
| children | [Children](../../../core/types/children/) | |
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# JSDocExample
|
|
2
|
+
|
|
3
|
+
Create a JSDoc example set off with `@example`. When the `fenced` prop is true, a `language` prop can also be set.
|
|
4
|
+
|
|
5
|
+
* jsx
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { JSDocExample } from "@alloy-js/typescript";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<JSDocExample fenced language="string">
|
|
12
|
+
{children}
|
|
13
|
+
</JSDocExample>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
* stc
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { JSDocExample } from "@alloy-js/typescript/stc";
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
JSDocExample({ fenced: boolean, language: string }).children(children)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Props
|
|
26
|
+
|
|
27
|
+
| | | |
|
|
28
|
+
| -------- | ----------------------------------------- | - |
|
|
29
|
+
| children | [Children](../../../core/types/children/) | |
|
|
30
|
+
| fenced | optional boolean | |
|
|
31
|
+
| language | optional string | |
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# MemberExpression
|
|
2
|
+
|
|
3
|
+
Create a member expression from parts. Each part can provide one of the following:
|
|
4
|
+
|
|
5
|
+
* **id**: The identifier for the member expression part
|
|
6
|
+
* **refkey**: a refkey for a symbol whose name becomes the identifier
|
|
7
|
+
* **symbol**: a symbol whose name becomes the identifier part
|
|
8
|
+
* **args**: create a method call with the given args
|
|
9
|
+
* **children**: arbitrary contents for the identifier part
|
|
10
|
+
* **await**: whether to await the value that results from this part of the member expression
|
|
11
|
+
|
|
12
|
+
Each part can have a nullish prop, which indicates that the part may be null or undefined.
|
|
13
|
+
|
|
14
|
+
Each part can also have a quoteId prop, which indicates that the identifier of the part should be quoted (i.e. `["foo"]` instead of `.foo`). This is only necessary when providing the children prop, otherwise it is determined automatically.
|
|
15
|
+
|
|
16
|
+
* jsx
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { MemberExpression } from "@alloy-js/typescript";
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
<MemberExpression >
|
|
23
|
+
{children}
|
|
24
|
+
</MemberExpression>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
* stc
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { MemberExpression } from "@alloy-js/typescript/stc";
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
MemberExpression({ }).children(children)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Props
|
|
37
|
+
|
|
38
|
+
| | | |
|
|
39
|
+
| -------- | ----------------------------------------- | - |
|
|
40
|
+
| children | [Children](../../../core/types/children/) | |
|
|
41
|
+
|
|
42
|
+
## Example
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
<MemberExpression>
|
|
46
|
+
<MemberExpression.Part id="base" />
|
|
47
|
+
<MemberExpression.Part refkey={rk} nullish />
|
|
48
|
+
<MemberExpression.Part symbol={sym} />
|
|
49
|
+
<MemberExpression.Part args={["hello", "world"]} />
|
|
50
|
+
<MemberExpression.Part>SomeValue</MemberExpression.Part>
|
|
51
|
+
</MemberExpression>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Assuming `rk` is a refkey to a symbol name “prop1”, and `sym` is a symbol with a name of “prop2”, this will render:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
base.prop1?.prop2("hello", "world").SomeValue
|
|
58
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# NewExpression
|
|
2
|
+
|
|
3
|
+
* jsx
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { NewExpression } from "@alloy-js/typescript";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<NewExpression args={Children[]} target={Children} />
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
* stc
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { NewExpression } from "@alloy-js/typescript/stc";
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
NewExpression({ args: Children[], target: Children }).children(children)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Props
|
|
22
|
+
|
|
23
|
+
| | | |
|
|
24
|
+
| ------ | ----------------------------------------------------- | - |
|
|
25
|
+
| args | optional [Children](../../../core/types/children/)\[] | |
|
|
26
|
+
| target | [Children](../../../core/types/children/) | |
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# ObjectExpression
|
|
2
|
+
|
|
3
|
+
* jsx
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { ObjectExpression } from "@alloy-js/typescript";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<ObjectExpression
|
|
10
|
+
jsValue={[string, unknown][] | Map<string, unknown> | Record<string, unknown>}
|
|
11
|
+
>
|
|
12
|
+
{children}
|
|
13
|
+
</ObjectExpression>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
* stc
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { ObjectExpression } from "@alloy-js/typescript/stc";
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
ObjectExpression({
|
|
23
|
+
jsValue: [string, unknown][] | Map<string, unknown> | Record<string, unknown>,
|
|
24
|
+
}).children(children)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Props
|
|
28
|
+
|
|
29
|
+
| | | |
|
|
30
|
+
| -------- | ----------------------------------------------------------------------------------- | - |
|
|
31
|
+
| children | optional [Children](../../../core/types/children/) | |
|
|
32
|
+
| jsValue | optional \[string, unknown]\[] \| Map\<string, unknown> \| Record\<string, unknown> | |
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# ObjectProperty
|
|
2
|
+
|
|
3
|
+
* jsx
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { ObjectProperty } from "@alloy-js/typescript";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<ObjectProperty
|
|
10
|
+
jsValue={unknown}
|
|
11
|
+
name={string | Namekey}
|
|
12
|
+
nameExpression={Children}
|
|
13
|
+
refkey={Refkey | Refkey[]}
|
|
14
|
+
value={Children}
|
|
15
|
+
>
|
|
16
|
+
{children}
|
|
17
|
+
</ObjectProperty>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
* stc
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { ObjectProperty } from "@alloy-js/typescript/stc";
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
ObjectProperty({
|
|
27
|
+
jsValue: unknown,
|
|
28
|
+
name: string | Namekey,
|
|
29
|
+
nameExpression: Children,
|
|
30
|
+
refkey: Refkey | Refkey[],
|
|
31
|
+
value: Children,
|
|
32
|
+
}).children(children)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Props
|
|
36
|
+
|
|
37
|
+
| | | |
|
|
38
|
+
| -------------- | ------------------------------------------------------------------------------------------ | - |
|
|
39
|
+
| children | optional [Children](../../../core/types/children/) | |
|
|
40
|
+
| jsValue | optional unknown | |
|
|
41
|
+
| name | optional string \| [Namekey](../../../core/types/namekey/) | |
|
|
42
|
+
| nameExpression | optional [Children](../../../core/types/children/) | |
|
|
43
|
+
| refkey | optional [Refkey](../../../core/types/refkey/) \| [Refkey](../../../core/types/refkey/)\[] | |
|
|
44
|
+
| value | optional [Children](../../../core/types/children/) | |
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# ObjectSpreadProperty
|
|
2
|
+
|
|
3
|
+
* jsx
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { ObjectSpreadProperty } from "@alloy-js/typescript";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<ObjectSpreadProperty jsValue={unknown} value={Children}>
|
|
10
|
+
{children}
|
|
11
|
+
</ObjectSpreadProperty>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
* stc
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { ObjectSpreadProperty } from "@alloy-js/typescript/stc";
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
ObjectSpreadProperty({ jsValue: unknown, value: Children }).children(children)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Props
|
|
24
|
+
|
|
25
|
+
| | | |
|
|
26
|
+
| -------- | -------------------------------------------------- | - |
|
|
27
|
+
| children | optional [Children](../../../core/types/children/) | |
|
|
28
|
+
| jsValue | optional unknown | |
|
|
29
|
+
| value | optional [Children](../../../core/types/children/) | |
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# PackageDirectory
|
|
2
|
+
|
|
3
|
+
* jsx
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { PackageDirectory } from "@alloy-js/typescript";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<PackageDirectory
|
|
10
|
+
author="string"
|
|
11
|
+
dependencies={Record<string, string>}
|
|
12
|
+
description="string"
|
|
13
|
+
devDependencies={Record<string, string>}
|
|
14
|
+
exports={PackageExports | ExportPath}
|
|
15
|
+
homepage="string"
|
|
16
|
+
keywords={string[]}
|
|
17
|
+
license="string"
|
|
18
|
+
name="string"
|
|
19
|
+
packages={[
|
|
20
|
+
ExternalPackage,
|
|
21
|
+
{
|
|
22
|
+
version?: string;
|
|
23
|
+
kind?: "dependencies" | "peerDependencies" | "devDependencies";
|
|
24
|
+
}
|
|
25
|
+
][]}
|
|
26
|
+
path="string"
|
|
27
|
+
peerDependencies={Record<string, string>}
|
|
28
|
+
repository={string | {
|
|
29
|
+
type: string;
|
|
30
|
+
url: string;
|
|
31
|
+
}}
|
|
32
|
+
scripts={Record<string, string>}
|
|
33
|
+
tsConfig={{
|
|
34
|
+
outDir?: string;
|
|
35
|
+
}}
|
|
36
|
+
type={"module" | "commonjs"}
|
|
37
|
+
version="string"
|
|
38
|
+
>
|
|
39
|
+
{children}
|
|
40
|
+
</PackageDirectory>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
* stc
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { PackageDirectory } from "@alloy-js/typescript/stc";
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
PackageDirectory({
|
|
50
|
+
author: string,
|
|
51
|
+
dependencies: Record<string, string>,
|
|
52
|
+
description: string,
|
|
53
|
+
devDependencies: Record<string, string>,
|
|
54
|
+
exports: PackageExports | ExportPath,
|
|
55
|
+
homepage: string,
|
|
56
|
+
keywords: string[],
|
|
57
|
+
license: string,
|
|
58
|
+
name: string,
|
|
59
|
+
packages: [
|
|
60
|
+
ExternalPackage,
|
|
61
|
+
{
|
|
62
|
+
version?: string;
|
|
63
|
+
kind?: "dependencies" | "peerDependencies" | "devDependencies";
|
|
64
|
+
}
|
|
65
|
+
][],
|
|
66
|
+
path: string,
|
|
67
|
+
peerDependencies: Record<string, string>,
|
|
68
|
+
repository: string | {
|
|
69
|
+
type: string;
|
|
70
|
+
url: string;
|
|
71
|
+
},
|
|
72
|
+
scripts: Record<string, string>,
|
|
73
|
+
tsConfig: {
|
|
74
|
+
outDir?: string;
|
|
75
|
+
},
|
|
76
|
+
type: "module" | "commonjs",
|
|
77
|
+
version: string,
|
|
78
|
+
}).children(children)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Props
|
|
82
|
+
|
|
83
|
+
| | | |
|
|
84
|
+
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
85
|
+
| author | optional string | The author of the package |
|
|
86
|
+
| children | optional [Children](../../../core/types/children/) | |
|
|
87
|
+
| dependencies | optional Record\<string, string> | The hard-coded dependencies of the package. References to external packages will add to the dependency list automatically. Only list dependencies here that are not referenced via refkey. |
|
|
88
|
+
| description | optional string | The description of the package |
|
|
89
|
+
| devDependencies | optional Record\<string, string> | The dev dependencies of the package. |
|
|
90
|
+
| exports | optional [PackageExports](../../types/packageexports/) \| [ExportPath](../../types/exportpath/) | The hard-coded exports of the package. |
|
|
91
|
+
| homepage | optional string | The homepage of the package |
|
|
92
|
+
| keywords | optional string\[] | The keywords of the package |
|
|
93
|
+
| license | optional string | The license of the package |
|
|
94
|
+
| name | string | The name of the package |
|
|
95
|
+
| packages | optional \[ [ExternalPackage](../../types/externalpackage/), { version?: string; kind?: “dependencies” \| “peerDependencies” \| “devDependencies”; } ]\[] | Optional configuration values for referenced external packages. By default, external packages are added as regular dependencies. However you can specify `peerDependencies` or `devDependencies` to change this behavior. Version can also be specified here to override the configured package version. |
|
|
96
|
+
| path | optional string | |
|
|
97
|
+
| peerDependencies | optional Record\<string, string> | The peer dependencies of the package. |
|
|
98
|
+
| repository | optional string \| { type: string; url: string; } | The repository of the package |
|
|
99
|
+
| scripts | optional Record\<string, string> | The scripts entries of the package. |
|
|
100
|
+
| tsConfig | optional { outDir?: string; } | |
|
|
101
|
+
| type | optional “module” \| “commonjs” | Whether this is a commonjs or module. Defaults to module. |
|
|
102
|
+
| version | string | The version of the package |
|