@alloy-js/typescript 0.20.0 → 0.21.0-dev.11
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/components/ClassDeclaration.d.ts +5 -5
- package/dist/src/components/ClassDeclaration.d.ts.map +1 -1
- package/dist/src/components/ClassDeclaration.js +7 -12
- package/dist/src/components/ClassDeclaration.js.map +1 -1
- package/dist/src/components/Declaration.d.ts +27 -24
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js +12 -8
- package/dist/src/components/Declaration.js.map +1 -1
- package/dist/src/components/EnumDeclaration.d.ts +2 -2
- package/dist/src/components/EnumDeclaration.d.ts.map +1 -1
- package/dist/src/components/EnumDeclaration.js +3 -3
- package/dist/src/components/EnumDeclaration.js.map +1 -1
- package/dist/src/components/EnumMember.d.ts +2 -2
- package/dist/src/components/EnumMember.d.ts.map +1 -1
- package/dist/src/components/EnumMember.js +8 -10
- package/dist/src/components/EnumMember.js.map +1 -1
- package/dist/src/components/FunctionBase.d.ts.map +1 -1
- package/dist/src/components/FunctionBase.js +3 -2
- package/dist/src/components/FunctionBase.js.map +1 -1
- package/dist/src/components/FunctionDeclaration.d.ts +2 -2
- package/dist/src/components/FunctionDeclaration.d.ts.map +1 -1
- package/dist/src/components/FunctionDeclaration.js +0 -3
- package/dist/src/components/FunctionDeclaration.js.map +1 -1
- package/dist/src/components/Interface.d.ts +13 -8
- package/dist/src/components/Interface.d.ts.map +1 -1
- package/dist/src/components/Interface.js +46 -43
- package/dist/src/components/Interface.js.map +1 -1
- package/dist/src/components/InterfaceMethod.d.ts +2 -2
- package/dist/src/components/InterfaceMethod.d.ts.map +1 -1
- package/dist/src/components/InterfaceMethod.js +3 -8
- package/dist/src/components/InterfaceMethod.js.map +1 -1
- package/dist/src/components/MemberDeclaration.d.ts +10 -13
- package/dist/src/components/MemberDeclaration.d.ts.map +1 -1
- package/dist/src/components/MemberDeclaration.js +4 -5
- package/dist/src/components/MemberDeclaration.js.map +1 -1
- package/dist/src/components/ObjectExpression.d.ts +2 -2
- package/dist/src/components/ObjectExpression.d.ts.map +1 -1
- package/dist/src/components/ObjectExpression.js +25 -18
- package/dist/src/components/ObjectExpression.js.map +1 -1
- package/dist/src/components/PropertyName.d.ts.map +1 -1
- package/dist/src/components/PropertyName.js +7 -5
- package/dist/src/components/PropertyName.js.map +1 -1
- package/dist/src/components/TypeDeclaration.d.ts +2 -2
- package/dist/src/components/TypeDeclaration.d.ts.map +1 -1
- package/dist/src/components/TypeDeclaration.js.map +1 -1
- package/dist/src/components/VarDeclaration.d.ts +2 -2
- package/dist/src/components/VarDeclaration.d.ts.map +1 -1
- package/dist/src/components/VarDeclaration.js +16 -4
- package/dist/src/components/VarDeclaration.js.map +1 -1
- package/dist/src/parameter-descriptor.d.ts +3 -3
- package/dist/src/parameter-descriptor.d.ts.map +1 -1
- package/dist/src/symbols/index.d.ts +9 -9
- package/dist/src/symbols/index.d.ts.map +1 -1
- package/dist/src/symbols/index.js.map +1 -1
- package/dist/src/symbols/reference.d.ts.map +1 -1
- package/dist/src/symbols/reference.js +2 -2
- package/dist/src/symbols/reference.js.map +1 -1
- package/dist/src/symbols/ts-output-symbol.d.ts +2 -2
- package/dist/src/symbols/ts-output-symbol.d.ts.map +1 -1
- package/dist/src/symbols/ts-output-symbol.js.map +1 -1
- package/dist/test/class.test.js +29 -1
- package/dist/test/class.test.js.map +1 -1
- package/dist/test/enum.test.js +30 -1
- package/dist/test/enum.test.js.map +1 -1
- package/dist/test/function-declaration.test.js +18 -1
- package/dist/test/function-declaration.test.js.map +1 -1
- package/dist/test/imports.test.js +3 -2
- package/dist/test/imports.test.js.map +1 -1
- package/dist/test/interface.test.d.ts.map +1 -1
- package/dist/test/interface.test.js +25 -1
- package/dist/test/interface.test.js.map +1 -1
- package/dist/test/object.test.js +55 -2
- package/dist/test/object.test.js.map +1 -1
- package/dist/test/reference.test.js +14 -0
- package/dist/test/reference.test.js.map +1 -1
- package/dist/test/var-declaration.test.d.ts.map +1 -1
- package/dist/test/var-declaration.test.js +33 -1
- package/dist/test/var-declaration.test.js.map +1 -1
- package/dist/testing/create-wrapper.d.ts +3 -0
- package/dist/testing/create-wrapper.d.ts.map +1 -0
- package/dist/testing/create-wrapper.js +12 -0
- package/dist/testing/create-wrapper.js.map +1 -0
- package/dist/testing/create-wrapper.test.d.ts +2 -0
- package/dist/testing/create-wrapper.test.d.ts.map +1 -0
- package/dist/testing/create-wrapper.test.js +159 -0
- package/dist/testing/create-wrapper.test.js.map +1 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +2 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -6
- package/src/components/ClassDeclaration.tsx +10 -13
- package/src/components/Declaration.tsx +39 -32
- package/src/components/EnumDeclaration.tsx +4 -4
- package/src/components/EnumMember.tsx +8 -13
- package/src/components/FunctionBase.tsx +7 -9
- package/src/components/FunctionDeclaration.tsx +3 -3
- package/src/components/Interface.tsx +57 -51
- package/src/components/InterfaceMethod.tsx +12 -7
- package/src/components/MemberDeclaration.tsx +20 -24
- package/src/components/ObjectExpression.tsx +20 -16
- package/src/components/PropertyName.tsx +7 -5
- package/src/components/TypeDeclaration.tsx +2 -2
- package/src/components/VarDeclaration.tsx +11 -6
- package/src/parameter-descriptor.ts +3 -3
- package/src/symbols/index.ts +12 -9
- package/src/symbols/reference.tsx +3 -1
- package/src/symbols/ts-output-symbol.ts +2 -1
- package/temp/api.json +745 -492
- package/test/class.test.tsx +19 -1
- package/test/enum.test.tsx +21 -1
- package/test/function-declaration.test.tsx +15 -0
- package/test/imports.test.tsx +2 -1
- package/test/interface.test.tsx +29 -0
- package/test/object.test.tsx +40 -1
- package/test/reference.test.tsx +12 -2
- package/test/var-declaration.test.tsx +27 -1
- package/testing/create-wrapper.test.tsx +107 -0
- package/testing/create-wrapper.tsx +12 -0
- package/testing/index.ts +1 -0
- package/tsconfig.json +8 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MemberDeclaration as CoreMemberDeclaration,
|
|
3
|
-
MemberDeclarationPropsWithInfo,
|
|
3
|
+
MemberDeclarationPropsWithInfo as CoreMemberDeclarationPropsWithInfo,
|
|
4
|
+
MemberDeclarationPropsWithSymbol as CoreMemberDeclarationPropsWithSymbol,
|
|
4
5
|
} from "@alloy-js/core";
|
|
5
6
|
import { TypeScriptElements, useTSNamePolicy } from "../name-policy.js";
|
|
6
7
|
import {
|
|
@@ -9,49 +10,44 @@ import {
|
|
|
9
10
|
TSSymbolFlags,
|
|
10
11
|
} from "../symbols/index.js";
|
|
11
12
|
|
|
12
|
-
export interface
|
|
13
|
-
extends
|
|
14
|
-
/**
|
|
15
|
-
* The name of this member declaration.
|
|
16
|
-
*/
|
|
17
|
-
name?: string;
|
|
18
|
-
|
|
19
|
-
/** Name that shouldn't go through the name policy resolver again. */
|
|
20
|
-
exactName?: string;
|
|
21
|
-
|
|
13
|
+
export interface MemberDeclarationPropsWithInfo
|
|
14
|
+
extends CoreMemberDeclarationPropsWithInfo {
|
|
22
15
|
/**
|
|
23
16
|
* The name policy kind to apply to the memberdeclaration.
|
|
24
17
|
*/
|
|
25
|
-
nameKind
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* The symbol to use for this memberdeclaration.
|
|
29
|
-
*/
|
|
30
|
-
symbol?: TSOutputSymbol;
|
|
18
|
+
nameKind: TypeScriptElements;
|
|
31
19
|
/**
|
|
32
20
|
* Whether this member can be null or undefined.
|
|
33
21
|
*/
|
|
34
22
|
nullish?: boolean;
|
|
35
23
|
}
|
|
36
24
|
|
|
25
|
+
export interface MemberDeclarationPropsWithSymbol
|
|
26
|
+
extends CoreMemberDeclarationPropsWithSymbol {
|
|
27
|
+
/**
|
|
28
|
+
* The symbol for the member declaration.
|
|
29
|
+
*/
|
|
30
|
+
symbol: TSOutputSymbol;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type MemberDeclarationProps =
|
|
34
|
+
| MemberDeclarationPropsWithInfo
|
|
35
|
+
| MemberDeclarationPropsWithSymbol;
|
|
36
|
+
|
|
37
37
|
export function MemberDeclaration(props: Readonly<MemberDeclarationProps>) {
|
|
38
38
|
let sym: TSOutputSymbol;
|
|
39
39
|
|
|
40
|
-
if (props
|
|
40
|
+
if ("symbol" in props) {
|
|
41
41
|
sym = props.symbol;
|
|
42
42
|
} else {
|
|
43
|
-
const namePolicy = useTSNamePolicy();
|
|
44
|
-
|
|
45
43
|
const tsFlags: TSSymbolFlags =
|
|
46
44
|
props.nullish ? TSSymbolFlags.Nullish : TSSymbolFlags.None;
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
props.exactName ?? namePolicy.getName(props.name!, props.nameKind!);
|
|
50
|
-
|
|
51
|
-
sym = createStaticMemberSymbol(name, {
|
|
46
|
+
sym = createStaticMemberSymbol(props.name!, {
|
|
52
47
|
refkeys: props.refkey,
|
|
53
48
|
tsFlags,
|
|
54
49
|
metadata: props.metadata,
|
|
50
|
+
namePolicy: useTSNamePolicy().for(props.nameKind!),
|
|
55
51
|
});
|
|
56
52
|
}
|
|
57
53
|
|
|
@@ -4,8 +4,10 @@ import {
|
|
|
4
4
|
computed,
|
|
5
5
|
emitSymbol,
|
|
6
6
|
For,
|
|
7
|
+
isNamekey,
|
|
7
8
|
Match,
|
|
8
9
|
moveTakenMembersTo,
|
|
10
|
+
Namekey,
|
|
9
11
|
Refkey,
|
|
10
12
|
Switch,
|
|
11
13
|
takeSymbols,
|
|
@@ -68,7 +70,7 @@ export function ObjectExpression(props: ObjectExpressionProps) {
|
|
|
68
70
|
<>
|
|
69
71
|
{jsValueProperties.value.length > 0 && (
|
|
70
72
|
<>
|
|
71
|
-
|
|
73
|
+
<sbr />
|
|
72
74
|
</>
|
|
73
75
|
)}
|
|
74
76
|
{props.children}
|
|
@@ -83,7 +85,7 @@ export function ObjectExpression(props: ObjectExpressionProps) {
|
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
export interface ObjectPropertyProps {
|
|
86
|
-
name?: string;
|
|
88
|
+
name?: string | Namekey;
|
|
87
89
|
nameExpression?: Children;
|
|
88
90
|
value?: Children;
|
|
89
91
|
jsValue?: unknown;
|
|
@@ -92,22 +94,12 @@ export interface ObjectPropertyProps {
|
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
export function ObjectProperty(props: ObjectPropertyProps) {
|
|
95
|
-
let name;
|
|
96
|
-
let symbolName = props.name;
|
|
97
|
-
if (props.name) {
|
|
98
|
-
const namer = useTSNamePolicy();
|
|
99
|
-
symbolName = namer.getName(props.name, "object-member-data");
|
|
100
|
-
name = <PropertyName name={symbolName} />;
|
|
101
|
-
} else if (props.nameExpression) {
|
|
102
|
-
name = <>[{props.nameExpression}]</>;
|
|
103
|
-
} else {
|
|
104
|
-
throw new Error("ObjectProperty either a name or a nameExpression.");
|
|
105
|
-
}
|
|
106
|
-
|
|
107
97
|
let sym = undefined;
|
|
108
|
-
|
|
109
|
-
|
|
98
|
+
|
|
99
|
+
if (isNamekey(props.name) || (props.refkey && props.name)) {
|
|
100
|
+
sym = createStaticMemberSymbol(props.name, {
|
|
110
101
|
refkeys: props.refkey,
|
|
102
|
+
namePolicy: useTSNamePolicy().for("object-member-data"),
|
|
111
103
|
});
|
|
112
104
|
|
|
113
105
|
moveTakenMembersTo(sym);
|
|
@@ -117,6 +109,18 @@ export function ObjectProperty(props: ObjectPropertyProps) {
|
|
|
117
109
|
takeSymbols();
|
|
118
110
|
}
|
|
119
111
|
|
|
112
|
+
let name: Children;
|
|
113
|
+
if (sym) {
|
|
114
|
+
name = <PropertyName name={sym.name} />;
|
|
115
|
+
} else if (props.name) {
|
|
116
|
+
// can't be a namekey if we get here
|
|
117
|
+
name = <PropertyName name={props.name as string} />;
|
|
118
|
+
} else if (props.nameExpression) {
|
|
119
|
+
name = <>[{props.nameExpression}]</>;
|
|
120
|
+
} else {
|
|
121
|
+
throw new Error("ObjectProperty either a name or a nameExpression.");
|
|
122
|
+
}
|
|
123
|
+
|
|
120
124
|
let value;
|
|
121
125
|
if (props.value) {
|
|
122
126
|
value = props.value;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MemberDeclarationContext, useContext } from "@alloy-js/core";
|
|
1
|
+
import { MemberDeclarationContext, memo, useContext } from "@alloy-js/core";
|
|
2
2
|
import { TSOutputSymbol } from "../symbols/ts-output-symbol.js";
|
|
3
3
|
import { isValidJSIdentifier } from "../utils.js";
|
|
4
4
|
|
|
@@ -23,10 +23,12 @@ export interface PropertyNameProps {
|
|
|
23
23
|
*/
|
|
24
24
|
export function PropertyName(props: PropertyNameProps) {
|
|
25
25
|
if (props.name) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
return memo(() => {
|
|
27
|
+
if (props.private) {
|
|
28
|
+
return "#" + props.name;
|
|
29
|
+
}
|
|
30
|
+
return quoteIfNeeded(props.name!);
|
|
31
|
+
});
|
|
30
32
|
} else {
|
|
31
33
|
const declSymbol = useContext(MemberDeclarationContext) as TSOutputSymbol;
|
|
32
34
|
if (!declSymbol) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Name, Show } from "@alloy-js/core";
|
|
2
|
-
import {
|
|
2
|
+
import { CommonDeclarationProps, Declaration } from "./Declaration.js";
|
|
3
3
|
import { JSDoc } from "./JSDoc.jsx";
|
|
4
4
|
import { ensureTypeRefContext } from "./TypeRefContext.jsx";
|
|
5
5
|
|
|
6
|
-
export interface TypeDeclarationProps extends
|
|
6
|
+
export interface TypeDeclarationProps extends CommonDeclarationProps {}
|
|
7
7
|
|
|
8
8
|
export const TypeDeclaration = ensureTypeRefContext(
|
|
9
9
|
(props: TypeDeclarationProps) => {
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
import { useTSNamePolicy } from "../name-policy.js";
|
|
9
9
|
import { createValueSymbol } from "../symbols/index.js";
|
|
10
10
|
import { TSSymbolFlags } from "../symbols/ts-output-symbol.js";
|
|
11
|
-
import {
|
|
11
|
+
import { CommonDeclarationProps } from "./Declaration.js";
|
|
12
12
|
import { JSDoc } from "./JSDoc.jsx";
|
|
13
13
|
import { TypeRefContext } from "./TypeRefContext.jsx";
|
|
14
14
|
|
|
15
|
-
export interface VarDeclarationProps extends
|
|
15
|
+
export interface VarDeclarationProps extends CommonDeclarationProps {
|
|
16
16
|
const?: boolean;
|
|
17
17
|
let?: boolean;
|
|
18
18
|
var?: boolean;
|
|
@@ -24,14 +24,14 @@ export interface VarDeclarationProps extends BaseDeclarationProps {
|
|
|
24
24
|
export function VarDeclaration(props: VarDeclarationProps) {
|
|
25
25
|
const TypeSymbolSlot = createSymbolSlot();
|
|
26
26
|
const ValueTypeSymbolSlot = createSymbolSlot();
|
|
27
|
-
const
|
|
28
|
-
const sym = createValueSymbol(name, {
|
|
27
|
+
const sym = createValueSymbol(props.name, {
|
|
29
28
|
refkeys: props.refkey,
|
|
30
29
|
default: props.default,
|
|
31
30
|
export: props.export,
|
|
32
31
|
metadata: props.metadata,
|
|
33
32
|
tsFlags: props.nullish ? TSSymbolFlags.Nullish : TSSymbolFlags.None,
|
|
34
33
|
type: props.type ? TypeSymbolSlot.firstSymbol : undefined,
|
|
34
|
+
namePolicy: useTSNamePolicy().for("variable"),
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
if (!props.type) {
|
|
@@ -58,8 +58,13 @@ export function VarDeclaration(props: VarDeclarationProps) {
|
|
|
58
58
|
<CoreDeclaration symbol={sym}>
|
|
59
59
|
{props.export ? "export " : ""}
|
|
60
60
|
{props.default ? "default " : ""}
|
|
61
|
-
{
|
|
62
|
-
|
|
61
|
+
<Show when={!props.default}>
|
|
62
|
+
{keyword} <Name />
|
|
63
|
+
{type}
|
|
64
|
+
<Show when={Boolean(props.initializer || props.children)}>
|
|
65
|
+
{" = "}
|
|
66
|
+
</Show>
|
|
67
|
+
</Show>
|
|
63
68
|
<ValueTypeSymbolSlot>
|
|
64
69
|
{props.initializer ?? props.children}
|
|
65
70
|
</ValueTypeSymbolSlot>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Children, Refkey } from "@alloy-js/core";
|
|
1
|
+
import type { Children, Namekey, Refkey } from "@alloy-js/core";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Common properties for ParameterDescriptor and FunctionTypeParameterDescriptor.
|
|
@@ -7,7 +7,7 @@ export interface ParameterDescriptorBase {
|
|
|
7
7
|
/**
|
|
8
8
|
* The name of the parameter.
|
|
9
9
|
*/
|
|
10
|
-
readonly name: string;
|
|
10
|
+
readonly name: string | Namekey;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* The type of the parameter.
|
|
@@ -75,7 +75,7 @@ export interface TypeParameterDescriptor {
|
|
|
75
75
|
/**
|
|
76
76
|
* The name of the type parameter.
|
|
77
77
|
*/
|
|
78
|
-
readonly name: string;
|
|
78
|
+
readonly name: string | Namekey;
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* The extends constraint for the type parameter.
|
package/src/symbols/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OutputScopeOptions } from "@alloy-js/core";
|
|
1
|
+
import { Namekey, OutputScopeOptions } from "@alloy-js/core";
|
|
2
2
|
import { useLexicalScope, useMemberOwner } from "../utils.js";
|
|
3
3
|
import { useTSScope } from "./scopes.js";
|
|
4
4
|
import { TSLexicalScope } from "./ts-lexical-scope.js";
|
|
@@ -14,7 +14,7 @@ export * from "./ts-output-symbol.js";
|
|
|
14
14
|
export * from "./ts-package-scope.js";
|
|
15
15
|
|
|
16
16
|
export function createTypeAndValueSymbol(
|
|
17
|
-
name: string,
|
|
17
|
+
name: string | Namekey,
|
|
18
18
|
options: CreateTsSymbolOptions = {},
|
|
19
19
|
) {
|
|
20
20
|
const scope = useLexicalScope();
|
|
@@ -22,7 +22,10 @@ export function createTypeAndValueSymbol(
|
|
|
22
22
|
return new TSOutputSymbol(name, spaces, options);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export function createTypeSymbol(
|
|
25
|
+
export function createTypeSymbol(
|
|
26
|
+
name: string | Namekey,
|
|
27
|
+
options: CreateTsSymbolOptions,
|
|
28
|
+
) {
|
|
26
29
|
const scope = useLexicalScope();
|
|
27
30
|
if (scope && !scope.types) {
|
|
28
31
|
throw new Error(
|
|
@@ -34,7 +37,7 @@ export function createTypeSymbol(name: string, options: CreateTsSymbolOptions) {
|
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
export function createValueSymbol(
|
|
37
|
-
name: string,
|
|
40
|
+
name: string | Namekey,
|
|
38
41
|
options: CreateTsSymbolOptions = {},
|
|
39
42
|
) {
|
|
40
43
|
const scope = useLexicalScope();
|
|
@@ -54,7 +57,7 @@ export function createTransientValueSymbol() {
|
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
export function createStaticMemberSymbol(
|
|
57
|
-
name: string,
|
|
60
|
+
name: string | Namekey,
|
|
58
61
|
options: CreateTsSymbolOptions = {},
|
|
59
62
|
) {
|
|
60
63
|
const owner = useMemberOwner();
|
|
@@ -62,7 +65,7 @@ export function createStaticMemberSymbol(
|
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
export function createInstanceMemberSymbol(
|
|
65
|
-
name: string,
|
|
68
|
+
name: string | Namekey,
|
|
66
69
|
options: CreateTsSymbolOptions = {},
|
|
67
70
|
) {
|
|
68
71
|
const owner = useMemberOwner();
|
|
@@ -70,7 +73,7 @@ export function createInstanceMemberSymbol(
|
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
export function createPrivateStaticMemberSymbol(
|
|
73
|
-
name: string,
|
|
76
|
+
name: string | Namekey,
|
|
74
77
|
options: CreateTsSymbolOptions = {},
|
|
75
78
|
) {
|
|
76
79
|
const owner = useMemberOwner();
|
|
@@ -78,7 +81,7 @@ export function createPrivateStaticMemberSymbol(
|
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
export function createPrivateInstanceMemberSymbol(
|
|
81
|
-
name: string,
|
|
84
|
+
name: string | Namekey,
|
|
82
85
|
options: CreateTsSymbolOptions = {},
|
|
83
86
|
) {
|
|
84
87
|
const owner = useMemberOwner();
|
|
@@ -86,7 +89,7 @@ export function createPrivateInstanceMemberSymbol(
|
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
export function createMemberSymbol(
|
|
89
|
-
name: string,
|
|
92
|
+
name: string | Namekey,
|
|
90
93
|
locationOptions: { jsPrivate?: boolean; static?: boolean },
|
|
91
94
|
options: CreateTsSymbolOptions = {},
|
|
92
95
|
) {
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
memo,
|
|
6
6
|
Refkey,
|
|
7
7
|
resolve,
|
|
8
|
+
unresolvedRefkey,
|
|
8
9
|
untrack,
|
|
9
10
|
useContext,
|
|
10
11
|
} from "@alloy-js/core";
|
|
@@ -20,6 +21,7 @@ import { TSPackageScope } from "./ts-package-scope.js";
|
|
|
20
21
|
export interface RefOptions {
|
|
21
22
|
type?: boolean;
|
|
22
23
|
}
|
|
24
|
+
|
|
23
25
|
export function ref(
|
|
24
26
|
refkey: Refkey,
|
|
25
27
|
options?: RefOptions,
|
|
@@ -32,7 +34,7 @@ export function ref(
|
|
|
32
34
|
|
|
33
35
|
return memo(() => {
|
|
34
36
|
if (resolveResult.value === undefined) {
|
|
35
|
-
return [
|
|
37
|
+
return [unresolvedRefkey(refkey), undefined];
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
const { symbol, pathDown, memberPath, lexicalDeclaration, commonScope } =
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Namekey,
|
|
2
3
|
OutputSpace,
|
|
3
4
|
OutputSymbol,
|
|
4
5
|
OutputSymbolOptions,
|
|
@@ -36,7 +37,7 @@ export class TSOutputSymbol extends OutputSymbol {
|
|
|
36
37
|
] as const;
|
|
37
38
|
|
|
38
39
|
constructor(
|
|
39
|
-
name: string,
|
|
40
|
+
name: string | Namekey,
|
|
40
41
|
spaces: OutputSpace[] | OutputSpace | undefined,
|
|
41
42
|
options: CreateTsSymbolOptions = {},
|
|
42
43
|
) {
|