mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-12 20:25:48 -06:00
Fix bug: Ensure JSDoc type range is valid (#27343)
This commit is contained in:
parent
dd9b8cab34
commit
f6ca10565d
@ -6308,7 +6308,7 @@ namespace ts {
|
||||
|
||||
// Parses out a JSDoc type expression.
|
||||
export function parseJSDocTypeExpression(mayOmitBraces?: boolean): JSDocTypeExpression {
|
||||
const result = <JSDocTypeExpression>createNode(SyntaxKind.JSDocTypeExpression, scanner.getTokenPos());
|
||||
const result = <JSDocTypeExpression>createNode(SyntaxKind.JSDocTypeExpression);
|
||||
|
||||
const hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(SyntaxKind.OpenBraceToken);
|
||||
result.type = doInsideOfContext(NodeFlags.JSDoc, parseJSDocType);
|
||||
|
||||
13
tests/cases/fourslash/editJsdocType.ts
Normal file
13
tests/cases/fourslash/editJsdocType.ts
Normal file
@ -0,0 +1,13 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @allowJs: true
|
||||
// @noLib: true
|
||||
|
||||
// @Filename: /a.js
|
||||
/////** @type/**/ */
|
||||
////const x = 0;
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs("");
|
||||
edit.insert(" ");
|
||||
verify.quickInfoIs("");
|
||||
Loading…
x
Reference in New Issue
Block a user