typedoc 0.23.26 → 0.24.0-beta.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/bin/typedoc +1 -130
- package/dist/index.d.ts +4 -5
- package/dist/index.js +15 -5
- package/dist/lib/application-events.d.ts +1 -1
- package/dist/lib/application-events.js +1 -1
- package/dist/lib/application.d.ts +24 -13
- package/dist/lib/application.js +136 -69
- package/dist/lib/cli.d.ts +1 -0
- package/dist/lib/cli.js +129 -0
- package/dist/lib/converter/comments/declarationReference.d.ts +1 -1
- package/dist/lib/converter/comments/declarationReferenceResolver.js +11 -5
- package/dist/lib/converter/comments/discovery.d.ts +1 -1
- package/dist/lib/converter/comments/discovery.js +96 -76
- package/dist/lib/converter/comments/index.d.ts +1 -1
- package/dist/lib/converter/comments/index.js +41 -21
- package/dist/lib/converter/comments/linkResolver.d.ts +2 -8
- package/dist/lib/converter/comments/linkResolver.js +42 -145
- package/dist/lib/converter/context.d.ts +1 -1
- package/dist/lib/converter/context.js +27 -14
- package/dist/lib/converter/convert-expression.d.ts +1 -1
- package/dist/lib/converter/convert-expression.js +35 -15
- package/dist/lib/converter/converter.d.ts +4 -6
- package/dist/lib/converter/converter.js +38 -27
- package/dist/lib/converter/factories/index-signature.d.ts +1 -1
- package/dist/lib/converter/factories/index-signature.js +26 -3
- package/dist/lib/converter/factories/signature.d.ts +2 -2
- package/dist/lib/converter/factories/signature.js +76 -52
- package/dist/lib/converter/index.d.ts +0 -1
- package/dist/lib/converter/jsdoc.d.ts +1 -1
- package/dist/lib/converter/jsdoc.js +39 -17
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +0 -2
- package/dist/lib/converter/plugins/CommentPlugin.js +7 -28
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +1 -39
- package/dist/lib/converter/plugins/GroupPlugin.js +3 -61
- package/dist/lib/converter/plugins/ImplementsPlugin.d.ts +1 -4
- package/dist/lib/converter/plugins/ImplementsPlugin.js +49 -28
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +0 -3
- package/dist/lib/converter/plugins/InheritDocPlugin.js +6 -7
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +2 -3
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +12 -18
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +5 -14
- package/dist/lib/converter/plugins/PackagePlugin.js +44 -56
- package/dist/lib/converter/plugins/SourcePlugin.js +31 -6
- package/dist/lib/converter/plugins/TypePlugin.d.ts +4 -10
- package/dist/lib/converter/plugins/TypePlugin.js +23 -13
- package/dist/lib/converter/symbols.d.ts +1 -1
- package/dist/lib/converter/symbols.js +153 -132
- package/dist/lib/converter/types.d.ts +1 -1
- package/dist/lib/converter/types.js +121 -95
- package/dist/lib/converter/utils/nodes.d.ts +1 -1
- package/dist/lib/converter/utils/nodes.js +24 -4
- package/dist/lib/converter/utils/symbols.d.ts +1 -1
- package/dist/lib/converter/utils/symbols.js +24 -4
- package/dist/lib/models/ReflectionCategory.d.ts +2 -1
- package/dist/lib/models/ReflectionCategory.js +12 -0
- package/dist/lib/models/ReflectionGroup.d.ts +3 -2
- package/dist/lib/models/ReflectionGroup.js +20 -0
- package/dist/lib/models/comments/comment.d.ts +12 -7
- package/dist/lib/models/comments/comment.js +77 -64
- package/dist/lib/models/reflections/ReflectionSymbolId.d.ts +29 -0
- package/dist/lib/models/reflections/ReflectionSymbolId.js +94 -0
- package/dist/lib/models/reflections/abstract.d.ts +12 -37
- package/dist/lib/models/reflections/abstract.js +27 -35
- package/dist/lib/models/reflections/container.d.ts +6 -10
- package/dist/lib/models/reflections/container.js +8 -1
- package/dist/lib/models/reflections/declaration.d.ts +19 -4
- package/dist/lib/models/reflections/declaration.js +54 -1
- package/dist/lib/models/reflections/index.d.ts +2 -0
- package/dist/lib/models/reflections/index.js +3 -1
- package/dist/lib/models/reflections/kind.d.ts +15 -1
- package/dist/lib/models/reflections/kind.js +43 -1
- package/dist/lib/models/reflections/parameter.d.ts +3 -1
- package/dist/lib/models/reflections/parameter.js +10 -0
- package/dist/lib/models/reflections/project.d.ts +32 -5
- package/dist/lib/models/reflections/project.js +84 -20
- package/dist/lib/models/reflections/reference.d.ts +5 -9
- package/dist/lib/models/reflections/reference.js +13 -29
- package/dist/lib/models/reflections/signature.d.ts +8 -1
- package/dist/lib/models/reflections/signature.js +14 -0
- package/dist/lib/models/reflections/type-parameter.d.ts +7 -4
- package/dist/lib/models/reflections/type-parameter.js +9 -3
- package/dist/lib/models/reflections/variant.d.ts +18 -0
- package/dist/lib/models/reflections/variant.js +2 -0
- package/dist/lib/models/sources/file.d.ts +2 -0
- package/dist/lib/models/sources/file.js +3 -0
- package/dist/lib/models/types.d.ts +24 -20
- package/dist/lib/models/types.js +132 -33
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +3 -7
- package/dist/lib/output/renderer.d.ts +21 -14
- package/dist/lib/output/renderer.js +25 -25
- package/dist/lib/output/themes/MarkedPlugin.js +2 -3
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +2 -20
- package/dist/lib/output/themes/default/DefaultTheme.js +4 -75
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +10 -9
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +55 -1
- package/dist/lib/output/themes/default/partials/header.js +2 -5
- package/dist/lib/output/themes/default/partials/index.js +2 -2
- package/dist/lib/output/themes/default/partials/member.getterSetter.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/member.getterSetter.js +4 -1
- package/dist/lib/output/themes/default/partials/member.js +1 -1
- package/dist/lib/output/themes/default/partials/member.signatures.js +2 -1
- package/dist/lib/output/themes/default/partials/members.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/members.js +3 -1
- package/dist/lib/output/themes/default/partials/navigation.js +6 -4
- package/dist/lib/output/themes/default/partials/parameter.js +1 -1
- package/dist/lib/output/themes/default/partials/type.js +4 -4
- package/dist/lib/output/themes/default/templates/reflection.js +1 -1
- package/dist/lib/output/themes/lib.d.ts +4 -1
- package/dist/lib/output/themes/lib.js +53 -3
- package/dist/lib/serialization/deserializer.d.ts +54 -0
- package/dist/lib/serialization/deserializer.js +212 -0
- package/dist/lib/serialization/events.d.ts +0 -15
- package/dist/lib/serialization/index.d.ts +2 -3
- package/dist/lib/serialization/index.js +4 -3
- package/dist/lib/serialization/schema.d.ts +23 -17
- package/dist/lib/serialization/serializer.d.ts +5 -5
- package/dist/lib/serialization/serializer.js +4 -15
- package/dist/lib/utils/array.d.ts +0 -1
- package/dist/lib/utils/array.js +1 -2
- package/dist/lib/utils/entry-point.d.ts +15 -4
- package/dist/lib/utils/entry-point.js +45 -28
- package/dist/lib/utils/enum.d.ts +4 -1
- package/dist/lib/utils/enum.js +2 -3
- package/dist/lib/utils/fs.d.ts +3 -1
- package/dist/lib/utils/fs.js +36 -73
- package/dist/lib/utils/index.d.ts +4 -3
- package/dist/lib/utils/index.js +3 -3
- package/dist/lib/utils/loggers.d.ts +5 -26
- package/dist/lib/utils/loggers.js +38 -42
- package/dist/lib/utils/map.d.ts +17 -0
- package/dist/lib/utils/map.js +49 -1
- package/dist/lib/utils/options/declaration.d.ts +20 -6
- package/dist/lib/utils/options/help.js +1 -1
- package/dist/lib/utils/options/options.d.ts +27 -18
- package/dist/lib/utils/options/options.js +68 -14
- package/dist/lib/utils/options/readers/arguments.d.ts +2 -1
- package/dist/lib/utils/options/readers/arguments.js +9 -2
- package/dist/lib/utils/options/readers/tsconfig.d.ts +3 -7
- package/dist/lib/utils/options/readers/tsconfig.js +35 -36
- package/dist/lib/utils/options/readers/typedoc.d.ts +4 -5
- package/dist/lib/utils/options/readers/typedoc.js +9 -21
- package/dist/lib/utils/options/sources/typedoc.js +18 -64
- package/dist/lib/utils/package-manifest.js +1 -2
- package/dist/lib/utils/paths.js +2 -0
- package/dist/lib/utils/plugins.d.ts +1 -2
- package/dist/lib/utils/plugins.js +22 -106
- package/dist/lib/utils/sort.d.ts +1 -1
- package/dist/lib/utils/sort.js +8 -11
- package/dist/lib/utils/tsconfig.d.ts +4 -0
- package/dist/lib/utils/tsconfig.js +36 -0
- package/dist/lib/utils/tsutils.d.ts +3 -2
- package/dist/lib/utils/tsutils.js +46 -12
- package/dist/lib/validation/documentation.d.ts +1 -1
- package/dist/lib/validation/documentation.js +6 -29
- package/dist/lib/validation/exports.js +18 -21
- package/dist/lib/validation/links.js +1 -1
- package/package.json +18 -19
- package/static/main.js +1 -55
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Reflection } from "./abstract";
|
|
2
1
|
import { DeclarationReflection } from "./declaration";
|
|
3
|
-
import type { Serializer, JSONOutput } from "../../serialization";
|
|
2
|
+
import type { Serializer, JSONOutput, Deserializer } from "../../serialization";
|
|
3
|
+
import type { Reflection } from "./abstract";
|
|
4
4
|
/**
|
|
5
5
|
* Describes a reflection which does not exist at this location, but is referenced. Used for imported reflections.
|
|
6
6
|
*
|
|
@@ -15,17 +15,13 @@ import type { Serializer, JSONOutput } from "../../serialization";
|
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
17
|
export declare class ReferenceReflection extends DeclarationReflection {
|
|
18
|
+
readonly variant = "reference";
|
|
18
19
|
private _target;
|
|
19
|
-
private _project?;
|
|
20
20
|
/**
|
|
21
21
|
* Creates a reference reflection. Should only be used within the factory function.
|
|
22
|
-
* @param name
|
|
23
|
-
* @param state
|
|
24
|
-
* @param parent
|
|
25
|
-
*
|
|
26
22
|
* @internal
|
|
27
23
|
*/
|
|
28
|
-
constructor(name: string,
|
|
24
|
+
constructor(name: string, reflection: Reflection, parent?: Reflection);
|
|
29
25
|
/**
|
|
30
26
|
* Tries to get the reflection that is referenced. This may be another reference reflection.
|
|
31
27
|
* To fully resolve any references, use {@link tryGetTargetReflectionDeep}.
|
|
@@ -47,6 +43,6 @@ export declare class ReferenceReflection extends DeclarationReflection {
|
|
|
47
43
|
*/
|
|
48
44
|
getTargetReflectionDeep(): Reflection;
|
|
49
45
|
getChildByName(arg: string | string[]): Reflection | undefined;
|
|
50
|
-
private _ensureProject;
|
|
51
46
|
toObject(serializer: Serializer): JSONOutput.ReferenceReflection;
|
|
47
|
+
fromObject(de: Deserializer, obj: JSONOutput.ReferenceReflection): void;
|
|
52
48
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ReferenceReflection = void 0;
|
|
4
|
-
const abstract_1 = require("./abstract");
|
|
5
4
|
const declaration_1 = require("./declaration");
|
|
6
5
|
const kind_1 = require("./kind");
|
|
7
6
|
/**
|
|
@@ -20,29 +19,19 @@ const kind_1 = require("./kind");
|
|
|
20
19
|
class ReferenceReflection extends declaration_1.DeclarationReflection {
|
|
21
20
|
/**
|
|
22
21
|
* Creates a reference reflection. Should only be used within the factory function.
|
|
23
|
-
* @param name
|
|
24
|
-
* @param state
|
|
25
|
-
* @param parent
|
|
26
|
-
*
|
|
27
22
|
* @internal
|
|
28
23
|
*/
|
|
29
|
-
constructor(name,
|
|
24
|
+
constructor(name, reflection, parent) {
|
|
30
25
|
super(name, kind_1.ReflectionKind.Reference, parent);
|
|
31
|
-
this.
|
|
26
|
+
this.variant = "reference";
|
|
27
|
+
this._target = reflection.id;
|
|
32
28
|
}
|
|
33
29
|
/**
|
|
34
30
|
* Tries to get the reflection that is referenced. This may be another reference reflection.
|
|
35
31
|
* To fully resolve any references, use {@link tryGetTargetReflectionDeep}.
|
|
36
32
|
*/
|
|
37
33
|
tryGetTargetReflection() {
|
|
38
|
-
this.
|
|
39
|
-
if (this._target instanceof abstract_1.Reflection) {
|
|
40
|
-
return this._target;
|
|
41
|
-
}
|
|
42
|
-
const target = this._project.getReflectionFromSymbol(this._target);
|
|
43
|
-
if (target)
|
|
44
|
-
this._target = target;
|
|
45
|
-
return target;
|
|
34
|
+
return this.project.getReflectionById(this._target);
|
|
46
35
|
}
|
|
47
36
|
/**
|
|
48
37
|
* Tries to get the reflection that is referenced, this will fully resolve references.
|
|
@@ -60,7 +49,6 @@ class ReferenceReflection extends declaration_1.DeclarationReflection {
|
|
|
60
49
|
* To fully resolve any references, use {@link getTargetReflectionDeep}.
|
|
61
50
|
*/
|
|
62
51
|
getTargetReflection() {
|
|
63
|
-
this._ensureProject();
|
|
64
52
|
const target = this.tryGetTargetReflection();
|
|
65
53
|
if (!target) {
|
|
66
54
|
throw new Error("Reference was unresolved.");
|
|
@@ -81,24 +69,20 @@ class ReferenceReflection extends declaration_1.DeclarationReflection {
|
|
|
81
69
|
getChildByName(arg) {
|
|
82
70
|
return this.getTargetReflection().getChildByName(arg);
|
|
83
71
|
}
|
|
84
|
-
_ensureProject() {
|
|
85
|
-
if (this._project) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
let project = this.parent;
|
|
89
|
-
while (project && !project.isProject()) {
|
|
90
|
-
project = project.parent;
|
|
91
|
-
}
|
|
92
|
-
this._project = project;
|
|
93
|
-
if (!this._project) {
|
|
94
|
-
throw new Error("Reference reflection has no project and is unable to resolve.");
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
72
|
toObject(serializer) {
|
|
98
73
|
return {
|
|
99
74
|
...super.toObject(serializer),
|
|
75
|
+
variant: this.variant,
|
|
100
76
|
target: this.tryGetTargetReflection()?.id ?? -1,
|
|
101
77
|
};
|
|
102
78
|
}
|
|
79
|
+
fromObject(de, obj) {
|
|
80
|
+
super.fromObject(de, obj);
|
|
81
|
+
de.defer((project) => {
|
|
82
|
+
this._target =
|
|
83
|
+
project.getReflectionById(de.oldIdToNewId[obj.target] ?? -1)
|
|
84
|
+
?.id ?? -1;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
103
87
|
}
|
|
104
88
|
exports.ReferenceReflection = ReferenceReflection;
|
|
@@ -4,11 +4,17 @@ import type { ParameterReflection } from "./parameter";
|
|
|
4
4
|
import type { TypeParameterReflection } from "./type-parameter";
|
|
5
5
|
import type { DeclarationReflection } from "./declaration";
|
|
6
6
|
import type { ReflectionKind } from "./kind";
|
|
7
|
-
import type { Serializer, JSONOutput } from "../../serialization";
|
|
7
|
+
import type { Serializer, JSONOutput, Deserializer } from "../../serialization";
|
|
8
|
+
import { SourceReference } from "../sources/file";
|
|
8
9
|
export declare class SignatureReflection extends Reflection {
|
|
10
|
+
readonly variant = "signature";
|
|
9
11
|
constructor(name: string, kind: SignatureReflection["kind"], parent: DeclarationReflection);
|
|
10
12
|
kind: ReflectionKind.SetSignature | ReflectionKind.GetSignature | ReflectionKind.IndexSignature | ReflectionKind.CallSignature | ReflectionKind.ConstructorSignature;
|
|
11
13
|
parent: DeclarationReflection;
|
|
14
|
+
/**
|
|
15
|
+
* A list of all source files that contributed to this reflection.
|
|
16
|
+
*/
|
|
17
|
+
sources?: SourceReference[];
|
|
12
18
|
parameters?: ParameterReflection[];
|
|
13
19
|
typeParameters?: TypeParameterReflection[];
|
|
14
20
|
type?: SomeType;
|
|
@@ -44,4 +50,5 @@ export declare class SignatureReflection extends Reflection {
|
|
|
44
50
|
*/
|
|
45
51
|
toString(): string;
|
|
46
52
|
toObject(serializer: Serializer): JSONOutput.SignatureReflection;
|
|
53
|
+
fromObject(de: Deserializer, obj: JSONOutput.SignatureReflection): void;
|
|
47
54
|
}
|
|
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SignatureReflection = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
const abstract_1 = require("./abstract");
|
|
6
|
+
const file_1 = require("../sources/file");
|
|
6
7
|
class SignatureReflection extends abstract_1.Reflection {
|
|
7
8
|
constructor(name, kind, parent) {
|
|
8
9
|
super(name, kind, parent);
|
|
10
|
+
this.variant = "signature";
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
13
|
* Traverse all potential child reflections of this reflection.
|
|
@@ -50,6 +52,8 @@ class SignatureReflection extends abstract_1.Reflection {
|
|
|
50
52
|
toObject(serializer) {
|
|
51
53
|
return {
|
|
52
54
|
...super.toObject(serializer),
|
|
55
|
+
variant: this.variant,
|
|
56
|
+
sources: serializer.toObjectsOptional(this.sources),
|
|
53
57
|
typeParameter: serializer.toObjectsOptional(this.typeParameters),
|
|
54
58
|
parameters: serializer.toObjectsOptional(this.parameters),
|
|
55
59
|
type: serializer.toObject(this.type),
|
|
@@ -58,5 +62,15 @@ class SignatureReflection extends abstract_1.Reflection {
|
|
|
58
62
|
implementationOf: serializer.toObject(this.implementationOf),
|
|
59
63
|
};
|
|
60
64
|
}
|
|
65
|
+
fromObject(de, obj) {
|
|
66
|
+
super.fromObject(de, obj);
|
|
67
|
+
this.sources = de.reviveMany(obj.sources, (t) => new file_1.SourceReference(t.fileName, t.line, t.character));
|
|
68
|
+
this.typeParameters = de.reviveMany(obj.typeParameter, (t) => de.constructReflection(t));
|
|
69
|
+
this.parameters = de.reviveMany(obj.parameters, (t) => de.constructReflection(t));
|
|
70
|
+
this.type = de.reviveType(obj.type);
|
|
71
|
+
this.overwrites = de.reviveType(obj.overwrites);
|
|
72
|
+
this.inheritedFrom = de.reviveType(obj.inheritedFrom);
|
|
73
|
+
this.implementationOf = de.reviveType(obj.implementationOf);
|
|
74
|
+
}
|
|
61
75
|
}
|
|
62
76
|
exports.SignatureReflection = SignatureReflection;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { SomeType } from "../types";
|
|
2
2
|
import { Reflection } from "./abstract";
|
|
3
3
|
import type { DeclarationReflection } from "./declaration";
|
|
4
|
-
import type { Serializer, JSONOutput } from "../../serialization";
|
|
4
|
+
import type { Serializer, JSONOutput, Deserializer } from "../../serialization";
|
|
5
|
+
import type { SignatureReflection } from "./signature";
|
|
5
6
|
/**
|
|
6
7
|
* Modifier flags for type parameters, added in TS 4.7
|
|
7
8
|
* @enum
|
|
@@ -11,12 +12,14 @@ export declare const VarianceModifier: {
|
|
|
11
12
|
readonly out: "out";
|
|
12
13
|
readonly inOut: "in out";
|
|
13
14
|
};
|
|
14
|
-
export type VarianceModifier =
|
|
15
|
+
export type VarianceModifier = typeof VarianceModifier[keyof typeof VarianceModifier];
|
|
15
16
|
export declare class TypeParameterReflection extends Reflection {
|
|
16
|
-
|
|
17
|
+
readonly variant = "typeParam";
|
|
18
|
+
parent?: DeclarationReflection | SignatureReflection;
|
|
17
19
|
type?: SomeType;
|
|
18
20
|
default?: SomeType;
|
|
19
21
|
varianceModifier?: VarianceModifier;
|
|
20
|
-
constructor(name: string,
|
|
22
|
+
constructor(name: string, parent: Reflection, varianceModifier: VarianceModifier | undefined);
|
|
21
23
|
toObject(serializer: Serializer): JSONOutput.TypeParameterReflection;
|
|
24
|
+
fromObject(de: Deserializer, obj: JSONOutput.TypeParameterReflection): void;
|
|
22
25
|
}
|
|
@@ -13,19 +13,25 @@ exports.VarianceModifier = {
|
|
|
13
13
|
inOut: "in out",
|
|
14
14
|
};
|
|
15
15
|
class TypeParameterReflection extends abstract_1.Reflection {
|
|
16
|
-
constructor(name,
|
|
16
|
+
constructor(name, parent, varianceModifier) {
|
|
17
17
|
super(name, kind_1.ReflectionKind.TypeParameter, parent);
|
|
18
|
-
this.
|
|
19
|
-
this.default = defaultType;
|
|
18
|
+
this.variant = "typeParam";
|
|
20
19
|
this.varianceModifier = varianceModifier;
|
|
21
20
|
}
|
|
22
21
|
toObject(serializer) {
|
|
23
22
|
return {
|
|
24
23
|
...super.toObject(serializer),
|
|
24
|
+
variant: this.variant,
|
|
25
25
|
type: serializer.toObject(this.type),
|
|
26
26
|
default: serializer.toObject(this.default),
|
|
27
27
|
varianceModifier: this.varianceModifier,
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
+
fromObject(de, obj) {
|
|
31
|
+
super.fromObject(de, obj);
|
|
32
|
+
this.type = de.reviveType(obj.type);
|
|
33
|
+
this.default = de.reviveType(obj.default);
|
|
34
|
+
this.varianceModifier = obj.varianceModifier;
|
|
35
|
+
}
|
|
30
36
|
}
|
|
31
37
|
exports.TypeParameterReflection = TypeParameterReflection;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DeclarationReflection } from "./declaration";
|
|
2
|
+
import type { ParameterReflection } from "./parameter";
|
|
3
|
+
import type { ProjectReflection } from "./project";
|
|
4
|
+
import type { ReferenceReflection } from "./reference";
|
|
5
|
+
import type { SignatureReflection } from "./signature";
|
|
6
|
+
import type { TypeParameterReflection } from "./type-parameter";
|
|
7
|
+
/**
|
|
8
|
+
* A map of known {@link Reflection} concrete subclasses.
|
|
9
|
+
* This is used during deserialization to reconstruct serialized objects.
|
|
10
|
+
*/
|
|
11
|
+
export interface ReflectionVariant {
|
|
12
|
+
declaration: DeclarationReflection;
|
|
13
|
+
param: ParameterReflection;
|
|
14
|
+
project: ProjectReflection;
|
|
15
|
+
reference: ReferenceReflection;
|
|
16
|
+
signature: SignatureReflection;
|
|
17
|
+
typeParam: TypeParameterReflection;
|
|
18
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Deserializer } from "../../serialization/deserializer";
|
|
1
2
|
import type { SourceReference as JSONSourceReference } from "../../serialization/schema";
|
|
2
3
|
/**
|
|
3
4
|
* Represents references of reflections to their defining source files.
|
|
@@ -27,4 +28,5 @@ export declare class SourceReference {
|
|
|
27
28
|
url?: string;
|
|
28
29
|
constructor(fileName: string, line: number, character: number);
|
|
29
30
|
toObject(): JSONSourceReference;
|
|
31
|
+
fromObject(_de: Deserializer, obj: JSONSourceReference): void;
|
|
30
32
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ts from "typescript";
|
|
2
2
|
import type { Context } from "../converter";
|
|
3
|
-
import { Reflection } from "./reflections/abstract";
|
|
3
|
+
import type { Reflection } from "./reflections/abstract";
|
|
4
4
|
import type { DeclarationReflection } from "./reflections/declaration";
|
|
5
5
|
import type { ProjectReflection } from "./reflections/project";
|
|
6
|
-
import type { Serializer, JSONOutput } from "../serialization";
|
|
6
|
+
import type { Serializer, JSONOutput, Deserializer } from "../serialization";
|
|
7
|
+
import { ReflectionSymbolId } from "./reflections/ReflectionSymbolId";
|
|
7
8
|
import type { DeclarationReference } from "../converter/comments/declarationReference";
|
|
8
9
|
/**
|
|
9
10
|
* Base class of all type definitions.
|
|
@@ -24,6 +25,7 @@ export declare abstract class Type {
|
|
|
24
25
|
visit<T>(visitor: Partial<TypeVisitor<T>>): T | undefined;
|
|
25
26
|
stringify(context: TypeContext): string;
|
|
26
27
|
abstract toObject(serializer: Serializer): JSONOutput.SomeType;
|
|
28
|
+
fromObject(_de: Deserializer, _obj: JSONOutput.SomeType): void;
|
|
27
29
|
abstract needsParenthesis(context: TypeContext): boolean;
|
|
28
30
|
/**
|
|
29
31
|
* Implementation method for `toString`. `needsParenthesis` will be used to determine if
|
|
@@ -46,9 +48,9 @@ export interface TypeKindMap {
|
|
|
46
48
|
reference: ReferenceType;
|
|
47
49
|
reflection: ReflectionType;
|
|
48
50
|
rest: RestType;
|
|
49
|
-
|
|
51
|
+
templateLiteral: TemplateLiteralType;
|
|
50
52
|
tuple: TupleType;
|
|
51
|
-
|
|
53
|
+
namedTupleMember: NamedTupleMember;
|
|
52
54
|
typeOperator: TypeOperatorType;
|
|
53
55
|
union: UnionType;
|
|
54
56
|
unknown: UnknownType;
|
|
@@ -89,7 +91,7 @@ export declare const TypeContext: {
|
|
|
89
91
|
readonly tupleElement: "tupleElement";
|
|
90
92
|
readonly unionElement: "unionElement";
|
|
91
93
|
};
|
|
92
|
-
export type TypeContext =
|
|
94
|
+
export type TypeContext = typeof TypeContext[keyof typeof TypeContext];
|
|
93
95
|
/**
|
|
94
96
|
* Represents an array type.
|
|
95
97
|
*
|
|
@@ -231,8 +233,8 @@ export declare class MappedType extends Type {
|
|
|
231
233
|
* ```
|
|
232
234
|
*/
|
|
233
235
|
export declare class OptionalType extends Type {
|
|
234
|
-
readonly type = "optional";
|
|
235
236
|
elementType: SomeType;
|
|
237
|
+
readonly type = "optional";
|
|
236
238
|
constructor(elementType: SomeType);
|
|
237
239
|
protected getTypeString(): string;
|
|
238
240
|
needsParenthesis(): boolean;
|
|
@@ -277,9 +279,9 @@ export declare class PredicateType extends Type {
|
|
|
277
279
|
* ```
|
|
278
280
|
*/
|
|
279
281
|
export declare class QueryType extends Type {
|
|
280
|
-
|
|
282
|
+
queryType: ReferenceType;
|
|
281
283
|
readonly type = "query";
|
|
282
|
-
constructor(
|
|
284
|
+
constructor(queryType: ReferenceType);
|
|
283
285
|
protected getTypeString(): string;
|
|
284
286
|
/**
|
|
285
287
|
* @privateRemarks
|
|
@@ -302,7 +304,7 @@ export declare class ReferenceType extends Type {
|
|
|
302
304
|
/**
|
|
303
305
|
* The name of the referenced type.
|
|
304
306
|
*
|
|
305
|
-
* If the symbol cannot be found
|
|
307
|
+
* If the symbol cannot be found because it's not part of the documentation this
|
|
306
308
|
* can be used to represent the type.
|
|
307
309
|
*/
|
|
308
310
|
name: string;
|
|
@@ -315,12 +317,14 @@ export declare class ReferenceType extends Type {
|
|
|
315
317
|
*/
|
|
316
318
|
get reflection(): Reflection | undefined;
|
|
317
319
|
/**
|
|
318
|
-
*
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
320
|
+
* If not resolved, the symbol id of the reflection, otherwise undefined.
|
|
321
|
+
*/
|
|
322
|
+
get symbolId(): ReflectionSymbolId | undefined;
|
|
323
|
+
/**
|
|
324
|
+
* Checks if this type is a reference type because it uses a name, but is intentionally not pointing
|
|
325
|
+
* to a reflection. This happens for type parameters and when representing a mapped type.
|
|
322
326
|
*/
|
|
323
|
-
|
|
327
|
+
isIntentionallyBroken(): boolean;
|
|
324
328
|
/**
|
|
325
329
|
* Convert this reference type to a declaration reference used for resolution of external types.
|
|
326
330
|
*/
|
|
@@ -332,7 +336,6 @@ export declare class ReferenceType extends Type {
|
|
|
332
336
|
qualifiedName: string;
|
|
333
337
|
/**
|
|
334
338
|
* The package that this type is referencing.
|
|
335
|
-
* Will only be set for `ReferenceType`s pointing to a symbol within `node_modules`.
|
|
336
339
|
*/
|
|
337
340
|
package?: string;
|
|
338
341
|
/**
|
|
@@ -343,13 +346,14 @@ export declare class ReferenceType extends Type {
|
|
|
343
346
|
private _target;
|
|
344
347
|
private _project;
|
|
345
348
|
private constructor();
|
|
346
|
-
static createResolvedReference(name: string, target: Reflection | number, project: ProjectReflection): ReferenceType;
|
|
349
|
+
static createResolvedReference(name: string, target: Reflection | number, project: ProjectReflection | null): ReferenceType;
|
|
347
350
|
static createSymbolReference(symbol: ts.Symbol, context: Context, name?: string): ReferenceType;
|
|
348
351
|
/** @internal this is used for type parameters, which don't actually point to something */
|
|
349
352
|
static createBrokenReference(name: string, project: ProjectReflection): ReferenceType;
|
|
350
353
|
protected getTypeString(): string;
|
|
351
354
|
needsParenthesis(): boolean;
|
|
352
355
|
toObject(serializer: Serializer): JSONOutput.ReferenceType;
|
|
356
|
+
fromObject(de: Deserializer, obj: JSONOutput.ReferenceType): void;
|
|
353
357
|
}
|
|
354
358
|
/**
|
|
355
359
|
* Represents a type which has it's own reflection like literal types.
|
|
@@ -362,8 +366,8 @@ export declare class ReferenceType extends Type {
|
|
|
362
366
|
* ```
|
|
363
367
|
*/
|
|
364
368
|
export declare class ReflectionType extends Type {
|
|
365
|
-
readonly type = "reflection";
|
|
366
369
|
declaration: DeclarationReflection;
|
|
370
|
+
readonly type = "reflection";
|
|
367
371
|
constructor(declaration: DeclarationReflection);
|
|
368
372
|
protected getTypeString(): "Object" | "Function";
|
|
369
373
|
needsParenthesis(): boolean;
|
|
@@ -393,7 +397,7 @@ export declare class RestType extends Type {
|
|
|
393
397
|
export declare class TemplateLiteralType extends Type {
|
|
394
398
|
head: string;
|
|
395
399
|
tail: [SomeType, string][];
|
|
396
|
-
readonly type = "
|
|
400
|
+
readonly type = "templateLiteral";
|
|
397
401
|
constructor(head: string, tail: [SomeType, string][]);
|
|
398
402
|
protected getTypeString(): string;
|
|
399
403
|
needsParenthesis(): boolean;
|
|
@@ -428,7 +432,7 @@ export declare class NamedTupleMember extends Type {
|
|
|
428
432
|
name: string;
|
|
429
433
|
isOptional: boolean;
|
|
430
434
|
element: SomeType;
|
|
431
|
-
readonly type = "
|
|
435
|
+
readonly type = "namedTupleMember";
|
|
432
436
|
constructor(name: string, isOptional: boolean, element: SomeType);
|
|
433
437
|
/**
|
|
434
438
|
* Return a string representation of this type.
|