Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Type casting inside decorator call breaks document generation #727

Closed
peterbakonyi05 opened this issue Feb 11, 2019 · 1 comment
Closed

Comments

@peterbakonyi05
Copy link

peterbakonyi05 commented Feb 11, 2019

Overview of the issue

The line with @throttle breaks because the type will be a Node object and not a string when BasicTypeUtil.isJavascriptType is called with this syntax.

// util.const.ts
export const enum PollingSpeed {
	Low = 1000,
	High = 100
}

// some-feature.ts
import { throttle } from "lodash-decorators";

import { PollingSpeed } from "./util.const.ts"

export class SomeFeature {

    @throttle(1000 as PollingSpeed, { leading: true })
    doSomething() {
        // do something throttled
    }

}
Operating System, Node.js, npm, compodoc version(s)

1.1.8
Typescript version : 2.9.1
Node.js version : v10.15.0
Operating system : Windows 10

Angular configuration, a package.json file in the root folder

https://github.com/alan-agius4/ng-mono-repo-starter/blob/master/package.json#L17

Compodoc installed globally or locally ?

Locally

If possible sourcecode of the file where it breaks

https://github.com/compodoc/compodoc/blob/develop/src/utils/basic-type.util.ts#L32

If possible your terminal logs before the error
1.1.7

Typescript version : 2.9.1

Node.js version : v10.15.0

Operating system : Windows 10

Unhandled Rejection at: Promise {
  <rejected> TypeError: type.toLowerCase is not a function
      at BasicTypeUtil.isJavascriptType (C:\git\obg.ngx.packages.core\node_modules\@compodoc\compodoc\dist\index-cli.js:985:26)
      at BasicTypeUtil.isKnownType (C:\git\obg.ngx.packages.core\node_modules\@compodoc\compodoc\dist\index-cli.js:1009:21)
      at C:\git\obg.ngx.packages.core\node_modules\@compodoc\compodoc\dist\index-cli.js:4731:38
      at Array.map (<anonymous>)
      at ClassHelper.stringifyArguments (C:\git\obg.ngx.packages.core\node_modules\@compodoc\compodoc\dist\index-cli.js:4698:14)
      at C:\git\obg.ngx.packages.core\node_modules\@compodoc\compodoc\dist\index-cli.js:4643:59
      at arrayEach (C:\git\obg.ngx.packages.core\node_modules\lodash\lodash.js:516:11)
      at Function.forEach (C:\git\obg.ngx.packages.core\node_modules\lodash\lodash.js:9344:14)
      at ClassHelper.formatDecorators (C:\git\obg.ngx.packages.core\node_modules\@compodoc\compodoc\dist\index-cli.js:4635:11)
      at ClassHelper.visitMethodDeclaration (C:\git\obg.ngx.packages.core\node_modules\@compodoc\compodoc\dist\index-cli.js:5584:38) } reason: TypeError: type.toLowerCase is not a function
    at BasicTypeUtil.isJavascriptType (C:\git\obg.ngx.packages.core\node_modules\@compodoc\compodoc\dist\index-cli.js:985:26)
    at BasicTypeUtil.isKnownType (C:\git\obg.ngx.packages.core\node_modules\@compodoc\compodoc\dist\index-cli.js:1009:21)
    at C:\git\obg.ngx.packages.core\node_modules\@compodoc\compodoc\dist\index-cli.js:4731:38
    at Array.map (<anonymous>)
    at ClassHelper.stringifyArguments (C:\git\obg.ngx.packages.core\node_modules\@compodoc\compodoc\dist\index-cli.js:4698:14)
    at C:\git\obg.ngx.packages.core\node_modules\@compodoc\compodoc\dist\index-cli.js:4643:59
    at arrayEach (C:\git\obg.ngx.packages.core\node_modules\lodash\lodash.js:516:11)
    at Function.forEach (C:\git\obg.ngx.packages.core\node_modules\lodash\lodash.js:9344:14)
    at ClassHelper.formatDecorators (C:\git\obg.ngx.packages.core\node_modules\@compodoc\compodoc\dist\index-cli.js:4635:11)
    at ClassHelper.visitMethodDeclaration (C:\git\obg.ngx.packages.core\node_modules\@compodoc\compodoc\dist\index-cli.js:5584:38)
Motivation for or Use Case

Consumer would expect that any valid TS syntax is supported by compodoc.

Reproduce the error

Just place the above example in a project and run compodoct

@lock
Copy link

lock bot commented Sep 30, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem. Why locking ? Having issues with the most up-to-date context.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant