You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/**
* Throws an <code>Error</code> if <code>condition</code> is false.
*
* @param {boolean} condition a condition
* @param {Error} [error = Error] the type of error to throw
* @param {string} message the error message to use on failure
* @throws {Error} if <code>condition</code> is false
*/
static assert(condition: boolean, error: (message?: string) => Error = Error, message?: string):
asserts condition
{
// Will be stripped out using uglify.js option "pure_funcs"
if (!condition)
throw error(message);
}
However, when I run jsdoc against using better-docs/typescript plugin I get:
ERROR: Unable to parse a tag's type expression for source file C:\Users\Gili\Documents\requirements.js\target\jsdoc-workaround\internal\Objects.ts in line 429 with tag title "return" and text "{asserts condition}": Invalid type expression "asserts condition": Expected "|" but "c" found.
As a workaround, I now replace all instances of "asserts condition" with "void" before running jsdoc. This made the error disappear.
The text was updated successfully, but these errors were encountered:
Per https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions the following Typescript code is valid:
However, when I run jsdoc against using
better-docs/typescript
plugin I get:As a workaround, I now replace all instances of "asserts condition" with "void" before running jsdoc. This made the error disappear.
The text was updated successfully, but these errors were encountered: