Skip to content

Commit b76d804

Browse files
committed
Fix conversion of NoInfer
Resolves #2539
1 parent 3398e98 commit b76d804

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
- Added `gitRevision:short` placeholder option to `--sourceLinkTemplate` option, #2529.
66
Links generated by TypeDoc will now default to using the non-short git revision.
77

8+
### Bug Fixes
9+
10+
- Fixed conversion of `NoInfer` missing type parameter reference, #2539.
11+
812
### Thanks!
913

1014
- @xuhdev

src/lib/converter/types.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ const queryConverter: TypeConverter<ts.TypeQueryNode> = {
697697

698698
const referenceConverter: TypeConverter<
699699
ts.TypeReferenceNode,
700-
ts.TypeReference | ts.StringMappingType
700+
ts.TypeReference | ts.StringMappingType | ts.SubstitutionType
701701
> = {
702702
kind: [ts.SyntaxKind.TypeReference],
703703
convert(context, node) {
@@ -747,7 +747,12 @@ const referenceConverter: TypeConverter<
747747
context.resolveAliasedSymbol(symbol),
748748
context,
749749
);
750-
if (type.flags & ts.TypeFlags.StringMapping) {
750+
if (type.flags & ts.TypeFlags.Substitution) {
751+
// NoInfer<T>
752+
ref.typeArguments = [
753+
convertType(context, (type as ts.SubstitutionType).baseType),
754+
];
755+
} else if (type.flags & ts.TypeFlags.StringMapping) {
751756
ref.typeArguments = [
752757
convertType(context, (type as ts.StringMappingType).type),
753758
];

src/test/behavior.c2.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,6 @@ describe("Behavior Tests", () => {
11771177
const sig = querySig(project, "createStreetLight");
11781178
equal(sig.parameters?.length, 2);
11791179
equal(sig.parameters[0].type?.toString(), "C[]");
1180-
equal(sig.parameters[1].type?.toString(), "NoInfer");
1180+
equal(sig.parameters[1].type?.toString(), "NoInfer<C>");
11811181
});
11821182
});

0 commit comments

Comments
 (0)