Skip to content

Commit 442ecbc

Browse files
committed
handle training semicolons
1 parent a7e8846 commit 442ecbc

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/typescript-driver.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,11 +451,19 @@ export class TypeScriptDriver implements LanguageDriver {
451451
normalize(typeSpan: string, relevantTypes: Map<string, TypeSpanAndSourceFile>) {
452452
// NOTE: BUGFIX
453453
// console.log(`normalize: ${typeSpan}`)
454+
// console.log(`normalize: ${typeSpan}`)
455+
// console.log(`normalize: ${typeSpan == undefined}`)
454456

455457
if (typeSpan.slice(typeSpan.length - 2) == " =") {
456-
typeSpan = typeSpan.slice(typeSpan.length - 2);
458+
typeSpan = typeSpan.slice(0, typeSpan.length - 2);
459+
}
460+
461+
if (typeSpan.slice(typeSpan.length - 1) == ";") {
462+
typeSpan = typeSpan.slice(0, typeSpan.length - 1);
457463
}
458464

465+
// console.log(typeSpan)
466+
459467
let normalForm = "";
460468

461469
// pattern matching for typeSpan
@@ -535,10 +543,16 @@ export class TypeScriptDriver implements LanguageDriver {
535543
normalize2(typeSpan: string, relevantTypes: Map<string, TypeSpanAndSourceFile>) {
536544
// NOTE: BUGFIX
537545
// console.log(`normalize: ${typeSpan}`)
546+
// console.log(`normalize: ${typeSpan == undefined}`)
538547

539548
if (typeSpan.slice(typeSpan.length - 2) == " =") {
540-
typeSpan = typeSpan.slice(typeSpan.length - 2);
549+
typeSpan = typeSpan.slice(0, typeSpan.length - 2);
550+
}
551+
552+
if (typeSpan.slice(typeSpan.length - 1) == ";") {
553+
typeSpan = typeSpan.slice(0, typeSpan.length - 1);
541554
}
555+
// console.log(typeSpan)
542556

543557
let normalForm = "";
544558

0 commit comments

Comments
 (0)