Skip to content

Commit 234899d

Browse files
committed
Fix #2220
1 parent ad480a4 commit 234899d

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
- Interfaces/classes created via extending a module will no longer contain variables/functions where the member should have been converted as properties/methods, #2150.
6565
- TypeDoc will now ignore a leading `v` in versions, #2212.
6666
- Category titles now render with the same format in the page index and heading title, #2196.
67+
- Fixed crash when using `typeof` on a reference with type arguments, #2220.
6768

6869
### Thanks!
6970

src/lib/converter/types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,8 +648,9 @@ const queryConverter: TypeConverter<ts.TypeQueryNode> = {
648648
)
649649
);
650650
},
651-
convertType(context, type) {
652-
const symbol = type.getSymbol();
651+
convertType(context, type, node) {
652+
const symbol =
653+
type.getSymbol() || context.getSymbolAtLocation(node.exprName);
653654
assert(
654655
symbol,
655656
`Query type failed to get a symbol for: ${context.checker.typeToString(

src/test/converter2/issues/gh2220.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export class TypeEmitter<T, TOptions extends object = Record<string, never>> {}
2+
3+
export function createAssetEmitter<T, TOptions extends object>(
4+
TypeEmitterClass: typeof TypeEmitter<T, TOptions>
5+
): void {}

src/test/issueTests.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,4 +903,12 @@ export const issueTests: {
903903
const mod = query(project, "Mod");
904904
equal(mod.sources?.[0].line, 1);
905905
},
906+
907+
gh2220(project) {
908+
const fn = query(project, "createAssetEmitter");
909+
const param = fn.signatures?.[0].parameters?.[0];
910+
ok(param);
911+
equal(param.type?.type, "query");
912+
equal(param.type.queryType.reflection?.name, "TypeEmitter");
913+
},
906914
};

0 commit comments

Comments
 (0)