Merge pull request #16488 from Microsoft/add-jsdoc-to-eof-token

Add jsdoc to EOF token to catch missed `@typedef`s
This commit is contained in:
Nathan Shively-Sanders 2017-06-13 11:14:52 -07:00 committed by GitHub
commit 2495e6780b
4 changed files with 36 additions and 1 deletions

View File

@ -685,7 +685,7 @@ namespace ts {
sourceFile.statements = parseList(ParsingContext.SourceElements, parseStatement);
Debug.assert(token() === SyntaxKind.EndOfFileToken);
sourceFile.endOfFileToken = <EndOfFileToken>parseTokenNode();
sourceFile.endOfFileToken = addJSDocComment(parseTokenNode() as EndOfFileToken);
setExternalModuleIndicator(sourceFile);

View File

@ -0,0 +1,12 @@
=== tests/cases/conformance/jsdoc/dtsEquivalent.js ===
/** @typedef {{[k: string]: any}} AnyEffect */
No type information for this code./** @typedef {number} Third */
No type information for this code.=== tests/cases/conformance/jsdoc/index.js ===
/** @type {AnyEffect} */
let b;
>b : Symbol(b, Decl(index.js, 1, 3))
/** @type {Third} */
let c;
>c : Symbol(c, Decl(index.js, 3, 3))

View File

@ -0,0 +1,12 @@
=== tests/cases/conformance/jsdoc/dtsEquivalent.js ===
/** @typedef {{[k: string]: any}} AnyEffect */
No type information for this code./** @typedef {number} Third */
No type information for this code.=== tests/cases/conformance/jsdoc/index.js ===
/** @type {AnyEffect} */
let b;
>b : { [k: string]: any; }
/** @type {Third} */
let c;
>c : number

View File

@ -0,0 +1,11 @@
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: dtsEquivalent.js
/** @typedef {{[k: string]: any}} AnyEffect */
/** @typedef {number} Third */
// @Filename: index.js
/** @type {AnyEffect} */
let b;
/** @type {Third} */
let c;