-
-
Notifications
You must be signed in to change notification settings - Fork 750
Closed
Description
Search terms
enum, JavaScript, JSDoc
Actual Behavior
After upgrading from 0.17.0-3 to 0.20.14, typedoc throws the following error:
AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
assert(declaration)
at Object.convertTypeAlias (/Users/strobel/git/_repos/crossmip/node_modules/typedoc/dist/lib/converter/symbols.js:111:7)
at convertSymbol (/Users/strobel/git/_repos/crossmip/node_modules/typedoc/dist/lib/converter/symbols.js:81:79)
at Object.convertAlias (/Users/strobel/git/_repos/crossmip/node_modules/typedoc/dist/lib/converter/symbols.js:375:9)
at Object.convertSymbol (/Users/strobel/git/_repos/crossmip/node_modules/typedoc/dist/lib/converter/symbols.js:81:79)
at Converter.convertReExports (/Users/strobel/git/_repos/crossmip/node_modules/typedoc/dist/lib/converter/converter.js:186:23)
at Converter.compile (/Users/strobel/git/_repos/crossmip/node_modules/typedoc/dist/lib/converter/converter.js:161:18)
at Converter.convert (/Users/strobel/git/_repos/crossmip/node_modules/typedoc/dist/lib/converter/converter.js:42:14)
at Application.convert (/Users/strobel/git/_repos/crossmip/node_modules/typedoc/dist/lib/application.js:151:31)
at run (/Users/strobel/git/_repos/crossmip/node_modules/typedoc/bin/typedoc:61:25)
at Object.<anonymous> (/Users/strobel/git/_repos/crossmip/node_modules/typedoc/bin/typedoc:27:1) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: undefined,
expected: true,
operator: '=='
}
Steps to reproduce the bug
We have a project that is somewhere in the middle of the TypeScript migration, with some JS code that is typed via JSDoc. We are using typedoc to generate API documentation from mixed TypeScript and JavaScript sources.
It seems that the problem is the JSDoc @enum, which creates a type alias.
column-type.js
/** @enum {string} */
export const ColumnType = {
STRING: 'string',
NUMBER: 'number',
BOOLEAN: 'boolean',
DATE_TIME: 'datetime',
DATE: 'date',
TIME: 'time',
ICON: 'icon',
};
index.ts
export { ColumnType } from './column-type';
tsconfig.json
{
"compilerOptions": {
"noEmit": true,
"allowJs": true,
"target": "esnext",
"lib": ["es6", "dom", "esnext"],
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"pretty": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "react",
"noUnusedLocals": true,
"resolveJsonModule": true,
"baseUrl": "./node_modules"
}
typedoc.json
{
"readme": "none",
"exclude": ["**/test/**", "**/public/**"],
"excludePrivate": true,
"excludeExternals": true
}
typedoc command
typedoc --options typedoc.json --tsconfig tsconfig.json --out public/api/package packages/package/src/index.ts
When hovering over the re-export line in VS Code, the type is resolved as the following:
(alias) type ColumnType = string
(alias) const ColumnType: {
STRING: string;
NUMBER: string;
BOOLEAN: string;
DATE_TIME: string;
DATE: string;
TIME: string;
ICON: string;
}
After migrating the affected files to a Typescript enum, the error disappears.
Environment
- Typedoc version: 0.20.14
- TypeScript version: 3.9.7
- Node.js version: 12.16.3
- OS: MacOS 11.1
Metadata
Metadata
Assignees
Labels
No labels