Gerrit0 / typedoc-plugin-missing-exports

MIT License
45 stars 4 forks source link

Missing declaration context #2

Closed raminious closed 3 years ago

raminious commented 3 years ago

Hi I'm trying to run the plugin over my project and getting this error

please find the repo here PikasoJs/Pikaso


Info: Loaded plugin typedoc-plugin-missing-exports
TypeDoc exiting with unexpected error:
AssertionError [ERR_ASSERTION]: Missing declaration context
    at convertFunctionOrMethod (/pikaso/node_modules/typedoc/dist/lib/converter/symbols.js:211:5)
    at Object.convertProperty (/pikaso/node_modules/typedoc/dist/lib/converter/symbols.js:324:16)
    at convertSymbol (/pikaso/node_modules/typedoc/dist/lib/converter/symbols.js:120:88)
    at convertSymbols (/pikaso/node_modules/typedoc/dist/lib/converter/symbols.js:126:9)
    at Object.convertNamespace (/pikaso/node_modules/typedoc/dist/lib/converter/symbols.js:158:5)
    at convertSymbol (/pikaso/node_modules/typedoc/dist/lib/converter/symbols.js:120:88)
    at Converter.convertSymbol (/pikaso/node_modules/typedoc/dist/lib/converter/converter.js:45:37)
    at onResolveBegin (/pikaso/node_modules/typedoc-plugin-missing-exports/index.js:44:43)
    at triggerEvents (/pikaso/node_modules/typedoc/dist/lib/utils/events.js:191:43)
    at triggerApi (/pikaso/node_modules/typedoc/dist/lib/utils/events.js:167:13) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: true,
  operator: '=='
}
Gerrit0 commented 3 years ago

Wow that's an assert I really never expected to see trip. Makes sense that it could show up here but not without this plugin, but still...

Gerrit0 commented 3 years ago

This is apparently because the symbol undefined isn't defined anywhere... and is a function?! I don't understand what went wrong here. Will try to look into it more next weekend. This might be a bug in TypeDoc itself.

Gerrit0 commented 3 years ago

I actually think this plugin should maybe forcibly ignore types in lib declaration files, I'm not sure it makes any sense to document globalThis....

Gerrit0 commented 3 years ago

... and this is a bug in TypeDoc. Easy, fix, just need a check to ensure there's at least one declaration here:

https://github.com/TypeStrong/typedoc/blob/d8f3496e5a733e87b84b12ec2d26f3a698523ccf/src/lib/converter/symbols.ts#L585-L593

raminious commented 3 years ago

Although I could get over my problem without it, I think it's great to fix the issue. thanks for the efforts and updates 👍

Gerrit0 commented 3 years ago

TypeDoc 0.22.5 should fix the crash, leaving this open to track adding an option to exclude types from node_modules

jsalvata commented 3 years ago

Is this related?

Info: Loaded plugin typedoc-plugin-missing-exports
Info: Loaded plugin typedoc-plugin-rename-defaults
TypeDoc exiting with unexpected error:
AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  assert(parentSymbol)

    at isInherited (./node_modules/typedoc/dist/lib/converter/symbols.js:531:5)
    at Object.convertProperty (./node_modules/typedoc/dist/lib/converter/symbols.js:319:9)
    at convertSymbol (./node_modules/typedoc/dist/lib/converter/symbols.js:120:88)
    at Converter.convertSymbol (./node_modules/typedoc/dist/lib/converter/converter.js:45:37)
    at onResolveBegin (./node_modules/typedoc-plugin-missing-exports/index.js:44:29)
    at triggerEvents (./node_modules/typedoc/dist/lib/utils/events.js:191:43)
    at triggerApi (./node_modules/typedoc/dist/lib/utils/events.js:167:13)
    at eventsApi (./node_modules/typedoc/dist/lib/utils/events.js:60:18)
    at Converter.trigger (./node_modules/typedoc/dist/lib/utils/events.js:389:13)
    at Converter.resolve (./node_modules/typedoc/dist/lib/converter/converter.js:199:14) {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: true,
  operator: '=='
}
Gerrit0 commented 3 years ago

Looks like a different problem - open a new issue with a reproduction please

jsalvata commented 3 years ago

Thanks @Gerrit0. I'll try to find a reproduction I can share.

Gerrit0 commented 3 years ago

leaving this open to track adding an option to exclude types from node_modules

On second thought, it doesn't make sense to do this. It can be achieved with TypeDoc's --exclude option.