Skip to content

Commit

Permalink
docs: avoid return type of null for tokenize
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed May 10, 2022
1 parent 616deb4 commit 968d5d9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dist/espree.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* Tokenizes the given code.
* @param {string} code The code to tokenize.
* @param {ParserOptions} options Options defining how to tokenize.
* @returns {import('acorn').Token[] | null} An array of tokens.
* @returns {import('acorn').Token[]} An array of tokens.
* @throws {import('./lib/espree').EnhancedSyntaxError} If the input code is invalid.
* @private
*/
export function tokenize(code: string, options: ParserOptions): import('acorn').Token[] | null;
export function tokenize(code: string, options: ParserOptions): import('acorn').Token[];
/**
* Parses the given code.
* @param {string} code The code to tokenize.
Expand Down
2 changes: 1 addition & 1 deletion dist/espree.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions espree.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ const parsers = {
* Tokenizes the given code.
* @param {string} code The code to tokenize.
* @param {ParserOptions} options Options defining how to tokenize.
* @returns {acorn.Token[]|null} An array of tokens.
* @returns {acorn.Token[]} An array of tokens.
* @throws {EnhancedSyntaxError} If the input code is invalid.
* @private
*/
Expand All @@ -194,7 +194,7 @@ export function tokenize(code, options) {
options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign
}

return new Parser(options, code).tokenize();
return /** @type {acorn.Token[]} */ (new Parser(options, code).tokenize());
}

//------------------------------------------------------------------------------
Expand Down

0 comments on commit 968d5d9

Please sign in to comment.