@@ -3161,7 +3161,7 @@ namespace ts {
3161
3161
return addJSDocComment ( finishNode ( node ) ) ;
3162
3162
}
3163
3163
3164
- function tryParseParenthesizedArrowFunctionExpression ( ) : Expression {
3164
+ function tryParseParenthesizedArrowFunctionExpression ( ) : Expression | undefined {
3165
3165
const triState = isParenthesizedArrowFunctionExpression ( ) ;
3166
3166
if ( triState === Tristate . False ) {
3167
3167
// It's definitely not a parenthesized arrow function expression.
@@ -3324,7 +3324,7 @@ namespace ts {
3324
3324
return parseParenthesizedArrowFunctionExpressionHead ( /*allowAmbiguity*/ false ) ;
3325
3325
}
3326
3326
3327
- function tryParseAsyncSimpleArrowFunctionExpression ( ) : ArrowFunction {
3327
+ function tryParseAsyncSimpleArrowFunctionExpression ( ) : ArrowFunction | undefined {
3328
3328
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
3329
3329
if ( token ( ) === SyntaxKind . AsyncKeyword ) {
3330
3330
const isUnParenthesizedAsyncArrowFunction = lookAhead ( isUnParenthesizedAsyncArrowFunctionWorker ) ;
@@ -4398,7 +4398,7 @@ namespace ts {
4398
4398
return finishNode ( node ) ;
4399
4399
}
4400
4400
4401
- function tryParseAccessorDeclaration ( fullStart : number , decorators : NodeArray < Decorator > , modifiers : NodeArray < Modifier > ) : AccessorDeclaration {
4401
+ function tryParseAccessorDeclaration ( fullStart : number , decorators : NodeArray < Decorator > , modifiers : NodeArray < Modifier > ) : AccessorDeclaration | undefined {
4402
4402
if ( parseContextualModifier ( SyntaxKind . GetKeyword ) ) {
4403
4403
return parseAccessorDeclaration ( SyntaxKind . GetAccessor , fullStart , decorators , modifiers ) ;
4404
4404
}
@@ -4511,7 +4511,7 @@ namespace ts {
4511
4511
return addJSDocComment ( finishNode ( node ) ) ;
4512
4512
}
4513
4513
4514
- function parseOptionalIdentifier ( ) {
4514
+ function parseOptionalIdentifier ( ) : Identifier | undefined {
4515
4515
return isIdentifier ( ) ? parseIdentifier ( ) : undefined ;
4516
4516
}
4517
4517
@@ -5576,7 +5576,7 @@ namespace ts {
5576
5576
return addJSDocComment ( finishNode ( node ) ) ;
5577
5577
}
5578
5578
5579
- function parseNameOfClassDeclarationOrExpression ( ) : Identifier {
5579
+ function parseNameOfClassDeclarationOrExpression ( ) : Identifier | undefined {
5580
5580
// implements is a future reserved word so
5581
5581
// 'class implements' might mean either
5582
5582
// - class expression with omitted name, 'implements' starts heritage clause
@@ -6116,7 +6116,7 @@ namespace ts {
6116
6116
}
6117
6117
6118
6118
export namespace JSDocParser {
6119
- export function parseJSDocTypeExpressionForTests ( content : string , start : number , length : number ) {
6119
+ export function parseJSDocTypeExpressionForTests ( content : string , start : number , length : number ) : { jsDocTypeExpression : JSDocTypeExpression , diagnostics : Diagnostic [ ] } | undefined {
6120
6120
initializeState ( content , ScriptTarget . Latest , /*_syntaxCursor:*/ undefined , ScriptKind . JS ) ;
6121
6121
sourceFile = createSourceFile ( "file.js" , ScriptTarget . Latest , ScriptKind . JS ) ;
6122
6122
scanner . setText ( content , start , length ) ;
@@ -6141,7 +6141,7 @@ namespace ts {
6141
6141
return finishNode ( result ) ;
6142
6142
}
6143
6143
6144
- export function parseIsolatedJSDocComment ( content : string , start : number , length : number ) {
6144
+ export function parseIsolatedJSDocComment ( content : string , start : number , length : number ) : { jsDoc : JSDoc , diagnostics : Diagnostic [ ] } | undefined {
6145
6145
initializeState ( content , ScriptTarget . Latest , /*_syntaxCursor:*/ undefined , ScriptKind . JS ) ;
6146
6146
sourceFile = < SourceFile > { languageVariant : LanguageVariant . Standard , text : content } ;
6147
6147
const jsDoc = parseJSDocCommentWorker ( start , length ) ;
@@ -6476,7 +6476,7 @@ namespace ts {
6476
6476
tags . end = tag . end ;
6477
6477
}
6478
6478
6479
- function tryParseTypeExpression ( ) : JSDocTypeExpression {
6479
+ function tryParseTypeExpression ( ) : JSDocTypeExpression | undefined {
6480
6480
return tryParse ( ( ) => {
6481
6481
skipWhitespace ( ) ;
6482
6482
if ( token ( ) !== SyntaxKind . OpenBraceToken ) {
@@ -6767,7 +6767,7 @@ namespace ts {
6767
6767
return false ;
6768
6768
}
6769
6769
6770
- function parseTemplateTag ( atToken : AtToken , tagName : Identifier ) : JSDocTemplateTag {
6770
+ function parseTemplateTag ( atToken : AtToken , tagName : Identifier ) : JSDocTemplateTag | undefined {
6771
6771
if ( forEach ( tags , t => t . kind === SyntaxKind . JSDocTemplateTag ) ) {
6772
6772
parseErrorAtPosition ( tagName . pos , scanner . getTokenPos ( ) - tagName . pos , Diagnostics . _0_tag_already_specified , tagName . escapedText ) ;
6773
6773
}
@@ -6829,12 +6829,10 @@ namespace ts {
6829
6829
return entity ;
6830
6830
}
6831
6831
6832
- function parseJSDocIdentifierName ( createIfMissing = false ) : Identifier {
6833
- return createJSDocIdentifier ( tokenIsIdentifierOrKeyword ( token ( ) ) , createIfMissing ) ;
6834
- }
6835
-
6836
- function createJSDocIdentifier ( isIdentifier : boolean , createIfMissing : boolean ) : Identifier {
6837
- if ( ! isIdentifier ) {
6832
+ function parseJSDocIdentifierName ( ) : Identifier | undefined ;
6833
+ function parseJSDocIdentifierName ( createIfMissing : true ) : Identifier ;
6834
+ function parseJSDocIdentifierName ( createIfMissing = false ) : Identifier | undefined {
6835
+ if ( ! tokenIsIdentifierOrKeyword ( token ( ) ) ) {
6838
6836
if ( createIfMissing ) {
6839
6837
return createMissingNode < Identifier > ( SyntaxKind . Identifier , /*reportAtCurrentPosition*/ true , Diagnostics . Identifier_expected ) ;
6840
6838
}
@@ -7215,7 +7213,7 @@ namespace ts {
7215
7213
}
7216
7214
}
7217
7215
7218
- function getLastChildWorker ( node : Node ) : Node {
7216
+ function getLastChildWorker ( node : Node ) : Node | undefined {
7219
7217
let last : Node = undefined ;
7220
7218
forEachChild ( node , child => {
7221
7219
if ( nodeIsPresent ( child ) ) {
0 commit comments