Skip to content

Commit 9f7baa9

Browse files
committed
Add support for query type
1 parent d0d7091 commit 9f7baa9

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

src/render/type-formatter.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
import { ArrayType, ConditionalType, IndexedAccessType, IntersectionType, IntrinsicType, PredicateType, ReferenceType, ReflectionType, StringLiteralType, TupleType, Type, TypeOperatorType, TypeParameterType, UnionType } from 'typedoc/dist/lib/models';
1+
import {
2+
ArrayType,
3+
ConditionalType,
4+
IndexedAccessType,
5+
IntersectionType,
6+
IntrinsicType,
7+
PredicateType,
8+
QueryType,
9+
ReferenceType,
10+
ReflectionType,
11+
StringLiteralType,
12+
TupleType,
13+
Type,
14+
TypeOperatorType,
15+
TypeParameterType,
16+
UnionType,
17+
} from 'typedoc/dist/lib/models';
218
import ReflectionFormatter from './reflection-formatter';
319

420
interface TypeFormatterOptions {
@@ -92,6 +108,10 @@ export default class TypeFormatter {
92108
.map(t => TypeFormatter.format(t)).join(' | ');
93109
}
94110

111+
if (type.type === 'query') {
112+
return `typeof ${TypeFormatter.format((type as QueryType).queryType)}`;
113+
}
114+
95115
const other = type as any;
96116
if (other.name) {
97117
return other.name;

tests/test-data/enum/expected.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ declare enum MyEnum {
66
shoulder = "shoulder",
77
knee = 2,
88
toe = 5,
9-
}
9+
}
10+
11+
declare type MyEnumStrings = keyof typeof MyEnum;

tests/test-data/enum/input.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ export enum MyEnum {
77
knee = 2,
88
toe = 5,
99
}
10+
11+
export type MyEnumStrings = keyof typeof MyEnum;

0 commit comments

Comments
 (0)