@typespec/tspd 0.74.0-dev.6 → 0.74.1-dev.1
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/src/gen-extern-signatures/components/dollar-functions-type.d.ts +10 -0
- package/dist/src/gen-extern-signatures/components/dollar-functions-type.d.ts.map +1 -0
- package/dist/src/gen-extern-signatures/components/dollar-functions-type.js +40 -0
- package/dist/src/gen-extern-signatures/components/dollar-functions-type.js.map +1 -0
- package/dist/src/gen-extern-signatures/components/dollar-functions-type.jsx +18 -0
- package/dist/src/gen-extern-signatures/components/dollar-functions-type.jsx.map +1 -0
- package/dist/src/gen-extern-signatures/components/entity-signature-tests.d.ts +12 -0
- package/dist/src/gen-extern-signatures/components/entity-signature-tests.d.ts.map +1 -0
- package/dist/src/gen-extern-signatures/components/entity-signature-tests.js +40 -0
- package/dist/src/gen-extern-signatures/components/entity-signature-tests.js.map +1 -0
- package/dist/src/gen-extern-signatures/components/entity-signature-tests.jsx +25 -0
- package/dist/src/gen-extern-signatures/components/entity-signature-tests.jsx.map +1 -0
- package/dist/src/gen-extern-signatures/components/entity-signatures.d.ts +13 -0
- package/dist/src/gen-extern-signatures/components/entity-signatures.d.ts.map +1 -0
- package/dist/src/gen-extern-signatures/components/entity-signatures.js +144 -0
- package/dist/src/gen-extern-signatures/components/entity-signatures.js.map +1 -0
- package/dist/src/gen-extern-signatures/components/entity-signatures.jsx +75 -0
- package/dist/src/gen-extern-signatures/components/entity-signatures.jsx.map +1 -0
- package/dist/src/gen-extern-signatures/components/function-signature-type.d.ts +15 -0
- package/dist/src/gen-extern-signatures/components/function-signature-type.d.ts.map +1 -0
- package/dist/src/gen-extern-signatures/components/function-signature-type.js +373 -0
- package/dist/src/gen-extern-signatures/components/function-signature-type.js.map +1 -0
- package/dist/src/gen-extern-signatures/components/function-signature-type.jsx +282 -0
- package/dist/src/gen-extern-signatures/components/function-signature-type.jsx.map +1 -0
- package/dist/src/gen-extern-signatures/external-packages/compiler.d.ts +2 -0
- package/dist/src/gen-extern-signatures/external-packages/compiler.d.ts.map +1 -1
- package/dist/src/gen-extern-signatures/external-packages/compiler.js +1 -1
- package/dist/src/gen-extern-signatures/external-packages/compiler.js.map +1 -1
- package/dist/src/gen-extern-signatures/gen-extern-signatures.d.ts.map +1 -1
- package/dist/src/gen-extern-signatures/gen-extern-signatures.js +32 -9
- package/dist/src/gen-extern-signatures/gen-extern-signatures.js.map +1 -1
- package/dist/src/gen-extern-signatures/types.d.ts +11 -1
- package/dist/src/gen-extern-signatures/types.d.ts.map +1 -1
- package/dist/src/ref-doc/utils/type-signature.d.ts.map +1 -1
- package/dist/src/ref-doc/utils/type-signature.js +6 -0
- package/dist/src/ref-doc/utils/type-signature.js.map +1 -1
- package/package.json +4 -5
- package/dist/src/gen-extern-signatures/components/decorator-signature-tests.d.ts +0 -8
- package/dist/src/gen-extern-signatures/components/decorator-signature-tests.d.ts.map +0 -1
- package/dist/src/gen-extern-signatures/components/decorator-signature-tests.js +0 -17
- package/dist/src/gen-extern-signatures/components/decorator-signature-tests.js.map +0 -1
- package/dist/src/gen-extern-signatures/components/decorator-signature-tests.jsx +0 -12
- package/dist/src/gen-extern-signatures/components/decorator-signature-tests.jsx.map +0 -1
- package/dist/src/gen-extern-signatures/components/decorators-signatures.d.ts +0 -12
- package/dist/src/gen-extern-signatures/components/decorators-signatures.d.ts.map +0 -1
- package/dist/src/gen-extern-signatures/components/decorators-signatures.js +0 -108
- package/dist/src/gen-extern-signatures/components/decorators-signatures.js.map +0 -1
- package/dist/src/gen-extern-signatures/components/decorators-signatures.jsx +0 -60
- package/dist/src/gen-extern-signatures/components/decorators-signatures.jsx.map +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Refkey } from "@alloy-js/core";
|
|
2
|
+
import { FunctionSignature } from "../types.js";
|
|
3
|
+
export interface DollarFunctionsTypeProps {
|
|
4
|
+
namespaceName: string;
|
|
5
|
+
functions: FunctionSignature[];
|
|
6
|
+
refkey: Refkey;
|
|
7
|
+
}
|
|
8
|
+
/** Type for the $functions variable for the given namespace */
|
|
9
|
+
export declare function DollarFunctionsType(props: Readonly<DollarFunctionsTypeProps>): import("@alloy-js/core").Children;
|
|
10
|
+
//# sourceMappingURL=dollar-functions-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dollar-functions-type.d.ts","sourceRoot":"","sources":["../../../../src/gen-extern-signatures/components/dollar-functions-type.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,+DAA+D;AAC/D,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,wBAAwB,CAAC,qCAgB5E"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { For } from "@alloy-js/core";
|
|
3
|
+
import * as ts from "@alloy-js/typescript";
|
|
4
|
+
/** Type for the $functions variable for the given namespace */
|
|
5
|
+
export function DollarFunctionsType(props) {
|
|
6
|
+
return _$createComponent(ts.TypeDeclaration, {
|
|
7
|
+
get name() {
|
|
8
|
+
return getFunctionsRecordForNamespaceName(props.namespaceName);
|
|
9
|
+
},
|
|
10
|
+
"export": true,
|
|
11
|
+
get refkey() {
|
|
12
|
+
return props.refkey;
|
|
13
|
+
},
|
|
14
|
+
get children() {
|
|
15
|
+
return _$createComponent(ts.InterfaceExpression, {
|
|
16
|
+
get children() {
|
|
17
|
+
return _$createComponent(For, {
|
|
18
|
+
get each() {
|
|
19
|
+
return props.functions;
|
|
20
|
+
},
|
|
21
|
+
children: signature => {
|
|
22
|
+
return _$createComponent(ts.InterfaceMember, {
|
|
23
|
+
get name() {
|
|
24
|
+
return signature.name;
|
|
25
|
+
},
|
|
26
|
+
get type() {
|
|
27
|
+
return signature.typeName;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function getFunctionsRecordForNamespaceName(namespaceName) {
|
|
38
|
+
return `${namespaceName.replaceAll(".", "")}Functions`;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=dollar-functions-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["For","ts","DollarFunctionsType","props","_$createComponent","TypeDeclaration","name","getFunctionsRecordForNamespaceName","namespaceName","refkey","children","InterfaceExpression","each","functions","signature","InterfaceMember","type","typeName","replaceAll"],"sources":["../../../../src/gen-extern-signatures/components/dollar-functions-type.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,GAAG,QAAgB,gBAAgB;AAC5C,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAS1C;AACA,OAAO,SAASC,mBAAmBA,CAACC,KAAyC,EAAE;EAC7E,OAAAC,iBAAA,CACGH,EAAE,CAACI,eAAe;IAAA,IACjBC,IAAIA,CAAA;MAAA,OAAEC,kCAAkC,CAACJ,KAAK,CAACK,aAAa,CAAC;IAAA;IAAA;IAAA,IAE7DC,MAAMA,CAAA;MAAA,OAAEN,KAAK,CAACM,MAAM;IAAA;IAAA,IAAAC,SAAA;MAAA,OAAAN,iBAAA,CAEnBH,EAAE,CAACU,mBAAmB;QAAA,IAAAD,SAAA;UAAA,OAAAN,iBAAA,CACpBJ,GAAG;YAAA,IAACY,IAAIA,CAAA;cAAA,OAAET,KAAK,CAACU,SAAS;YAAA;YAAAH,QAAA,EACtBI,SAAS,IAAK;cACd,OAAAV,iBAAA,CAAQH,EAAE,CAACc,eAAe;gBAAA,IAACT,IAAIA,CAAA;kBAAA,OAAEQ,SAAS,CAACR,IAAI;gBAAA;gBAAA,IAAEU,IAAIA,CAAA;kBAAA,OAAEF,SAAS,CAACG,QAAQ;gBAAA;cAAA;YAC3E;UAAC;QAAA;MAAA;IAAA;EAAA;AAKX;AAEA,SAASV,kCAAkCA,CAACC,aAAqB,EAAE;EACjE,OAAO,GAAGA,aAAa,CAACU,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,WAAW;AACxD","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { For } from "@alloy-js/core";
|
|
2
|
+
import * as ts from "@alloy-js/typescript";
|
|
3
|
+
/** Type for the $functions variable for the given namespace */
|
|
4
|
+
export function DollarFunctionsType(props) {
|
|
5
|
+
return (<ts.TypeDeclaration name={getFunctionsRecordForNamespaceName(props.namespaceName)} export refkey={props.refkey}>
|
|
6
|
+
<ts.InterfaceExpression>
|
|
7
|
+
<For each={props.functions}>
|
|
8
|
+
{(signature) => {
|
|
9
|
+
return <ts.InterfaceMember name={signature.name} type={signature.typeName}/>;
|
|
10
|
+
}}
|
|
11
|
+
</For>
|
|
12
|
+
</ts.InterfaceExpression>
|
|
13
|
+
</ts.TypeDeclaration>);
|
|
14
|
+
}
|
|
15
|
+
function getFunctionsRecordForNamespaceName(namespaceName) {
|
|
16
|
+
return `${namespaceName.replaceAll(".", "")}Functions`;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=dollar-functions-type.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dollar-functions-type.jsx","sourceRoot":"","sources":["../../../../src/gen-extern-signatures/components/dollar-functions-type.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAU,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAS3C,+DAA+D;AAC/D,MAAM,UAAU,mBAAmB,CAAC,KAAyC;IAC3E,OAAO,CACL,CAAC,EAAE,CAAC,eAAe,CACjB,IAAI,CAAC,CAAC,kCAAkC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAC9D,MAAM,CACN,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAErB;MAAA,CAAC,EAAE,CAAC,mBAAmB,CACrB;QAAA,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CACzB;UAAA,CAAC,CAAC,SAAS,EAAE,EAAE;YACb,OAAO,CAAC,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAG,CAAC;QAChF,CAAC,CACH;QAAA,EAAE,GAAG,CACP;MAAA,EAAE,EAAE,CAAC,mBAAmB,CAC1B;IAAA,EAAE,EAAE,CAAC,eAAe,CAAC,CACtB,CAAC;AACJ,CAAC;AAED,SAAS,kCAAkC,CAAC,aAAqB;IAC/D,OAAO,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,WAAW,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Refkey } from "@alloy-js/core";
|
|
2
|
+
import { EntitySignature } from "../types.js";
|
|
3
|
+
export interface EntitySignatureTests {
|
|
4
|
+
namespaceName: string;
|
|
5
|
+
entities: EntitySignature[];
|
|
6
|
+
dollarDecoratorRefKey: Refkey;
|
|
7
|
+
dollarDecoratorsTypeRefKey: Refkey;
|
|
8
|
+
dollarFunctionsRefKey: Refkey;
|
|
9
|
+
dollarFunctionsTypeRefKey: Refkey;
|
|
10
|
+
}
|
|
11
|
+
export declare function EntitySignatureTests({ namespaceName, entities, dollarDecoratorRefKey, dollarDecoratorsTypeRefKey, dollarFunctionsRefKey, dollarFunctionsTypeRefKey, }: Readonly<EntitySignatureTests>): import("@alloy-js/core").Children;
|
|
12
|
+
//# sourceMappingURL=entity-signature-tests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-signature-tests.d.ts","sourceRoot":"","sources":["../../../../src/gen-extern-signatures/components/entity-signature-tests.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAQ,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,0BAA0B,EAAE,MAAM,CAAC;IACnC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,yBAAyB,EAAE,MAAM,CAAC;CACnC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,aAAa,EACb,QAAQ,EACR,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACrB,yBAAyB,GAC1B,EAAE,QAAQ,CAAC,oBAAoB,CAAC,qCAgChC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createIntrinsic as _$createIntrinsic, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { Show } from "@alloy-js/core";
|
|
3
|
+
import * as ts from "@alloy-js/typescript";
|
|
4
|
+
export function EntitySignatureTests({
|
|
5
|
+
namespaceName,
|
|
6
|
+
entities,
|
|
7
|
+
dollarDecoratorRefKey,
|
|
8
|
+
dollarDecoratorsTypeRefKey,
|
|
9
|
+
dollarFunctionsRefKey,
|
|
10
|
+
dollarFunctionsTypeRefKey
|
|
11
|
+
}) {
|
|
12
|
+
const hasDecorators = entities.some(e => e.kind === "Decorator");
|
|
13
|
+
const hasFunctions = entities.some(e => e.kind === "Function");
|
|
14
|
+
return [_$createComponent(Show, {
|
|
15
|
+
when: hasDecorators,
|
|
16
|
+
get children() {
|
|
17
|
+
return [_$createIntrinsic("hbr", {}), _$createIntrinsic("hbr", {}), _$createComponent(ts.VarDeclaration, {
|
|
18
|
+
name: "_decs",
|
|
19
|
+
type: dollarDecoratorsTypeRefKey,
|
|
20
|
+
doc: "An error here would mean that the exported decorator is not using the same signature. Make sure to have export const $decName: DecNameDecorator = (...) => ...",
|
|
21
|
+
get children() {
|
|
22
|
+
return [dollarDecoratorRefKey, `["${namespaceName}"]`];
|
|
23
|
+
}
|
|
24
|
+
})];
|
|
25
|
+
}
|
|
26
|
+
}), _$createComponent(Show, {
|
|
27
|
+
when: hasFunctions,
|
|
28
|
+
get children() {
|
|
29
|
+
return [_$createIntrinsic("hbr", {}), _$createIntrinsic("hbr", {}), _$createComponent(ts.VarDeclaration, {
|
|
30
|
+
name: "_funcs",
|
|
31
|
+
type: dollarFunctionsTypeRefKey,
|
|
32
|
+
doc: "An error here would mean that the exported function is not using the same signature. Make sure to have export const $funcName: FuncNameFunction = (...) => ...",
|
|
33
|
+
get children() {
|
|
34
|
+
return [dollarFunctionsRefKey, `["${namespaceName}"]`];
|
|
35
|
+
}
|
|
36
|
+
})];
|
|
37
|
+
}
|
|
38
|
+
})];
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=entity-signature-tests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Show","ts","EntitySignatureTests","namespaceName","entities","dollarDecoratorRefKey","dollarDecoratorsTypeRefKey","dollarFunctionsRefKey","dollarFunctionsTypeRefKey","hasDecorators","some","e","kind","hasFunctions","_$createComponent","when","children","_$createIntrinsic","VarDeclaration","name","type","doc"],"sources":["../../../../src/gen-extern-signatures/components/entity-signature-tests.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAAiBA,IAAI,QAAQ,gBAAgB;AAC7C,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAY1C,OAAO,SAASC,oBAAoBA,CAAC;EACnCC,aAAa;EACbC,QAAQ;EACRC,qBAAqB;EACrBC,0BAA0B;EAC1BC,qBAAqB;EACrBC;AAC8B,CAAC,EAAE;EACjC,MAAMC,aAAa,GAAGL,QAAQ,CAACM,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,IAAI,KAAK,WAAW,CAAC;EAClE,MAAMC,YAAY,GAAGT,QAAQ,CAACM,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,IAAI,KAAK,UAAU,CAAC;EAEhE,QAAAE,iBAAA,CAEKd,IAAI;IAACe,IAAI,EAAEN,aAAa;IAAA,IAAAO,SAAA;MAAA,QAAAC,iBAAA,aAAAA,iBAAA,aAAAH,iBAAA,CAGtBb,EAAE,CAACiB,cAAc;QAChBC,IAAI;QACJC,IAAI,EAAEd,0BAA0B;QAChCe,GAAG;QAAA,IAAAL,SAAA;UAAA,QAEFX,qBAAqB,EACrB,KAAKF,aAAa,IAAI;QAAA;MAAA;IAAA;EAAA,IAAAW,iBAAA,CAG1Bd,IAAI;IAACe,IAAI,EAAEF,YAAY;IAAA,IAAAG,SAAA;MAAA,QAAAC,iBAAA,aAAAA,iBAAA,aAAAH,iBAAA,CAGrBb,EAAE,CAACiB,cAAc;QAChBC,IAAI;QACJC,IAAI,EAAEZ,yBAAyB;QAC/Ba,GAAG;QAAA,IAAAL,SAAA;UAAA,QAEFT,qBAAqB,EACrB,KAAKJ,aAAa,IAAI;QAAA;MAAA;IAAA;EAAA;AAKjC","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Show } from "@alloy-js/core";
|
|
2
|
+
import * as ts from "@alloy-js/typescript";
|
|
3
|
+
export function EntitySignatureTests({ namespaceName, entities, dollarDecoratorRefKey, dollarDecoratorsTypeRefKey, dollarFunctionsRefKey, dollarFunctionsTypeRefKey, }) {
|
|
4
|
+
const hasDecorators = entities.some((e) => e.kind === "Decorator");
|
|
5
|
+
const hasFunctions = entities.some((e) => e.kind === "Function");
|
|
6
|
+
return (<>
|
|
7
|
+
<Show when={hasDecorators}>
|
|
8
|
+
<hbr />
|
|
9
|
+
<hbr />
|
|
10
|
+
<ts.VarDeclaration name="_decs" type={dollarDecoratorsTypeRefKey} doc="An error here would mean that the exported decorator is not using the same signature. Make sure to have export const $decName: DecNameDecorator = (...) => ...">
|
|
11
|
+
{dollarDecoratorRefKey}
|
|
12
|
+
{`["${namespaceName}"]`}
|
|
13
|
+
</ts.VarDeclaration>
|
|
14
|
+
</Show>
|
|
15
|
+
<Show when={hasFunctions}>
|
|
16
|
+
<hbr />
|
|
17
|
+
<hbr />
|
|
18
|
+
<ts.VarDeclaration name="_funcs" type={dollarFunctionsTypeRefKey} doc="An error here would mean that the exported function is not using the same signature. Make sure to have export const $funcName: FuncNameFunction = (...) => ...">
|
|
19
|
+
{dollarFunctionsRefKey}
|
|
20
|
+
{`["${namespaceName}"]`}
|
|
21
|
+
</ts.VarDeclaration>
|
|
22
|
+
</Show>
|
|
23
|
+
</>);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=entity-signature-tests.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-signature-tests.jsx","sourceRoot":"","sources":["../../../../src/gen-extern-signatures/components/entity-signature-tests.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAY3C,MAAM,UAAU,oBAAoB,CAAC,EACnC,aAAa,EACb,QAAQ,EACR,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACrB,yBAAyB,GACM;IAC/B,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;IACnE,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;IAEjE,OAAO,CACL,EACE;MAAA,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,CACxB;QAAA,CAAC,GAAG,CAAC,AAAD,EACJ;QAAA,CAAC,GAAG,CAAC,AAAD,EACJ;QAAA,CAAC,EAAE,CAAC,cAAc,CAChB,IAAI,CAAC,OAAO,CACZ,IAAI,CAAC,CAAC,0BAA0B,CAAC,CACjC,GAAG,CAAC,gKAAgK,CAEpK;UAAA,CAAC,qBAAqB,CACtB;UAAA,CAAC,KAAK,aAAa,IAAI,CACzB;QAAA,EAAE,EAAE,CAAC,cAAc,CACrB;MAAA,EAAE,IAAI,CACN;MAAA,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CACvB;QAAA,CAAC,GAAG,CAAC,AAAD,EACJ;QAAA,CAAC,GAAG,CAAC,AAAD,EACJ;QAAA,CAAC,EAAE,CAAC,cAAc,CAChB,IAAI,CAAC,QAAQ,CACb,IAAI,CAAC,CAAC,yBAAyB,CAAC,CAChC,GAAG,CAAC,gKAAgK,CAEpK;UAAA,CAAC,qBAAqB,CACtB;UAAA,CAAC,KAAK,aAAa,IAAI,CACzB;QAAA,EAAE,EAAE,CAAC,cAAc,CACrB;MAAA,EAAE,IAAI,CACR;IAAA,GAAG,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OutputDirectory, Refkey } from "@alloy-js/core";
|
|
2
|
+
import { Program } from "@typespec/compiler";
|
|
3
|
+
import { EntitySignature } from "../types.js";
|
|
4
|
+
export interface EntitySignaturesProps {
|
|
5
|
+
entities: EntitySignature[];
|
|
6
|
+
namespaceName: string;
|
|
7
|
+
dollarDecoratorsRefKey: Refkey;
|
|
8
|
+
dollarFunctionsRefKey: Refkey;
|
|
9
|
+
}
|
|
10
|
+
export declare function EntitySignatures({ namespaceName, entities, dollarDecoratorsRefKey: dollarDecoratorsRefkey, dollarFunctionsRefKey: dollarFunctionsRefkey, }: EntitySignaturesProps): import("@alloy-js/core").Children;
|
|
11
|
+
export declare function LocalTypes(): import("@alloy-js/core").Children;
|
|
12
|
+
export declare function generateSignatures(program: Program, entities: EntitySignature[], libraryName: string, namespaceName: string): OutputDirectory;
|
|
13
|
+
//# sourceMappingURL=entity-signatures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-signatures.d.ts","sourceRoot":"","sources":["../../../../src/gen-extern-signatures/components/entity-signatures.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EACf,MAAM,EAKP,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAsB,eAAe,EAAqB,MAAM,aAAa,CAAC;AAQrF,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,aAAa,EACb,QAAQ,EACR,sBAAsB,EAAE,sBAAsB,EAC9C,qBAAqB,EAAE,qBAAqB,GAC7C,EAAE,qBAAqB,qCAsCvB;AAED,wBAAgB,UAAU,sCAezB;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EAAE,EAC3B,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,GACpB,eAAe,CA8CjB"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { createComponent as _$createComponent, createIntrinsic as _$createIntrinsic, memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { For, Output, refkey, render, Show, StatementList } from "@alloy-js/core";
|
|
3
|
+
import * as ts from "@alloy-js/typescript";
|
|
4
|
+
import { typespecCompiler } from "../external-packages/compiler.js";
|
|
5
|
+
import { DecoratorSignatureType, ValueOfModelTsInterfaceBody } from "./decorator-signature-type.js";
|
|
6
|
+
import { DollarDecoratorsType } from "./dollar-decorators-type.js";
|
|
7
|
+
import { DollarFunctionsType } from "./dollar-functions-type.js";
|
|
8
|
+
import { EntitySignatureTests } from "./entity-signature-tests.js";
|
|
9
|
+
import { FunctionSignatureType } from "./function-signature-type.js";
|
|
10
|
+
import { createTspdContext, TspdContext, useTspd } from "./tspd-context.js";
|
|
11
|
+
export function EntitySignatures({
|
|
12
|
+
namespaceName,
|
|
13
|
+
entities,
|
|
14
|
+
dollarDecoratorsRefKey: dollarDecoratorsRefkey,
|
|
15
|
+
dollarFunctionsRefKey: dollarFunctionsRefkey
|
|
16
|
+
}) {
|
|
17
|
+
const decorators = entities.filter(e => e.kind === "Decorator");
|
|
18
|
+
const functions = entities.filter(e => e.kind === "Function");
|
|
19
|
+
return _$createComponent(ts.TypeRefContext, {
|
|
20
|
+
get children() {
|
|
21
|
+
return [_$createComponent(LocalTypes, {}), _$createComponent(Show, {
|
|
22
|
+
get when() {
|
|
23
|
+
return decorators.length > 0;
|
|
24
|
+
},
|
|
25
|
+
get children() {
|
|
26
|
+
return [_$createIntrinsic("hbr", {}), _$createIntrinsic("hbr", {}), _$createComponent(For, {
|
|
27
|
+
each: decorators,
|
|
28
|
+
doubleHardline: true,
|
|
29
|
+
semicolon: true,
|
|
30
|
+
children: signature => _$createComponent(DecoratorSignatureType, {
|
|
31
|
+
signature: signature
|
|
32
|
+
})
|
|
33
|
+
}), _$createIntrinsic("hbr", {}), _$createIntrinsic("hbr", {}), _$createComponent(DollarDecoratorsType, {
|
|
34
|
+
namespaceName: namespaceName,
|
|
35
|
+
decorators: decorators,
|
|
36
|
+
refkey: dollarDecoratorsRefkey
|
|
37
|
+
})];
|
|
38
|
+
}
|
|
39
|
+
}), _$createComponent(Show, {
|
|
40
|
+
get when() {
|
|
41
|
+
return functions.length > 0;
|
|
42
|
+
},
|
|
43
|
+
get children() {
|
|
44
|
+
return [_$createIntrinsic("hbr", {}), _$createIntrinsic("hbr", {}), _$createComponent(For, {
|
|
45
|
+
each: functions,
|
|
46
|
+
doubleHardline: true,
|
|
47
|
+
semicolon: true,
|
|
48
|
+
children: signature => _$createComponent(FunctionSignatureType, {
|
|
49
|
+
signature: signature
|
|
50
|
+
})
|
|
51
|
+
}), _$createIntrinsic("hbr", {}), _$createIntrinsic("hbr", {}), _$createComponent(DollarFunctionsType, {
|
|
52
|
+
namespaceName: namespaceName,
|
|
53
|
+
functions: functions,
|
|
54
|
+
refkey: dollarFunctionsRefkey
|
|
55
|
+
})];
|
|
56
|
+
}
|
|
57
|
+
})];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export function LocalTypes() {
|
|
62
|
+
const {
|
|
63
|
+
localTypes
|
|
64
|
+
} = useTspd();
|
|
65
|
+
return _$createComponent(StatementList, {
|
|
66
|
+
get children() {
|
|
67
|
+
return _$createComponent(For, {
|
|
68
|
+
each: localTypes,
|
|
69
|
+
doubleHardline: true,
|
|
70
|
+
children: type => {
|
|
71
|
+
return _$createComponent(ts.InterfaceDeclaration, {
|
|
72
|
+
"export": true,
|
|
73
|
+
get name() {
|
|
74
|
+
return type.name;
|
|
75
|
+
},
|
|
76
|
+
get refkey() {
|
|
77
|
+
return refkey(type);
|
|
78
|
+
},
|
|
79
|
+
get children() {
|
|
80
|
+
return _$createComponent(ValueOfModelTsInterfaceBody, {
|
|
81
|
+
model: type
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
export function generateSignatures(program, entities, libraryName, namespaceName) {
|
|
91
|
+
const context = createTspdContext(program);
|
|
92
|
+
const base = namespaceName === "" ? "__global__" : namespaceName;
|
|
93
|
+
const $decoratorsRef = refkey();
|
|
94
|
+
const $functionsRef = refkey();
|
|
95
|
+
const userLib = ts.createPackage({
|
|
96
|
+
name: libraryName,
|
|
97
|
+
version: "0.0.0",
|
|
98
|
+
descriptor: {
|
|
99
|
+
".": {
|
|
100
|
+
named: ["$decorators", "$functions"]
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const jsxContent = _$createComponent(TspdContext.Provider, {
|
|
105
|
+
value: context,
|
|
106
|
+
get children() {
|
|
107
|
+
return _$createComponent(Output, {
|
|
108
|
+
externals: [typespecCompiler, userLib],
|
|
109
|
+
get children() {
|
|
110
|
+
return [_$createComponent(ts.SourceFile, {
|
|
111
|
+
path: `${base}.ts`,
|
|
112
|
+
get children() {
|
|
113
|
+
return _$createComponent(EntitySignatures, {
|
|
114
|
+
namespaceName: namespaceName,
|
|
115
|
+
entities: entities,
|
|
116
|
+
dollarDecoratorsRefKey: $decoratorsRef,
|
|
117
|
+
dollarFunctionsRefKey: $functionsRef
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}), _$memo(() => _$memo(() => !!!base.includes(".Private"))() && _$createComponent(ts.SourceFile, {
|
|
121
|
+
path: `${base}.ts-test.ts`,
|
|
122
|
+
headerComment: "An error in the imports would mean that the decorator is not exported or doesn't have the right name.",
|
|
123
|
+
get children() {
|
|
124
|
+
return _$createComponent(EntitySignatureTests, {
|
|
125
|
+
namespaceName: namespaceName,
|
|
126
|
+
entities: entities,
|
|
127
|
+
get dollarDecoratorRefKey() {
|
|
128
|
+
return userLib.$decorators;
|
|
129
|
+
},
|
|
130
|
+
dollarDecoratorsTypeRefKey: $decoratorsRef,
|
|
131
|
+
get dollarFunctionsRefKey() {
|
|
132
|
+
return userLib.$functions;
|
|
133
|
+
},
|
|
134
|
+
dollarFunctionsTypeRefKey: $functionsRef
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}))];
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
return render(jsxContent);
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=entity-signatures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["For","Output","refkey","render","Show","StatementList","ts","typespecCompiler","DecoratorSignatureType","ValueOfModelTsInterfaceBody","DollarDecoratorsType","DollarFunctionsType","EntitySignatureTests","FunctionSignatureType","createTspdContext","TspdContext","useTspd","EntitySignatures","namespaceName","entities","dollarDecoratorsRefKey","dollarDecoratorsRefkey","dollarFunctionsRefKey","dollarFunctionsRefkey","decorators","filter","e","kind","functions","_$createComponent","TypeRefContext","children","LocalTypes","when","length","_$createIntrinsic","each","doubleHardline","semicolon","signature","localTypes","type","InterfaceDeclaration","name","model","generateSignatures","program","libraryName","context","base","$decoratorsRef","$functionsRef","userLib","createPackage","version","descriptor","named","jsxContent","Provider","value","externals","SourceFile","path","_$memo","includes","headerComment","dollarDecoratorRefKey","$decorators","dollarDecoratorsTypeRefKey","$functions","dollarFunctionsTypeRefKey"],"sources":["../../../../src/gen-extern-signatures/components/entity-signatures.tsx"],"sourcesContent":[null],"mappings":";AAAA,SACEA,GAAG,EACHC,MAAM,EAGNC,MAAM,EACNC,MAAM,EACNC,IAAI,EACJC,aAAa,QACR,gBAAgB;AACvB,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAE1C,SAASC,gBAAgB,QAAQ,kCAAkC;AAEnE,SAASC,sBAAsB,EAAEC,2BAA2B,QAAQ,+BAA+B;AACnG,SAASC,oBAAoB,QAAQ,6BAA6B;AAClE,SAASC,mBAAmB;AAC5B,SAASC,oBAAoB;AAC7B,SAASC,qBAAqB;AAC9B,SAASC,iBAAiB,EAAEC,WAAW,EAAEC,OAAO,QAAQ,mBAAmB;AAS3E,OAAO,SAASC,gBAAgBA,CAAC;EAC/BC,aAAa;EACbC,QAAQ;EACRC,sBAAsB,EAAEC,sBAAsB;EAC9CC,qBAAqB,EAAEC;AACF,CAAC,EAAE;EACxB,MAAMC,UAAU,GAAGL,QAAQ,CAACM,MAAM,CAAEC,CAAC,IAA8BA,CAAC,CAACC,IAAI,KAAK,WAAW,CAAC;EAE1F,MAAMC,SAAS,GAAGT,QAAQ,CAACM,MAAM,CAAEC,CAAC,IAA6BA,CAA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SAAA;UAAA,QAAAF,iBAAA,CAC3CvB,EAAE,CAACuD,UAAU;YAACC,IAAI,EAAE,GAAGb,IAAI,KAAK;YAAA,IAAAlB,SAAA;cAAA,OAAAF,iBAAA,CAC9BZ,gBAAgB;gBACfC,aAAa,EAAEA,aAAa;gBAC5BC,QAAQ,EAAEA,QAAQ;gBAClBC,sBAAsB,EAAE8B,cAAc;gBACtC5B,qBAAqB,EAAE6B;cAAa;YAAA;UAAA,IAAAY,MAAA,OAGvCA,MAAA,UAACd,IAAI,CAACe,QAAQ,CAAC,UAAU,CAAC,OAAAnC,iBAAA,CACxBvB,EAAE,CAACuD,UAAU;YACZC,IAAI,EAAE,GAAGb,IAAI,aAAa;YAC1BgB,aAAa;YAAA,IAAAlC,SAAA;cAAA,OAAAF,iBAAA,CAEZjB,oBAAoB;gBACnBM,aAAa,EAAEA,aAAa;gBAC5BC,QAAQ,EAAEA,QAAQ;gBAAA,IAClB+C,qBAAqBA,CAAA;kBAAA,OAAEd,OAAO,CAACe,WAAW;gBAAA;gBAC1CC,0BAA0B,EAAElB,cAAc;gBAAA,IAC1C5B,qBAAqBA,CAAA;kBAAA,OAAE8B,OAAO,CAACiB,UAAU;gBAAA;gBACzCC,yBAAyB,EAAEnB;cAAa;YAAA;UAAA,EAG7C;QAAA;MAAA;IAAA;EAAA,EAGN;EAED,OAAOhD,MAAM,CAACsD,UAAU,CAAC;AAC3B","ignoreList":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { For, Output, refkey, render, Show, StatementList, } from "@alloy-js/core";
|
|
2
|
+
import * as ts from "@alloy-js/typescript";
|
|
3
|
+
import { typespecCompiler } from "../external-packages/compiler.js";
|
|
4
|
+
import { DecoratorSignatureType, ValueOfModelTsInterfaceBody } from "./decorator-signature-type.js";
|
|
5
|
+
import { DollarDecoratorsType } from "./dollar-decorators-type.js";
|
|
6
|
+
import { DollarFunctionsType } from "./dollar-functions-type.jsx";
|
|
7
|
+
import { EntitySignatureTests } from "./entity-signature-tests.jsx";
|
|
8
|
+
import { FunctionSignatureType } from "./function-signature-type.jsx";
|
|
9
|
+
import { createTspdContext, TspdContext, useTspd } from "./tspd-context.js";
|
|
10
|
+
export function EntitySignatures({ namespaceName, entities, dollarDecoratorsRefKey: dollarDecoratorsRefkey, dollarFunctionsRefKey: dollarFunctionsRefkey, }) {
|
|
11
|
+
const decorators = entities.filter((e) => e.kind === "Decorator");
|
|
12
|
+
const functions = entities.filter((e) => e.kind === "Function");
|
|
13
|
+
return (<ts.TypeRefContext>
|
|
14
|
+
<LocalTypes />
|
|
15
|
+
<Show when={decorators.length > 0}>
|
|
16
|
+
<hbr />
|
|
17
|
+
<hbr />
|
|
18
|
+
<For each={decorators} doubleHardline semicolon>
|
|
19
|
+
{(signature) => <DecoratorSignatureType signature={signature}/>}
|
|
20
|
+
</For>
|
|
21
|
+
<hbr />
|
|
22
|
+
<hbr />
|
|
23
|
+
<DollarDecoratorsType namespaceName={namespaceName} decorators={decorators} refkey={dollarDecoratorsRefkey}/>
|
|
24
|
+
</Show>
|
|
25
|
+
<Show when={functions.length > 0}>
|
|
26
|
+
<hbr />
|
|
27
|
+
<hbr />
|
|
28
|
+
<For each={functions} doubleHardline semicolon>
|
|
29
|
+
{(signature) => <FunctionSignatureType signature={signature}/>}
|
|
30
|
+
</For>
|
|
31
|
+
<hbr />
|
|
32
|
+
<hbr />
|
|
33
|
+
<DollarFunctionsType namespaceName={namespaceName} functions={functions} refkey={dollarFunctionsRefkey}/>
|
|
34
|
+
</Show>
|
|
35
|
+
</ts.TypeRefContext>);
|
|
36
|
+
}
|
|
37
|
+
export function LocalTypes() {
|
|
38
|
+
const { localTypes } = useTspd();
|
|
39
|
+
return (<StatementList>
|
|
40
|
+
<For each={localTypes} doubleHardline>
|
|
41
|
+
{(type) => {
|
|
42
|
+
return (<ts.InterfaceDeclaration export name={type.name} refkey={refkey(type)}>
|
|
43
|
+
<ValueOfModelTsInterfaceBody model={type}/>
|
|
44
|
+
</ts.InterfaceDeclaration>);
|
|
45
|
+
}}
|
|
46
|
+
</For>
|
|
47
|
+
</StatementList>);
|
|
48
|
+
}
|
|
49
|
+
export function generateSignatures(program, entities, libraryName, namespaceName) {
|
|
50
|
+
const context = createTspdContext(program);
|
|
51
|
+
const base = namespaceName === "" ? "__global__" : namespaceName;
|
|
52
|
+
const $decoratorsRef = refkey();
|
|
53
|
+
const $functionsRef = refkey();
|
|
54
|
+
const userLib = ts.createPackage({
|
|
55
|
+
name: libraryName,
|
|
56
|
+
version: "0.0.0",
|
|
57
|
+
descriptor: {
|
|
58
|
+
".": {
|
|
59
|
+
named: ["$decorators", "$functions"],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
const jsxContent = (<TspdContext.Provider value={context}>
|
|
64
|
+
<Output externals={[typespecCompiler, userLib]}>
|
|
65
|
+
<ts.SourceFile path={`${base}.ts`}>
|
|
66
|
+
<EntitySignatures namespaceName={namespaceName} entities={entities} dollarDecoratorsRefKey={$decoratorsRef} dollarFunctionsRefKey={$functionsRef}/>
|
|
67
|
+
</ts.SourceFile>
|
|
68
|
+
{!base.includes(".Private") && (<ts.SourceFile path={`${base}.ts-test.ts`} headerComment="An error in the imports would mean that the decorator is not exported or doesn't have the right name.">
|
|
69
|
+
<EntitySignatureTests namespaceName={namespaceName} entities={entities} dollarDecoratorRefKey={userLib.$decorators} dollarDecoratorsTypeRefKey={$decoratorsRef} dollarFunctionsRefKey={userLib.$functions} dollarFunctionsTypeRefKey={$functionsRef}/>
|
|
70
|
+
</ts.SourceFile>)}
|
|
71
|
+
</Output>
|
|
72
|
+
</TspdContext.Provider>);
|
|
73
|
+
return render(jsxContent);
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=entity-signatures.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-signatures.jsx","sourceRoot":"","sources":["../../../../src/gen-extern-signatures/components/entity-signatures.tsx"],"names":[],"mappings":"AAAA,OAAO,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Aa,CAAC,CAC7B,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,sBAAsB,CAAC,CAAC,cAAc,CAAC,CACvC,qBAAqB,CAAC,CAAC,aAAa,CAAC,EAEzC;QAAA,EAAE,EAAE,CAAC,UAAU,CACf;QAAA,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAC7B,CAAC,EAAE,CAAC,UAAU,CACZ,IAAI,CAAC,CAAC,GAAG,IAAI,aAAa,CAAC,CAC3B,aAAa,CAAC,uGAAuG,CAErH;YAAA,CAAC,oBAAoB,CACnB,aAAa,CAAC,CAAC,aAAa,CAAC,CAC7B,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,qBAAqB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAC3C,0BAA0B,CAAC,CAAC,cAAc,CAAC,CAC3C,qBAAqB,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAC1C,yBAAyB,CAAC,CAAC,aAAa,CAAC,EAE7C;UAAA,EAAE,EAAE,CAAC,UAAU,CAAC,CACjB,CACH;MAAA,EAAE,MAAM,CACV;IAAA,EAAE,WAAW,CAAC,QAAQ,CAAC,CACxB,CAAC;IAEF,OAAO,MAAM,CAAC,UAAU,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MixedParameterConstraint, Model } from "@typespec/compiler";
|
|
2
|
+
import { FunctionSignature } from "../types.js";
|
|
3
|
+
export interface FunctionSignatureProps {
|
|
4
|
+
signature: FunctionSignature;
|
|
5
|
+
}
|
|
6
|
+
/** Render the type of function implementation */
|
|
7
|
+
export declare function FunctionSignatureType(props: Readonly<FunctionSignatureProps>): import("@alloy-js/core").Children;
|
|
8
|
+
export interface ParameterTsTypeProps {
|
|
9
|
+
constraint: MixedParameterConstraint;
|
|
10
|
+
}
|
|
11
|
+
export declare function ParameterTsType({ constraint }: ParameterTsTypeProps): string | number | boolean | void | import("@alloy-js/core").RenderableObject | import("@alloy-js/core").RefkeyableObject | (() => import("@alloy-js/core").Children) | import("@alloy-js/core").Ref<any, any> | import("@alloy-js/core").CustomContext | import("@alloy-js/core").IndentIntrinsicElement | import("@alloy-js/core").IndentIfBreakIntrinsicElement | import("@alloy-js/core").BrIntrinsicElement | import("@alloy-js/core").LineIntrinsicElement | import("@alloy-js/core").HbrIntrinsicElement | import("@alloy-js/core").HardlineIntrinsicElement | import("@alloy-js/core").SbrIntrinsicElement | import("@alloy-js/core").SoftlineIntrinsicElement | import("@alloy-js/core").GroupIntrinsicElement | import("@alloy-js/core").AlignIntrinsicElement | import("@alloy-js/core").FillIntrinsicElement | import("@alloy-js/core").BreakParentIntrinsicElement | import("@alloy-js/core").LineSuffixIntrinsicElement | import("@alloy-js/core").LineSuffixBoundaryIntrinsicElement | import("@alloy-js/core").DedentIntrinsicElement | import("@alloy-js/core").LiterallineIntrinsicElement | import("@alloy-js/core").LbrIntrinsicElement | import("@alloy-js/core").DedentToRootIntrinsicElement | import("@alloy-js/core").MarkAsRootIntrinsicElement | import("@alloy-js/core").IfBreakIntrinsicElement | import("@alloy-js/core").Children[] | null;
|
|
12
|
+
export declare function ValueOfModelTsInterfaceBody({ model }: {
|
|
13
|
+
model: Model;
|
|
14
|
+
}): import("@alloy-js/core").Children;
|
|
15
|
+
//# sourceMappingURL=function-signature-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-signature-type.d.ts","sourceRoot":"","sources":["../../../../src/gen-extern-signatures/components/function-signature-type.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,wBAAwB,EACxB,KAAK,EAIN,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,iBAAiB,CAAC;CAC9B;AAED,kDAAkD;AAClD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,qCAmC5E;AA+BD,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,wBAAwB,CAAC;CACtC;AACD,wBAAgB,eAAe,CAAC,EAAE,UAAU,EAAE,EAAE,oBAAoB,4yCAiBnE;AAqFD,wBAAgB,2BAA2B,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,qCAsBtE"}
|