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

fix: check for null variable when excludeNotExported is true #694

Merged
merged 1 commit into from Feb 2, 2018

Conversation

raymondfeng
Copy link
Contributor

The PR fixes the TypeError when excludeNotExported option is set to true against the following TS file:

export const x = 5;

export function add(x: number, y: number) {
    return x + y;
}

// Add a local var/function to make sure typedoc won't choke
// if excludeNotExported is true
let localVar = 'local';

function times(x: number, y: number) {
    return x * y;
}

The stack trace was:

TypeError: Cannot read property 'setFlag' of null
      at VariableConverter.convert (node_modules/typedoc/dist/lib/converter/nodes/variable.js:79:30)
      at Converter.convertNode (node_modules/typedoc/dist/lib/converter/converter.js:127:53)
      at node_modules/typedoc/dist/lib/converter/nodes/variable-statement.js:39:33
      at Array.forEach (<anonymous>)
      at VariableStatementConverter.convert (node_modules/typedoc/dist/lib/converter/nodes/variable-statement.js:34:47)
      at Converter.convertNode (node_modules/typedoc/dist/lib/converter/converter.js:127:53)
      at node_modules/typedoc/dist/lib/converter/nodes/block.js:85:29
      at Array.forEach (<anonymous>)
      at BlockConverter.convertStatements (node_modules/typedoc/dist/lib/converter/nodes/block.js:84:26)
      at node_modules/typedoc/dist/lib/converter/nodes/block.js:62:27
      at Context.withScope (node_modules/typedoc/dist/lib/converter/context.js:107:9)
      at node_modules/typedoc/dist/lib/converter/nodes/block.js:61:25
      at Context.withSourceFile (node_modules/typedoc/dist/lib/converter/context.js:87:9)
      at BlockConverter.convertSourceFile (node_modules/typedoc/dist/lib/converter/nodes/block.js:58:17)
      at BlockConverter.convert (node_modules/typedoc/dist/lib/converter/nodes/block.js:48:18)
      at Converter.convertNode (node_modules/typedoc/dist/lib/converter/converter.js:127:53)
      at node_modules/typedoc/dist/lib/converter/converter.js:155:19
      at Array.forEach (<anonymous>)
      at Converter.compile (node_modules/typedoc/dist/lib/converter/converter.js:154:34)
      at Converter.convert (node_modules/typedoc/dist/lib/converter/converter.js:110:27)

@aciccarello
Copy link
Collaborator

Thanks! I was just working on that but this is great!

@aciccarello aciccarello merged commit fa6d9fe into TypeStrong:master Feb 2, 2018
@raymondfeng
Copy link
Contributor Author

@aciccarello Thank you for the prompt acceptance. I look forward to a new typedoc release soon.

@aciccarello
Copy link
Collaborator

Thanks for a prompt PR! I'm going to hold off on a patch release for now in case there are any other issues from the last release. I also want to improve some of the test flakiness so the release process is easier.

@EvanDarwin
Copy link

Awesome! Thanks for the quick response guys! 👍

mattyclarkson added a commit to ef-carbon/tspm that referenced this pull request Feb 6, 2018
Can be re-enabled once TypeStrong/typedoc#694 is released. Probably
in 0.10.1
mattyclarkson added a commit to ef-carbon/tspm that referenced this pull request Feb 6, 2018
Can be re-enabled once TypeStrong/typedoc#694 is released. Probably
in 0.10.1
@patrickhulce
Copy link

Awesome work! I was just visiting the repo to find this :) any word on when a 0.10.1 will go out with this fix @aciccarello?

@dupski
Copy link

dupski commented Feb 19, 2018

I can confirm that latest master fixes this issue for me too @aciccarello

fabioberger added a commit to 0xProject/typedoc that referenced this pull request Mar 1, 2018
* 'master' of github.com:TypeStrong/typedoc:
  Don't write BOM for search index file (TypeStrong#705)
  fix: check for null variable when excludeNotExported is true (TypeStrong#694)
  0.10.0
  Update dependencies (TypeStrong#689)
  Allow multiple excludes (TypeStrong#592)
  fix(package): update fs-extra to version 5.0.0 (TypeStrong#661)
  fix(package): update @types/highlight.js to version 9.12.0 (TypeStrong#647)
  Fix `--plugin` argument parsing (TypeStrong#682)
  update renderer specs
  Upgrade tslint to 5.9.1 (TypeStrong#683)
  Implemented '--excludeProtected' option similar to the '--excludePriv… (TypeStrong#666)
  Use remove component method (TypeStrong#664)
  Added support for generic type aliases (TypeStrong#622)
  dont parse comment for tags inside a code block (TypeStrong#633)

# Conflicts:
#	package.json
#	src/lib/utils/options/sources/component.ts
@aciccarello aciccarello modified the milestone: 0.11.0 Mar 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants