@xlr-lib/xlr-utils 0.1.1-next.4 → 0.1.1-next.6
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/cjs/index.cjs +3 -505
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.legacy-esm.js +2 -476
- package/dist/index.mjs +2 -476
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -3
- package/src/__tests__/{ts-helpers.test.ts → xlr-helpers.test.ts} +3 -337
- package/src/index.ts +1 -3
- package/src/type-checks.ts +0 -72
- package/src/validation-helpers.ts +1 -1
- package/src/{ts-helpers.ts → xlr-helpers.ts} +0 -176
- package/types/index.d.ts +1 -3
- package/types/type-checks.d.ts +0 -27
- package/types/xlr-helpers.d.ts +13 -0
- package/src/__tests__/annotations.test.ts +0 -40
- package/src/__tests__/documentation.test.ts +0 -116
- package/src/__tests__/type-check.test.ts +0 -39
- package/src/annotations.ts +0 -237
- package/src/documentation.ts +0 -243
- package/types/annotations.d.ts +0 -7
- package/types/documentation.d.ts +0 -14
- package/types/ts-helpers.d.ts +0 -54
package/dist/index.legacy-esm.js
CHANGED
|
@@ -1,178 +1,4 @@
|
|
|
1
|
-
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/utils/src/annotations.ts
|
|
2
|
-
import ts from "typescript";
|
|
3
|
-
function extractDescription(text) {
|
|
4
|
-
if (!text) {
|
|
5
|
-
return {};
|
|
6
|
-
}
|
|
7
|
-
return { description: text };
|
|
8
|
-
}
|
|
9
|
-
function parentIsNonObjectPath(node) {
|
|
10
|
-
return node.parent && (ts.isArrayTypeNode(node.parent) || ts.isTupleTypeNode(node.parent) || ts.isOptionalTypeNode(node.parent) || ts.isRestTypeNode(node.parent) || ts.isUnionTypeNode(node.parent));
|
|
11
|
-
}
|
|
12
|
-
function recurseTypeChain(node, child) {
|
|
13
|
-
if (!node) {
|
|
14
|
-
return [];
|
|
15
|
-
}
|
|
16
|
-
if (ts.isArrayTypeNode(node) && node.parent && ts.isRestTypeNode(node.parent)) {
|
|
17
|
-
return recurseTypeChain(node.parent, node);
|
|
18
|
-
}
|
|
19
|
-
if (ts.isRestTypeNode(node)) {
|
|
20
|
-
return recurseTypeChain(node.parent, node);
|
|
21
|
-
}
|
|
22
|
-
if (ts.isOptionalTypeNode(node)) {
|
|
23
|
-
return recurseTypeChain(node.parent, node);
|
|
24
|
-
}
|
|
25
|
-
if (ts.isUnionTypeNode(node)) {
|
|
26
|
-
return recurseTypeChain(node.parent, node);
|
|
27
|
-
}
|
|
28
|
-
if (ts.isParenthesizedTypeNode(node)) {
|
|
29
|
-
return recurseTypeChain(node.parent, node);
|
|
30
|
-
}
|
|
31
|
-
if (ts.isTypeLiteralNode(node)) {
|
|
32
|
-
return recurseTypeChain(node.parent, node);
|
|
33
|
-
}
|
|
34
|
-
if (ts.isArrayTypeNode(node)) {
|
|
35
|
-
return ["[]", ...recurseTypeChain(node.parent, node)];
|
|
36
|
-
}
|
|
37
|
-
if (ts.isTupleTypeNode(node)) {
|
|
38
|
-
const pos = node.elements.indexOf(child);
|
|
39
|
-
return [
|
|
40
|
-
...pos === -1 ? [] : [`${pos}`],
|
|
41
|
-
...recurseTypeChain(node.parent, node)
|
|
42
|
-
];
|
|
43
|
-
}
|
|
44
|
-
if (ts.isTypeAliasDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isPropertySignature(node)) {
|
|
45
|
-
return [node.name.getText(), ...recurseTypeChain(node.parent, node)];
|
|
46
|
-
}
|
|
47
|
-
if (parentIsNonObjectPath(node)) {
|
|
48
|
-
return recurseTypeChain(node.parent, node);
|
|
49
|
-
}
|
|
50
|
-
return [];
|
|
51
|
-
}
|
|
52
|
-
function extractTitle(node) {
|
|
53
|
-
const typeNames = recurseTypeChain(node, void 0).reverse().join(".");
|
|
54
|
-
if (!typeNames.length) {
|
|
55
|
-
return {};
|
|
56
|
-
}
|
|
57
|
-
return { title: typeNames };
|
|
58
|
-
}
|
|
59
|
-
function stringifyDoc(docString) {
|
|
60
|
-
if (typeof docString === "undefined" || typeof docString === "string") {
|
|
61
|
-
return docString;
|
|
62
|
-
}
|
|
63
|
-
return docString.map(({ text }) => text).join(" ");
|
|
64
|
-
}
|
|
65
|
-
function extractTags(tags) {
|
|
66
|
-
const descriptions = [];
|
|
67
|
-
const examples = [];
|
|
68
|
-
const _default = [];
|
|
69
|
-
const see = [];
|
|
70
|
-
const meta = {};
|
|
71
|
-
const extractSee = (tag) => {
|
|
72
|
-
return `${tag.tagName ? `${tag.tagName?.getText()} ` : ""}${stringifyDoc(tag.comment)?.trim() ?? ""}`;
|
|
73
|
-
};
|
|
74
|
-
tags.forEach((tag) => {
|
|
75
|
-
if (!tag.comment) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
if (tag.tagName.text === "example") {
|
|
79
|
-
examples.push(stringifyDoc(tag.comment)?.trim() ?? "");
|
|
80
|
-
} else if (tag.tagName.text === "default") {
|
|
81
|
-
_default.push(stringifyDoc(tag.comment)?.trim() ?? "");
|
|
82
|
-
} else if (tag.tagName.text === "see") {
|
|
83
|
-
see.push(extractSee(tag));
|
|
84
|
-
} else if (tag.tagName.text === "meta") {
|
|
85
|
-
const [key, value] = tag.comment.toString().split(/:(.*)/);
|
|
86
|
-
meta[key] = value?.trim() ?? "";
|
|
87
|
-
} else {
|
|
88
|
-
const text = stringifyDoc(tag.comment)?.trim() ?? "";
|
|
89
|
-
descriptions.push(`@${tag.tagName.text} ${text}`);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
return {
|
|
93
|
-
...descriptions.length === 0 ? {} : { description: descriptions.join("\n") },
|
|
94
|
-
...examples.length === 0 ? {} : { examples },
|
|
95
|
-
..._default.length === 0 ? {} : { default: _default.join("\n") },
|
|
96
|
-
...see.length === 0 ? {} : { see },
|
|
97
|
-
...meta && Object.keys(meta).length === 0 ? {} : { meta }
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
function join(t, separator = "\n") {
|
|
101
|
-
const unique = new Set(t).values();
|
|
102
|
-
return Array.from(unique).filter((s) => s !== void 0).join(separator).trim();
|
|
103
|
-
}
|
|
104
|
-
function mergeAnnotations(nodes) {
|
|
105
|
-
const name = nodes.find((n) => n.name)?.name;
|
|
106
|
-
const title = join(
|
|
107
|
-
nodes.map((n) => n.title),
|
|
108
|
-
", "
|
|
109
|
-
);
|
|
110
|
-
const description = join(nodes.map((n) => n.description));
|
|
111
|
-
const _default = join(nodes.map((n) => n.default));
|
|
112
|
-
const comment = join(nodes.map((n) => n.comment));
|
|
113
|
-
const examples = join(
|
|
114
|
-
nodes.map(
|
|
115
|
-
(n) => Array.isArray(n.examples) ? join(n.examples) : n.examples
|
|
116
|
-
)
|
|
117
|
-
);
|
|
118
|
-
const see = join(
|
|
119
|
-
nodes.map((n) => Array.isArray(n.see) ? join(n.see) : n.see)
|
|
120
|
-
);
|
|
121
|
-
const meta = nodes.find((n) => n.meta)?.meta;
|
|
122
|
-
return {
|
|
123
|
-
...name ? { name } : {},
|
|
124
|
-
...title ? { title } : {},
|
|
125
|
-
...description ? { description } : {},
|
|
126
|
-
...examples ? { examples } : {},
|
|
127
|
-
..._default ? { default: _default } : {},
|
|
128
|
-
...see ? { see } : {},
|
|
129
|
-
...comment ? { comment } : {},
|
|
130
|
-
...meta ? { meta } : {}
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
function decorateNode(node) {
|
|
134
|
-
const { jsDoc } = node;
|
|
135
|
-
const titleAnnotation = extractTitle(node);
|
|
136
|
-
if (jsDoc && jsDoc.length) {
|
|
137
|
-
const first = jsDoc[0];
|
|
138
|
-
return mergeAnnotations([
|
|
139
|
-
extractDescription(stringifyDoc(first.comment)),
|
|
140
|
-
titleAnnotation,
|
|
141
|
-
extractTags(first.tags ?? [])
|
|
142
|
-
]);
|
|
143
|
-
}
|
|
144
|
-
return titleAnnotation;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/utils/src/ts-helpers.ts
|
|
148
|
-
import ts3 from "typescript";
|
|
149
|
-
|
|
150
1
|
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/utils/src/type-checks.ts
|
|
151
|
-
import ts2 from "typescript";
|
|
152
|
-
function isOptionalProperty(node) {
|
|
153
|
-
return node.questionToken?.kind === ts2.SyntaxKind.QuestionToken;
|
|
154
|
-
}
|
|
155
|
-
function isGenericInterfaceDeclaration(node) {
|
|
156
|
-
const length = node.typeParameters?.length;
|
|
157
|
-
return length ? length > 0 : false;
|
|
158
|
-
}
|
|
159
|
-
function isGenericTypeDeclaration(node) {
|
|
160
|
-
const length = node.typeParameters?.length;
|
|
161
|
-
return length ? length > 0 : false;
|
|
162
|
-
}
|
|
163
|
-
function isTypeReferenceGeneric(node, typeChecker) {
|
|
164
|
-
const symbol = typeChecker.getSymbolAtLocation(node.typeName);
|
|
165
|
-
if (symbol && symbol.declarations) {
|
|
166
|
-
return symbol.declarations[0].kind === ts2.SyntaxKind.TypeParameter;
|
|
167
|
-
}
|
|
168
|
-
return false;
|
|
169
|
-
}
|
|
170
|
-
function isTopLevelDeclaration(node) {
|
|
171
|
-
return node.kind === ts2.SyntaxKind.InterfaceDeclaration || node.kind === ts2.SyntaxKind.TypeAliasDeclaration;
|
|
172
|
-
}
|
|
173
|
-
function isTopLevelNode(node) {
|
|
174
|
-
return node.kind === ts2.SyntaxKind.InterfaceDeclaration || node.kind === ts2.SyntaxKind.TypeAliasDeclaration || node.kind === ts2.SyntaxKind.VariableStatement;
|
|
175
|
-
}
|
|
176
2
|
function isGenericNodeType(nt) {
|
|
177
3
|
return nt.genericTokens?.length > 0;
|
|
178
4
|
}
|
|
@@ -354,88 +180,7 @@ function computeEffectiveObject(base, operand, errorOnOverlap = true) {
|
|
|
354
180
|
return newObject;
|
|
355
181
|
}
|
|
356
182
|
|
|
357
|
-
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/utils/src/
|
|
358
|
-
function tsStripOptionalType(node) {
|
|
359
|
-
return ts3.isOptionalTypeNode(node) ? node.type : node;
|
|
360
|
-
}
|
|
361
|
-
function isExportedDeclaration(node) {
|
|
362
|
-
const modifiers = ts3.canHaveModifiers(node) ? ts3.getModifiers(node) : void 0;
|
|
363
|
-
if (modifiers) {
|
|
364
|
-
return modifiers.some((m) => m.kind === ts3.SyntaxKind.ExportKeyword);
|
|
365
|
-
}
|
|
366
|
-
return false;
|
|
367
|
-
}
|
|
368
|
-
function isExportedModuleDeclaration(node) {
|
|
369
|
-
return isExportedDeclaration(node) && ts3.isModuleDeclaration(node);
|
|
370
|
-
}
|
|
371
|
-
function isNodeExported(node) {
|
|
372
|
-
return (ts3.getCombinedModifierFlags(node) & ts3.ModifierFlags.Export) !== 0 || !!node.parent && node.parent.kind === ts3.SyntaxKind.SourceFile;
|
|
373
|
-
}
|
|
374
|
-
function getReferencedType(node, typeChecker) {
|
|
375
|
-
let symbol = typeChecker.getSymbolAtLocation(node.typeName);
|
|
376
|
-
if (symbol && (symbol.flags & ts3.SymbolFlags.Alias) === ts3.SymbolFlags.Alias) {
|
|
377
|
-
symbol = typeChecker.getAliasedSymbol(symbol);
|
|
378
|
-
}
|
|
379
|
-
const varDecl = symbol?.declarations?.[0];
|
|
380
|
-
if (varDecl && (ts3.isInterfaceDeclaration(varDecl) || ts3.isTypeAliasDeclaration(varDecl))) {
|
|
381
|
-
return { declaration: varDecl, exported: isNodeExported(varDecl) };
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
function isTypeScriptLibType(node, typeChecker) {
|
|
385
|
-
let symbol = typeChecker.getSymbolAtLocation(node.typeName);
|
|
386
|
-
if (!symbol) return false;
|
|
387
|
-
if ((symbol.flags & ts3.SymbolFlags.Alias) === ts3.SymbolFlags.Alias) {
|
|
388
|
-
symbol = typeChecker.getAliasedSymbol(symbol);
|
|
389
|
-
}
|
|
390
|
-
const declarations = symbol.getDeclarations();
|
|
391
|
-
if (!declarations || declarations.length === 0) return false;
|
|
392
|
-
return declarations.some((decl) => {
|
|
393
|
-
const sourceFile = decl.getSourceFile();
|
|
394
|
-
if (!sourceFile) return false;
|
|
395
|
-
const filePath = sourceFile.fileName;
|
|
396
|
-
return filePath.includes("/typescript/lib/") || filePath.includes("\\typescript\\lib\\") || filePath.endsWith(".d.ts") && filePath.includes("lib.");
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
function getStringLiteralsFromUnion(node) {
|
|
400
|
-
if (ts3.isUnionTypeNode(node)) {
|
|
401
|
-
return new Set(
|
|
402
|
-
node.types.map((type) => {
|
|
403
|
-
if (ts3.isLiteralTypeNode(type) && ts3.isStringLiteral(type.literal)) {
|
|
404
|
-
return type.literal.text;
|
|
405
|
-
}
|
|
406
|
-
return "";
|
|
407
|
-
})
|
|
408
|
-
);
|
|
409
|
-
}
|
|
410
|
-
if (ts3.isLiteralTypeNode(node) && ts3.isStringLiteral(node.literal)) {
|
|
411
|
-
return /* @__PURE__ */ new Set([node.literal.text]);
|
|
412
|
-
}
|
|
413
|
-
return /* @__PURE__ */ new Set();
|
|
414
|
-
}
|
|
415
|
-
function buildTemplateRegex(node, typeChecker) {
|
|
416
|
-
let regex = node.head.text;
|
|
417
|
-
node.templateSpans.forEach((span) => {
|
|
418
|
-
let type = span.type.kind;
|
|
419
|
-
if (ts3.isTypeReferenceNode(span.type)) {
|
|
420
|
-
let symbol = typeChecker.getSymbolAtLocation(
|
|
421
|
-
span.type.typeName
|
|
422
|
-
);
|
|
423
|
-
if (symbol && (symbol.flags & ts3.SymbolFlags.Alias) === ts3.SymbolFlags.Alias) {
|
|
424
|
-
symbol = typeChecker.getAliasedSymbol(symbol);
|
|
425
|
-
}
|
|
426
|
-
type = (symbol?.declarations?.[0]).type.kind;
|
|
427
|
-
}
|
|
428
|
-
if (type === ts3.SyntaxKind.StringKeyword) {
|
|
429
|
-
regex += ".*";
|
|
430
|
-
} else if (type === ts3.SyntaxKind.NumberKeyword) {
|
|
431
|
-
regex += "[0-9]*";
|
|
432
|
-
} else if (type === ts3.SyntaxKind.BooleanKeyword) {
|
|
433
|
-
regex += "true|false";
|
|
434
|
-
}
|
|
435
|
-
regex += span.literal.text;
|
|
436
|
-
});
|
|
437
|
-
return regex;
|
|
438
|
-
}
|
|
183
|
+
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/utils/src/xlr-helpers.ts
|
|
439
184
|
function fillInGenerics(xlrNode, generics, preferLocalGenerics = false) {
|
|
440
185
|
let localGenerics;
|
|
441
186
|
if (generics) {
|
|
@@ -681,250 +426,31 @@ function applyExcludeToNodeType(baseObject, filters) {
|
|
|
681
426
|
or: remainingMembers
|
|
682
427
|
};
|
|
683
428
|
}
|
|
684
|
-
|
|
685
|
-
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/utils/src/documentation.ts
|
|
686
|
-
import ts4 from "typescript";
|
|
687
|
-
var { SymbolDisplayPartKind, displayPartsToString } = ts4;
|
|
688
|
-
function insertBetweenElements(array, separator) {
|
|
689
|
-
return array.reduce((acc, item, index) => {
|
|
690
|
-
if (index === 0) {
|
|
691
|
-
return [item];
|
|
692
|
-
}
|
|
693
|
-
return [...acc, separator, item];
|
|
694
|
-
}, []);
|
|
695
|
-
}
|
|
696
|
-
function createTSDocString(node) {
|
|
697
|
-
if (node.type === "ref") {
|
|
698
|
-
return [
|
|
699
|
-
{
|
|
700
|
-
text: node.ref,
|
|
701
|
-
kind: SymbolDisplayPartKind.keyword
|
|
702
|
-
}
|
|
703
|
-
];
|
|
704
|
-
}
|
|
705
|
-
if (node.type === "or" || node.type === "and") {
|
|
706
|
-
const items = node.type === "and" ? node.and : node.or;
|
|
707
|
-
return insertBetweenElements(
|
|
708
|
-
items.map((subnode) => createTSDocString(subnode)),
|
|
709
|
-
[
|
|
710
|
-
{
|
|
711
|
-
kind: SymbolDisplayPartKind.punctuation,
|
|
712
|
-
text: node.type === "and" ? " & " : " | "
|
|
713
|
-
}
|
|
714
|
-
]
|
|
715
|
-
).flat();
|
|
716
|
-
}
|
|
717
|
-
if (node.type === "function") {
|
|
718
|
-
return [
|
|
719
|
-
{
|
|
720
|
-
kind: SymbolDisplayPartKind.keyword,
|
|
721
|
-
text: "function"
|
|
722
|
-
},
|
|
723
|
-
{
|
|
724
|
-
kind: SymbolDisplayPartKind.space,
|
|
725
|
-
text: " "
|
|
726
|
-
},
|
|
727
|
-
...node.name ? [{ text: node.name, kind: SymbolDisplayPartKind.methodName }] : [],
|
|
728
|
-
{
|
|
729
|
-
kind: SymbolDisplayPartKind.punctuation,
|
|
730
|
-
text: "("
|
|
731
|
-
},
|
|
732
|
-
...insertBetweenElements(
|
|
733
|
-
node.parameters.map((p) => {
|
|
734
|
-
if (p.name) {
|
|
735
|
-
return [
|
|
736
|
-
{
|
|
737
|
-
kind: SymbolDisplayPartKind.parameterName,
|
|
738
|
-
text: p.name
|
|
739
|
-
},
|
|
740
|
-
{
|
|
741
|
-
kind: SymbolDisplayPartKind.punctuation,
|
|
742
|
-
text: p.optional ? "?" : ""
|
|
743
|
-
},
|
|
744
|
-
{
|
|
745
|
-
kind: SymbolDisplayPartKind.punctuation,
|
|
746
|
-
text: ": "
|
|
747
|
-
},
|
|
748
|
-
...createTSDocString(p.type)
|
|
749
|
-
];
|
|
750
|
-
}
|
|
751
|
-
return createTSDocString(p.type);
|
|
752
|
-
}),
|
|
753
|
-
[
|
|
754
|
-
{
|
|
755
|
-
kind: SymbolDisplayPartKind.punctuation,
|
|
756
|
-
text: ", "
|
|
757
|
-
}
|
|
758
|
-
]
|
|
759
|
-
).flat(),
|
|
760
|
-
{
|
|
761
|
-
kind: SymbolDisplayPartKind.punctuation,
|
|
762
|
-
text: ")"
|
|
763
|
-
},
|
|
764
|
-
...node.returnType ? [
|
|
765
|
-
{
|
|
766
|
-
kind: SymbolDisplayPartKind.punctuation,
|
|
767
|
-
text: ": "
|
|
768
|
-
},
|
|
769
|
-
...createTSDocString(node.returnType)
|
|
770
|
-
] : []
|
|
771
|
-
];
|
|
772
|
-
}
|
|
773
|
-
if (node.type === "tuple") {
|
|
774
|
-
return [
|
|
775
|
-
{
|
|
776
|
-
kind: SymbolDisplayPartKind.punctuation,
|
|
777
|
-
text: "["
|
|
778
|
-
},
|
|
779
|
-
...insertBetweenElements(
|
|
780
|
-
node.elementTypes.map((t) => {
|
|
781
|
-
if (t.name) {
|
|
782
|
-
return [
|
|
783
|
-
{
|
|
784
|
-
kind: SymbolDisplayPartKind.propertyName,
|
|
785
|
-
text: t.name
|
|
786
|
-
},
|
|
787
|
-
{
|
|
788
|
-
kind: SymbolDisplayPartKind.punctuation,
|
|
789
|
-
text: ": "
|
|
790
|
-
},
|
|
791
|
-
...createTSDocString(t.type)
|
|
792
|
-
];
|
|
793
|
-
}
|
|
794
|
-
return createTSDocString(t.type);
|
|
795
|
-
}),
|
|
796
|
-
[
|
|
797
|
-
{
|
|
798
|
-
kind: SymbolDisplayPartKind.punctuation,
|
|
799
|
-
text: ", "
|
|
800
|
-
}
|
|
801
|
-
]
|
|
802
|
-
).flat(),
|
|
803
|
-
{
|
|
804
|
-
kind: SymbolDisplayPartKind.punctuation,
|
|
805
|
-
text: "]"
|
|
806
|
-
}
|
|
807
|
-
];
|
|
808
|
-
}
|
|
809
|
-
if (node.type === "array") {
|
|
810
|
-
return [
|
|
811
|
-
{
|
|
812
|
-
kind: SymbolDisplayPartKind.interfaceName,
|
|
813
|
-
text: "Array"
|
|
814
|
-
},
|
|
815
|
-
{
|
|
816
|
-
kind: SymbolDisplayPartKind.punctuation,
|
|
817
|
-
text: "<"
|
|
818
|
-
},
|
|
819
|
-
...createTSDocString(node.elementType),
|
|
820
|
-
{
|
|
821
|
-
kind: SymbolDisplayPartKind.punctuation,
|
|
822
|
-
text: ">"
|
|
823
|
-
}
|
|
824
|
-
];
|
|
825
|
-
}
|
|
826
|
-
if (node.type === "record") {
|
|
827
|
-
return [
|
|
828
|
-
{
|
|
829
|
-
kind: SymbolDisplayPartKind.interfaceName,
|
|
830
|
-
text: "Record"
|
|
831
|
-
},
|
|
832
|
-
{
|
|
833
|
-
kind: SymbolDisplayPartKind.punctuation,
|
|
834
|
-
text: "<"
|
|
835
|
-
},
|
|
836
|
-
...createTSDocString(node.keyType),
|
|
837
|
-
{
|
|
838
|
-
kind: SymbolDisplayPartKind.punctuation,
|
|
839
|
-
text: ", "
|
|
840
|
-
},
|
|
841
|
-
...createTSDocString(node.valueType),
|
|
842
|
-
{
|
|
843
|
-
kind: SymbolDisplayPartKind.punctuation,
|
|
844
|
-
text: ">"
|
|
845
|
-
}
|
|
846
|
-
];
|
|
847
|
-
}
|
|
848
|
-
if ((node.type === "string" || node.type === "boolean" || node.type === "number") && node.const !== void 0) {
|
|
849
|
-
return [
|
|
850
|
-
{
|
|
851
|
-
kind: SymbolDisplayPartKind.keyword,
|
|
852
|
-
text: typeof node.const === "string" ? `"${node.const}"` : String(node.const)
|
|
853
|
-
}
|
|
854
|
-
];
|
|
855
|
-
}
|
|
856
|
-
if (isPrimitiveTypeNode(node) && node.type !== "null") {
|
|
857
|
-
return [
|
|
858
|
-
{
|
|
859
|
-
kind: SymbolDisplayPartKind.keyword,
|
|
860
|
-
text: node.type
|
|
861
|
-
}
|
|
862
|
-
];
|
|
863
|
-
}
|
|
864
|
-
if (node.type === "object" && node.name) {
|
|
865
|
-
return [
|
|
866
|
-
{
|
|
867
|
-
kind: SymbolDisplayPartKind.interfaceName,
|
|
868
|
-
text: node.name
|
|
869
|
-
}
|
|
870
|
-
];
|
|
871
|
-
}
|
|
872
|
-
return [
|
|
873
|
-
{
|
|
874
|
-
kind: SymbolDisplayPartKind.localName,
|
|
875
|
-
text: node.type
|
|
876
|
-
}
|
|
877
|
-
];
|
|
878
|
-
}
|
|
879
|
-
function symbolDisplayToString(displayParts) {
|
|
880
|
-
return displayPartsToString(displayParts);
|
|
881
|
-
}
|
|
882
|
-
function createDocString(node) {
|
|
883
|
-
return symbolDisplayToString(createTSDocString(node));
|
|
884
|
-
}
|
|
885
429
|
export {
|
|
886
430
|
applyExcludeToNodeType,
|
|
887
431
|
applyPartialOrRequiredToNodeType,
|
|
888
432
|
applyPickOrOmitToNodeType,
|
|
889
|
-
buildTemplateRegex,
|
|
890
433
|
computeEffectiveObject,
|
|
891
434
|
computeExtends,
|
|
892
|
-
createDocString,
|
|
893
|
-
createTSDocString,
|
|
894
|
-
decorateNode,
|
|
895
435
|
fillInGenerics,
|
|
896
|
-
getReferencedType,
|
|
897
|
-
getStringLiteralsFromUnion,
|
|
898
436
|
isAndType,
|
|
899
437
|
isArrayType,
|
|
900
438
|
isBooleanType,
|
|
901
|
-
isExportedDeclaration,
|
|
902
|
-
isExportedModuleDeclaration,
|
|
903
|
-
isGenericInterfaceDeclaration,
|
|
904
439
|
isGenericNamedType,
|
|
905
440
|
isGenericNodeType,
|
|
906
|
-
isGenericTypeDeclaration,
|
|
907
441
|
isNamedType,
|
|
908
442
|
isNode,
|
|
909
|
-
isNodeExported,
|
|
910
443
|
isNonNullable,
|
|
911
444
|
isNumberType,
|
|
912
445
|
isObjectType,
|
|
913
|
-
isOptionalProperty,
|
|
914
446
|
isOrType,
|
|
915
447
|
isPrimitiveTypeNode,
|
|
916
448
|
isRecordType,
|
|
917
449
|
isRefType,
|
|
918
450
|
isStringType,
|
|
919
|
-
isTopLevelDeclaration,
|
|
920
|
-
isTopLevelNode,
|
|
921
|
-
isTypeReferenceGeneric,
|
|
922
|
-
isTypeScriptLibType,
|
|
923
451
|
makePropertyMap,
|
|
924
452
|
propertyToTuple,
|
|
925
453
|
resolveConditional,
|
|
926
|
-
resolveReferenceNode
|
|
927
|
-
symbolDisplayToString,
|
|
928
|
-
tsStripOptionalType
|
|
454
|
+
resolveReferenceNode
|
|
929
455
|
};
|
|
930
456
|
//# sourceMappingURL=index.mjs.map
|