1- import { IDocElement , IHrefLinkElement , ICodeLinkElement } from './IDocElement' ;
1+ import { ITextElement , IDocElement , IHrefLinkElement , ICodeLinkElement , ISeeDocElement } from './IDocElement' ;
22import { IApiDefinitionReference } from './IApiDefinitionReference' ;
33import ApiDocumentation from './definitions/ApiDocumentation' ;
44import Token from './Token' ;
@@ -8,19 +8,19 @@ export default class DocElementParser {
88
99 /**
1010 * Matches only strings that contain characters for words.
11- * Any non word characters or spaces, will be present in the third entry in the match results
11+ * Any non word characters or spaces, will be present in the third entry in the match results
1212 * if they exist.
1313 */
1414 private static _wordRegEx : RegExp = / ^ ( [ \w \s ] * ) / ;
1515
1616 /**
1717 * Matches a href reference. This is used to get an idea whether a given reference is for an href
1818 * or an API definition reference.
19- *
19+ *
2020 * For example, the following would be matched:
2121 * 'http://'
2222 * 'https://'
23- *
23+ *
2424 * The following would not be matched:
2525 * '@microsoft/sp-core-library:Guid.newGuid'
2626 * 'Guid.newGuid'
@@ -32,7 +32,7 @@ export default class DocElementParser {
3232 if ( ! text ) {
3333 return ;
3434 }
35- return { kind : 'textDocElement' , value : text } ;
35+ return { kind : 'textDocElement' , value : text } as ITextElement ;
3636 }
3737
3838 public static parse ( tokenizer : Tokenizer , reportError : ( message : string ) => void ) : IDocElement [ ] {
@@ -54,7 +54,7 @@ export default class DocElementParser {
5454 docElements . push ( {
5555 kind : 'seeDocElement' ,
5656 seeElements : this . parse ( tokenizer , reportError )
57- } ) ;
57+ } as ISeeDocElement ) ;
5858 break ;
5959 default :
6060 parsing = false ; // end of summary tokens
@@ -67,14 +67,14 @@ export default class DocElementParser {
6767 if ( linkDocElement ) {
6868 docElements . push ( linkDocElement ) ;
6969 }
70- tokenizer . getToken ( ) ; // get the link token
70+ tokenizer . getToken ( ) ; // get the link token
7171 break ;
7272 default :
7373 parsing = false ;
7474 break ;
7575 }
7676 } else if ( token . type === 'Text' ) {
77- docElements . push ( { kind : 'textDocElement' , value : token . text } ) ;
77+ docElements . push ( { kind : 'textDocElement' , value : token . text } as ITextElement ) ;
7878 tokenizer . getToken ( ) ;
7979 } else {
8080 reportError ( `Unidentifiable Token ${ token . type } ${ token . tag } ${ token . text } ` ) ;
@@ -85,12 +85,12 @@ export default class DocElementParser {
8585
8686 /**
8787 * This method parses the semantic information in an \@link JSDoc tag, creates and returns a
88- * linkDocElement with the corresponding information. If the corresponding inline tag \@link is
88+ * linkDocElement with the corresponding information. If the corresponding inline tag \@link is
8989 * not formatted correctly an error will be reported.
90- *
91- * The format for the \@link tag is {\@link url or API defintion reference | display text}, where
90+ *
91+ * The format for the \@link tag is {\@link url or API defintion reference | display text}, where
9292 * the '|' is only needed if the optional display text is given.
93- *
93+ *
9494 * Examples:
9595 * \{@link http://microsoft.com | microsoft home \}
9696 * \{@link http://microsoft.com \}
@@ -104,7 +104,7 @@ export default class DocElementParser {
104104 return ;
105105 }
106106
107- // Make sure there are no extra pipes
107+ // Make sure there are no extra pipes
108108 let pipeSplitContent : string [ ] = tokenItem . text . split ( '|' ) ;
109109 pipeSplitContent = pipeSplitContent . map ( value => {
110110 if ( value ) {
@@ -116,7 +116,7 @@ export default class DocElementParser {
116116 return ;
117117 }
118118
119- // Try to guess if the tokenContent is a link or API definition reference
119+ // Try to guess if the tokenContent is a link or API definition reference
120120 let linkDocElement : ICodeLinkElement | IHrefLinkElement ;
121121 if ( tokenItem . text . match ( this . _hrefRegEx ) ) {
122122 const urlContent : string [ ] = pipeSplitContent [ 0 ] . split ( ' ' ) ;
@@ -135,7 +135,7 @@ export default class DocElementParser {
135135 } ;
136136
137137 } else {
138- // we are processing an API definition reference
138+ // we are processing an API definition reference
139139 const apiDefitionRef : IApiDefinitionReference = ApiDocumentation . parseApiReferenceExpression (
140140 pipeSplitContent [ 0 ] , reportError ) ;
141141
@@ -160,7 +160,7 @@ export default class DocElementParser {
160160 reportError ( 'Display name in @link token may only contain alphabetic characters.' ) ;
161161 return ;
162162 }
163- // Full match is valid text
163+ // Full match is valid text
164164 linkDocElement . value = displayTextParts [ 0 ] . trim ( ) ;
165165 }
166166
0 commit comments