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

AssertionError [ERR_ASSERTION]: Should be impossible, disallowed by converter after upgrading to 0.20.31 #1538

Labels
bug Functionality does not match expectation

Comments

@doberkofler
Copy link

Search terms

AssertionError [ERR_ASSERTION]: Should be impossible, disallowed by converter.

Expected Behavior

Actual Behavior

After upgrading from 0.20.30 to 0.20.31 the following assertion is thrown:

TypeDoc exiting with unexpected error:
AssertionError [ERR_ASSERTION]: Should be impossible, disallowed by converter.
    at ImplementsPlugin.getExtensionInfo (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/typedoc/dist/lib/converter/plugins/ImplementsPlugin.js:147:18)
    at ImplementsPlugin.onDeclaration (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/typedoc/dist/lib/converter/plugins/ImplementsPlugin.js:170:27)
    at triggerEvents (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/typedoc/dist/lib/utils/events.js:183:43)
    at triggerApi (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/typedoc/dist/lib/utils/events.js:149:13)
    at eventsApi (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/typedoc/dist/lib/utils/events.js:42:18)
    at Converter.trigger (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/typedoc/dist/lib/utils/events.js:371:13)
    at Context.trigger (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/typedoc/dist/lib/converter/context.js:163:24)
    at Object.convertType (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/typedoc/dist/lib/converter/types.js:165:17)
    at convertType (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/typedoc/dist/lib/converter/types.js:100:34)
    at /Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/typedoc/dist/lib/converter/types.js:643:64 {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '=='
}

Steps to reproduce the bug

Environment

  • Typedoc version: 0.20.31
  • TypeScript version: 4.2.3
  • Node.js version: 14.16.0
  • OS: macOS 11.2.3
@doberkofler doberkofler added the bug Functionality does not match expectation label Mar 14, 2021
@Gerrit0 Gerrit0 added the needs reproduction Needs a minimal reproducible case label Mar 14, 2021
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 14, 2021

This is completely unactionable without a reproduction.

@doberkofler
Copy link
Author

@Gerrit0 I understand, but could you help me to trace the problem down? The assert does not give an indication on what source file caused the error and without that information, I would not know where to start.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 14, 2021

If you open node_modules/typedoc/dist/lib/converter/plugins/ImplementsPlugin.js and modify the assert to include reflection.getFullName(), that should help narrow it down.

... I should probably create a custom assert function that automatically annotates assert messages with useful info. It's entirely too easy to forget to do it somewhere.

@doberkofler
Copy link
Author

The problem can be reproduced with the following example:

export class UiElement {}

export class UiForm {
	/**
	 * Get the element by name.
	 */
	public getElementByName<T=UiElement>(elementName: string, cls?: new (...a: Array<any>) => T): T {
		return null as unknown as T;
	}
}

@doberkofler
Copy link
Author

... I should probably create a custom assert function that automatically annotates assert messages with useful info. It's entirely too easy to forget to do it somewhere.

This would be a great improvement. After your reply, I remembered to already have modified the assert in the past but just forgot.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 14, 2021

Doh. Of course that fails.. I'm just surprised none of the existing tests ran into that... thanks for the repro!

@Gerrit0 Gerrit0 removed the needs reproduction Needs a minimal reproducible case label Mar 14, 2021
Gerrit0 added a commit that referenced this issue Mar 14, 2021
This was referenced Mar 15, 2021
This was referenced Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment