Skip to content

Commit a87b197

Browse files
committed
Fix missed todo
1 parent 5f1ea73 commit a87b197

File tree

3 files changed

+27
-19
lines changed

3 files changed

+27
-19
lines changed

src/lib/models/comments/comment.ts

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { assertNever, removeIf } from "../../utils";
2-
import type { Reflection, ReflectionSymbolId } from "../reflections";
2+
import { Reflection, ReflectionSymbolId } from "../reflections";
33

44
import type { Serializer, Deserializer, JSONOutput } from "../../serialization";
55

@@ -233,18 +233,37 @@ export class Comment {
233233
case "code":
234234
return { ...part };
235235
case "inline-tag": {
236-
if (typeof part.target !== "number") {
237-
// TS isn't quite smart enough here...
238-
// GERRIT this is wrong
239-
return { ...part } as CommentDisplayPart;
240-
} else {
236+
if (typeof part.target === "number") {
241237
const part2 = {
242238
kind: part.kind,
243239
tag: part.tag,
244240
text: part.text,
245-
};
241+
target: undefined,
242+
tsLinkText: part.tsLinkText,
243+
} satisfies InlineTagDisplayPart;
246244
links.push([part.target, part2]);
247245
return part2;
246+
} else if (
247+
typeof part.target === "string" ||
248+
part.target === undefined
249+
) {
250+
return {
251+
kind: "inline-tag",
252+
tag: part.tag,
253+
text: part.text,
254+
target: part.target,
255+
tsLinkText: part.tsLinkText,
256+
} satisfies InlineTagDisplayPart;
257+
} else if (typeof part.target === "object") {
258+
return {
259+
kind: "inline-tag",
260+
tag: part.tag,
261+
text: part.text,
262+
target: new ReflectionSymbolId(part.target),
263+
tsLinkText: part.tsLinkText,
264+
} satisfies InlineTagDisplayPart;
265+
} else {
266+
assertNever(part.target);
248267
}
249268
}
250269
}

src/lib/types/ts-internal/index.d.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,6 @@ declare module "typescript" {
1515
parent?: ts.Symbol;
1616
}
1717

18-
interface TypeChecker {
19-
// https://github.com/microsoft/TypeScript/blob/v4.1.5/src/compiler/types.ts#L4145
20-
// https://github.com/microsoft/TypeScript/issues/42118
21-
getTypePredicateOfSignature(
22-
signature: ts.Signature
23-
): ts.TypePredicate | undefined;
24-
25-
// https://github.com/microsoft/TypeScript/blob/v4.7.2/src/compiler/types.ts#L4188
26-
getTypeOfSymbol(symbol: Symbol): Type;
27-
}
28-
2918
// https://github.com/microsoft/TypeScript/blob/v5.0.2/src/compiler/utilities.ts#L7432
3019
export function getCheckFlags(symbol: ts.Symbol): CheckFlags;
3120

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// Speed up dev compilation time
1111
"incremental": true,
1212
"tsBuildInfoFile": "dist/.tsbuildinfo",
13-
"skipLibCheck": true,
13+
// "skipLibCheck": true,
1414

1515
"experimentalDecorators": true,
1616
"strict": true,

0 commit comments

Comments
 (0)