Skip to content

Commit 9cf64a5

Browse files
committed
Fix to allow for partial and fully qualified unresolved type names
1 parent bd0d8bc commit 9cf64a5

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/convert/unresolved-types-mapper.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ export default class UnresolvedTypesMapper {
3939
public registerKnownReflection(reflection: Reflection) {
4040
this._knownReflections.add(reflection);
4141
if (reflection.kindOf(ReflectionKind.ClassOrInterface | ReflectionKind.TypeAlias | ReflectionKind.SomeModule)) {
42-
this._knownReflectionNames.add(reflection.name);
42+
const namespace = reflection.getFullName('.').split('.');
43+
for (let i = 0; i < namespace.length; i++) {
44+
this._knownReflectionNames.add(namespace.slice(i).join('.'));
45+
}
4346
}
4447
}
4548

tests/test-data/type/unmapped-expected.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ declare module Unmapped {
33
hidden: unknown;
44
notHidden: NotHidden;
55
newClass: unknown;
6+
child: unknown;
67
doStuff1<T extends NotHidden | OtherClass>(param: T): void;
78
doStuff2<T extends unknown & NotHidden & OtherClass>(param: T): void;
89
}

tests/test-data/type/unmapped-input.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ declare module Unmapped {
1515
hidden: Hidden;
1616
notHidden: NotHidden;
1717
newClass: NewClass;
18+
child: NewModule.MyChild;
1819
doStuff1<T extends Hidden | NotHidden | OtherClass>(param: T): void;
1920
doStuff2<T extends Hidden & NotHidden & OtherClass>(param: T): void;
2021
}
@@ -23,6 +24,13 @@ declare module Unmapped {
2324
[key: number]: Hidden;
2425
}
2526

27+
/**
28+
* @since 2.0
29+
*/
30+
module NewModule {
31+
type MyChild = "good" | "bad";
32+
}
33+
2634
type Union1 = Hidden | NotHidden;
2735
type Intersection1 = Hidden & NotHidden;
2836

0 commit comments

Comments
 (0)