From f6ca10565d8fb0a9737b687b85e14ee94ad244d7 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 8 Oct 2018 17:09:48 -0700 Subject: [PATCH] Fix bug: Ensure JSDoc type range is valid (#27343) --- src/compiler/parser.ts | 2 +- tests/cases/fourslash/editJsdocType.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/editJsdocType.ts diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 056edccdbd200..51e56bbdd98a1 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -6308,7 +6308,7 @@ namespace ts { // Parses out a JSDoc type expression. export function parseJSDocTypeExpression(mayOmitBraces?: boolean): JSDocTypeExpression { - const result = createNode(SyntaxKind.JSDocTypeExpression, scanner.getTokenPos()); + const result = createNode(SyntaxKind.JSDocTypeExpression); const hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(SyntaxKind.OpenBraceToken); result.type = doInsideOfContext(NodeFlags.JSDoc, parseJSDocType); diff --git a/tests/cases/fourslash/editJsdocType.ts b/tests/cases/fourslash/editJsdocType.ts new file mode 100644 index 0000000000000..4e5de6c5daf4b --- /dev/null +++ b/tests/cases/fourslash/editJsdocType.ts @@ -0,0 +1,13 @@ +/// + +// @allowJs: true +// @noLib: true + +// @Filename: /a.js +/////** @type/**/ */ +////const x = 0; + +goTo.marker(); +verify.quickInfoIs(""); +edit.insert(" "); +verify.quickInfoIs("");