Skip to content

Commit 9c08961

Browse files
committed
Detect namespaces of types
1 parent 067e58a commit 9c08961

File tree

56 files changed

+1184
-406
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1184
-406
lines changed

src/models/module.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,11 @@ export class ModuleNode {
55
public name: string,
66
public exports: ExportNode[],
77
) {}
8+
9+
toObject(): Record<string, unknown> {
10+
return {
11+
name: this.name,
12+
exports: this.exports.map((exportNode) => exportNode.toObject()),
13+
};
14+
}
815
}

src/models/node.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export interface TypeNode {
22
readonly kind: string;
33
name: string | undefined;
4+
parentNamespaces: string[];
45
}

src/models/types/array.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export class ArrayNode implements TypeNode {
44
kind = 'array';
55
constructor(
66
public name: string | undefined,
7+
public parentNamespaces: string[],
78
public elementType: TypeNode,
89
) {}
910
}

src/models/types/component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export class ComponentNode implements TypeNode {
66

77
constructor(
88
public name: string | undefined,
9+
public parentNamespaces: string[],
910
public props: PropertyNode[],
1011
) {}
1112
}

src/models/types/enum.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export class EnumNode implements TypeNode {
66

77
constructor(
88
public name: string,
9+
public parentNamespaces: string[],
910
public members: EnumMember[],
1011
public documentation: Documentation | undefined,
1112
) {}

src/models/types/function.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export class FunctionNode implements TypeNode {
77

88
constructor(
99
name: string | undefined,
10+
public parentNamespaces: string[],
1011
public callSignatures: CallSignature[],
1112
) {
1213
this.name = name === '__function' ? undefined : name;

src/models/types/intersection.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export class IntersectionNode implements TypeNode {
77

88
constructor(
99
public name: string | undefined,
10+
public parentNamespaces: string[],
1011
types: TypeNode[],
1112
public properties: PropertyNode[],
1213
) {

src/models/types/intrinsic.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type IntrinsicType =
1414

1515
export class IntrinsicNode implements TypeNode {
1616
kind = 'intrinsic';
17+
parentNamespaces: string[] = [];
1718

1819
constructor(public name: IntrinsicType) {}
1920
}

src/models/types/literal.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Documentation } from '../documentation';
44
export class LiteralNode implements TypeNode {
55
kind = 'literal';
66
name: undefined;
7+
parentNamespaces: string[] = [];
78

89
constructor(
910
public value: unknown,

src/models/types/object.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export class ObjectNode implements TypeNode {
77

88
constructor(
99
public name: string | undefined,
10+
public parentNamespaces: string[],
1011
public properties: PropertyNode[],
1112
public documentation: Documentation | undefined,
1213
) {}

0 commit comments

Comments
 (0)